@@ -73,6 +73,8 @@ impl PhysicsHooks for SablePhysicsHooks {
7373 collider_a,
7474 Some ( level_collider_a) ,
7575 & contact. point ,
76+ collider_b. position ( ) ,
77+ level_collider_b,
7678 velocity,
7779 manifold_index,
7880 true ,
@@ -89,6 +91,8 @@ impl PhysicsHooks for SablePhysicsHooks {
8991 collider_b,
9092 Some ( level_collider_b) ,
9193 & contact. point ,
94+ collider_a. position ( ) ,
95+ level_collider_a,
9296 velocity,
9397 manifold_index,
9498 false ,
@@ -144,6 +148,8 @@ fn handle_block_params(
144148 _collider : & Collider ,
145149 level_collider : Option < & LevelCollider > ,
146150 global_point : & Vector ,
151+ other_isometry : & Pose ,
152+ other_level_collider : Option < & LevelCollider > ,
147153 velocity : Real ,
148154 manifold_index : usize ,
149155 body_a : bool ,
@@ -152,6 +158,7 @@ fn handle_block_params(
152158 let scene = get_scene_mut ( level_collider. unwrap ( ) . scene_id ) ;
153159
154160 let collider_info = level_collider. and_then ( |lc| lc. id . map ( |id| & scene. level_colliders [ & ( id) ] ) ) ;
161+ let other_collider_info = other_level_collider. and_then ( |lc| lc. id . map ( |id| & scene. level_colliders [ & ( id) ] ) ) ;
155162
156163 let mut tangent_velo: Vector = Vector :: ZERO ;
157164
@@ -175,6 +182,12 @@ fn handle_block_params(
175182 manifold_info. pos_b
176183 } ;
177184
185+ let other_block_coord = if body_a {
186+ manifold_info. pos_b
187+ } else {
188+ manifold_info. pos_a
189+ } ;
190+
178191 let block_id = if body_a {
179192 manifold_info. col_a as u32
180193 } else {
@@ -186,6 +199,11 @@ fn handle_block_params(
186199 let block_coord_d: Vector3 < f64 > =
187200 Vector3 :: new ( local. x as f64 , local. y as f64 , local. z as f64 ) + center_of_mass;
188201
202+ let other_center_of_mass = other_collider_info. map_or ( Vector3 :: zeros ( ) , |b| b. center_of_mass . unwrap ( ) ) ;
203+ let other_local = other_isometry. inverse_transform_point ( * global_point) ;
204+ let other_block_coord_d: Vector3 < f64 > =
205+ Vector3 :: new ( other_local. x as f64 , other_local. y as f64 , other_local. z as f64 ) + other_center_of_mass;
206+
189207 if block_id == 0 {
190208 return ( tangent_velo, false , 1.0 , 0.0 ) ;
191209 }
@@ -228,6 +246,12 @@ fn handle_block_params(
228246 JValue :: Double ( block_coord_d. x ) ,
229247 JValue :: Double ( block_coord_d. y ) ,
230248 JValue :: Double ( block_coord_d. z ) ,
249+ JValue :: Int ( other_block_coord. x as jint ) ,
250+ JValue :: Int ( other_block_coord. y as jint ) ,
251+ JValue :: Int ( other_block_coord. z as jint ) ,
252+ JValue :: Double ( other_block_coord_d. x ) ,
253+ JValue :: Double ( other_block_coord_d. y ) ,
254+ JValue :: Double ( other_block_coord_d. z ) ,
231255 JValue :: Double ( velocity as jdouble ) ,
232256 ] ;
233257
0 commit comments