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. Dismiss Notice

Question Configurable joint current torque doesn't reflect all constraints

Discussion in 'Physics' started by elijad, May 15, 2021.

  1. elijad

    elijad

    Joined:
    Mar 19, 2020
    Posts:
    46
    It seems that ConfigurableJoint.currentTorque doesn't include torque applied to solve for drive constraints aka target rotation. It only reports any values when joint is about to go out of rotation limits. Is there any info on how to calculate torque applied by drives manually?

    Here, current torque is shown as Colored vectors when joint's rotation constraints are set to locked. To counteract gravity and keep the body horizontal, the joint applies torque along X and Z axis.
    upload_2021-5-15_16-29-40.png



    Here, rotation constraints are set to free and target rotation is set to match the direction of the white line. The joint is kept mostly horizontal by drives but no torque is reported.
    upload_2021-5-15_16-25-40.png

    To summarize, here is a view of the inspector.

    upload_2021-5-15_16-32-14.png

    Any info on how to calculate the actual drive torque would be appreciated.
     
  2. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    1,996
    Probably not.
    I was fighting with ConfigurableJoint quite a lot also realized currentTorque is useless and generally how troublesome it is.
    You could try calculate torque applied when you got two bodies connected and there are no influences from the world like collisions. This could be done by reading positions and orientations every fixed frame and calculating changes.