Hello, I’m working on a 2D racing game. I need to be able to upgrade the suspension (which changes damping ratio and frequency). However, I haven’t been able to find out how to make this work in the game.
Here is what I have. But again, it has no effect on the car in the game. (if I change the settings in the editor, it of course changes it in the game but I need to be able to change it in code)
public WheelJoint2D motorWheel;
public JointSuspension2D jointSuspension;
void Start () {
jointSuspension = motorWheel.suspension;
jointSuspension.dampingRatio = 0.01f;
jointSuspension.frequency = 0;
…
}
Thanks for any suggestions!