Set the angle of a hinge joint in CannonJS

Is there any way I can rotate a hinge joint to a specific angle? So far the only way I have figured out how to rotate a hinge is just by using the motor or apply a force to it. But I would like to set the hinge to a specific angle. Thanks in advance!

Hi @NFonseca1 , welcome to the forum!

Can you explain the use case? we might be able to help with that after understanding what exactly you need.
We don’t support that directly, and AFAIK, cannon.js doesn’t support that as well. A joint is controlled by forces (as you found out already), and is usually not fixed using an angle. If you need a joint to be fixed at a certain angle, consider using compounds instead

@RaananW Ahh gotcha. The reason is because I am trying to create car physics and I would like the steering to be handled by simply setting the angle of the wheel joint. Currently I’m using a motor for it and basically telling the motor to stop when the joint mesh reaches a certain angle. Doing so works well but it still can be a bit janky at times, so I wasn’t sure if there was an easier way to handle this.

You can limit the angle to which the wheel turns to (which will be the closest you will get to a fixed rotation of the joint. Which i assume you are already doing.

You don’t have to use a joint on the wheel rotation (to turn right and left). You can set the angle of the impostor yourself and avoid using a joint for steering. This way you are in full control, but will need to adjust the rotation yourself