Commit 0c8f94f 1 parent db3a546 commit 0c8f94f Copy full SHA for 0c8f94f
File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,38 @@ impl PhysicsEngine {
246
246
compute_impact_geometry_on_penetration : true ,
247
247
..Default :: default ( )
248
248
} ;
249
+ // Stationary shapes
250
+ if shape_vel1. magnitude_squared ( ) < DEFAULT_EPSILON
251
+ && shape_vel2. magnitude_squared ( ) < DEFAULT_EPSILON
252
+ {
253
+ let contact_result = parry:: query:: contact (
254
+ & shape_transform1,
255
+ shared_shape1. as_ref ( ) ,
256
+ & shape_transform2,
257
+ shared_shape2. as_ref ( ) ,
258
+ 0.0 ,
259
+ ) ;
260
+ match contact_result {
261
+ Ok ( None ) => { }
262
+ Ok ( Some ( contact) ) => {
263
+ // the distance is negative if there is intersection
264
+ if contact. dist <= 0.0 {
265
+ result. toi = 0.0 ;
266
+ result. collided = true ;
267
+ result. normal1 = contact. normal1 . into_inner ( ) ;
268
+ result. normal2 = contact. normal2 . into_inner ( ) ;
269
+ result. pixel_witness1 = contact. point1 . coords
270
+ + shape_info1. transform . translation . vector ;
271
+ result. pixel_witness2 = contact. point2 . coords
272
+ + shape_info2. transform . translation . vector ;
273
+ }
274
+ }
275
+ Err ( err) => {
276
+ godot_error ! ( "contact error: {:?}" , err) ;
277
+ }
278
+ }
279
+ return result;
280
+ }
249
281
let toi_result = parry:: query:: cast_shapes (
250
282
& shape_transform1,
251
283
& shape_vel1,
You can’t perform that action at this time.
0 commit comments