- Home /
What is happening in HingeJoint2D motors?
If you have two objects connected via a HingeJoint2D and enable the motor with a target speed of 0 and use the GetMotorTorque(float timeStep) function you will see a small value that decreases every time step. Okay maybe it's converging towards zero.
Then if you give the motor a target speed, the torque value jumps up a bit but then continues to decrease every time step almost as if the motors are running out of battery? I doubt they have modelled batteries though as this wouldn't make sense to include as a baseline.
Also, if I set the maximum force of the motor to say 10, the value obtained through GetMotorTorque() is usually much smaller (like 0.01) even when I use a large mass and high target speed.
I can't find any documentation that explains what the values I'm getting are supposed to represent or how the motors in hinge joints work, please help!
It's like any kind of physical force, it's hardest at the initial torque, but slows down gradually without any new force. Like ANY physics object in Unity, if you want it to keep moving, you have to keep adding force.
Answer by MarshCZA · Mar 13, 2018 at 05:57 PM
It looks like I may have been using the GetMotorTorque() function incorrectly. I was putting in the current Time.fixedTime, really I should have been putting in the fixedDeltaTime. Sorted my problem anyway!
Your answer
Follow this Question
Related Questions
Creating a movement script to move up and down a chain (or rope) in a 2D game 1 Answer
Set targetjoint2d anchor position at mouse position in 2d 0 Answers
Dynamic wire using multiple DistanceJoint2D have a problem 0 Answers
How to Rotate 2D Object Without Changing Axis Orientation? 1 Answer
Help with 2D physics script 1 Answer