This repository was archived by the owner on Nov 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
classic_simulation/object Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ impl Simulation for ClassicSimulation {
182
182
position : vector ! [ pointer_pos. x, pointer_pos. y] ,
183
183
..CSObjectState :: default ( )
184
184
} )
185
+ . at ( state. current_step )
185
186
. build ( ) ,
186
187
) ;
187
188
}
@@ -207,9 +208,8 @@ impl Simulation for ClassicSimulation {
207
208
208
209
let length = self . objects . len ( ) ;
209
210
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 ) ;
213
213
214
214
let Some ( ( obj, rest) ) = end. split_first_mut ( ) else { panic ! ( "Cannot Reach" ) } ;
215
215
@@ -224,10 +224,13 @@ impl Simulation for ClassicSimulation {
224
224
physics_system ( obj, self . global_acc_list . iter ( ) . sum ( ) ) ;
225
225
226
226
for obj2 in rest {
227
-
228
227
let obj2_state = & mut obj2. current_state ( ) ;
229
228
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
+ ) {
231
234
info ! ( "{:?}" , contact) ;
232
235
}
233
236
}
Original file line number Diff line number Diff line change 1
-
2
- use crate :: app:: simulations:: classic_simulation:: CSimObject ;
3
- use crate :: app:: simulations:: classic_simulation:: object:: AttachedFn ;
4
1
use crate :: app:: simulations:: classic_simulation:: object:: shape:: ObjectShape ;
5
2
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 ;
6
5
7
6
pub struct CSimObjectBuilder {
8
7
init_state : Option < CSObjectState > ,
@@ -21,7 +20,7 @@ impl CSimObjectBuilder {
21
20
}
22
21
}
23
22
24
- pub fn init_timestep ( mut self , init_timestep : usize ) -> Self {
23
+ pub fn at ( mut self , init_timestep : usize ) -> Self {
25
24
self . init_timestep = Some ( init_timestep) ;
26
25
self
27
26
}
You can’t perform that action at this time.
0 commit comments