Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Hinge Joint Motors

Discussion in 'Physics for ECS' started by bobbygrizzz, Dec 20, 2019.

  1. bobbygrizzz


    Jun 16, 2019
    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.
    Phong likes this.
  2. steveeHavok


    Mar 19, 2019
    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.
    Phong likes this.