Hubs-Foundation / hubs

Duck-themed multi-user virtual spaces in WebVR. Built with A-Frame.
https://hubsfoundation.org
Mozilla Public License 2.0
2.13k stars 1.41k forks source link

BG - Kinematic bodies are yielding to dynamic bodies #6314

Open j-conrad opened 1 year ago

j-conrad commented 1 year ago

Description If a physics body is set to be Kinematic, dynamic physics objects are affecting it, especially when they are heavier than the kinematic body.

Kinematic bodies are typically used for animated objects, being dependent on the animation to move them or otherwise keep them in place. In other words, a kinematic body should always be unyielding to dynamic objects, only exerting force but not receiving it.

The magenta body is set to be kinematic. The heavier the dynamic cube is, the more it pushes the kinematic body--even to the point where it will push hard enough to slip past it.

Mass at 5kg: https://gyazo.com/361a386f2d2abea78f761cec178b741f

Mass at 50kg: https://gyazo.com/0ed6a0b154423fecf3e3dd8ca8cb5e20

To Reproduce Steps to reproduce the behavior:

  1. Open the included .blend file.
  2. You can change the Mass of the object called 'Body.dynamic' for different results.
  3. Export the .glb and load it in Hubs.
  4. turn on /debug to see the bodies and their reactions.
  5. The magenta kinematic body should be unyielding but instead it moves.

Expected behavior The magenta kinematic body should be unyielding but instead it moves.

Hardware

Additional context Attempting to change the Mass in behavior graph doesn't seem to work as expected so be sure to change the mass manually before export. KinematicBody_Bug.zip

Exairnous commented 1 year ago

The videos you show definitely seem buggy, but aren't there cases where you might want physics to override animation, e.g. you push on something motorized and your force overrides the motor?

j-conrad commented 1 year ago

Yes, but in that case, you would not use an animated body. You would drive it with physics as well (plus a motor force). Animated bodies are always unyielding. Essentially, just physics colliders parented to the animated object.

Exairnous commented 1 year ago

Ah, okay. Thank you for the explanation!