Skip to content
This repository was archived by the owner on Nov 10, 2024. It is now read-only.

Commit 15a667b

Browse files
committed
버그픽스 오브젝트 추가할대 버그 수정
1 parent 09e794f commit 15a667b

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/app/simulations/classic_simulation.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ impl Simulation for ClassicSimulation {
182182
position: vector![pointer_pos.x, pointer_pos.y],
183183
..CSObjectState::default()
184184
})
185+
.at(state.current_step)
185186
.build(),
186187
);
187188
}
@@ -207,9 +208,8 @@ impl Simulation for ClassicSimulation {
207208

208209
let length = self.objects.len();
209210

210-
for i in 1..length+1 {
211-
212-
let (front, end) = self.objects.split_at_mut(i-1);
211+
for i in 1..length + 1 {
212+
let (front, end) = self.objects.split_at_mut(i - 1);
213213

214214
let Some((obj, rest)) = end.split_first_mut() else {panic!("Cannot Reach")};
215215

@@ -224,10 +224,13 @@ impl Simulation for ClassicSimulation {
224224
physics_system(obj, self.global_acc_list.iter().sum());
225225

226226
for obj2 in rest {
227-
228227
let obj2_state = &mut obj2.current_state();
229228

230-
if let Some(contact) = obj_state.shape.contact(obj_state.position, &obj2_state.shape, obj2_state.position){
229+
if let Some(contact) = obj_state.shape.contact(
230+
obj_state.position,
231+
&obj2_state.shape,
232+
obj2_state.position,
233+
) {
231234
info!("{:?}", contact);
232235
}
233236
}

src/app/simulations/classic_simulation/object/builder.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
2-
use crate::app::simulations::classic_simulation::CSimObject;
3-
use crate::app::simulations::classic_simulation::object::AttachedFn;
41
use crate::app::simulations::classic_simulation::object::shape::ObjectShape;
52
use crate::app::simulations::classic_simulation::object::state::CSObjectState;
3+
use crate::app::simulations::classic_simulation::object::AttachedFn;
4+
use crate::app::simulations::classic_simulation::CSimObject;
65

76
pub struct CSimObjectBuilder {
87
init_state: Option<CSObjectState>,
@@ -21,7 +20,7 @@ impl CSimObjectBuilder {
2120
}
2221
}
2322

24-
pub fn init_timestep(mut self, init_timestep: usize) -> Self {
23+
pub fn at(mut self, init_timestep: usize) -> Self {
2524
self.init_timestep = Some(init_timestep);
2625
self
2726
}

0 commit comments

Comments
 (0)