Hinge Joint Motors

Most physics engines, like PhysX, allow you to enable a motor on the hinge joint to keep it at a target velocity with a given force. However, I do not see this sort of functionality currently in Unity Physics. Are there any plans to implement this functionality?

If not, is there any way to achieve similar behavior? In my simulation, I have a rigidbody (human body) connected to another rigidbody (hockey stick/baseball bat) via a hinge joint. I want the player to be able to control the stick/bat and swing it around, but I want it to behave independently of the parent rigidbody.

  1. When the player rigidbody moves around, I want the relative position/rotation of the stick ridibody to stay the same.
  2. When an object collides or a force pushes the stick, I want it to move the player body and stick together as a single unit, rather than pushing just the stick out of the way.
  3. When the player swings/pushes their stick against the wall (static rigidbody), it should push the player away from the wall.

I was previously able to achieve the behavior above with a motor on a hinge joint in PhysX, so any help would be appreciated.

1 Like

Motors are indeed planned in general but developed alongside the ragdoll work coming in the new year. Ultimately you are looking to set the velocity on the following body appropriately. If you work out the position and rotations you want the body to be at, then the keyframe utility mentioned here will help.

1 Like