Physics Motor Joints with Position mode can't use a custom rotation axis

Hello all,

I am designing a system which uses the Babylon Physics Constraints system. I want to provide the user to ability to specify exactly which rotation axis two bodies are connected, which means that I don’t know this axis at compile time neither can I guarantee that it isn’t a custom axis (not just (0,0,1); (0,1,0); (1,0,0))

This system has the ability to add a motor to this connection, which should be position-controlled.

From the documentation, I would assume that I could just specify this custom axis on the axisA and axisB options of the 6 DOF constraint, and always actuate on the ANGULAR_X axis (constraining the reminainig to LOCKED).

In this test I try to assign the axisA and axisB to the Y vector (for example). For velocity joints, they work as I would expect. For position joints, they don’t seem to work, unless the axisA and axisB vectors are also (1, 0, 0). Is this intended? What would be a way to have a custom rotation axis for a position motor?

I was able to create a system which uses a PID connected to a velocity-joint (since those seem to work) to do a position-feedback loop, but I wanted to avoid this complexity (since it seems kind of unstable) and do it natively in babylon/havok.

Thank you for the help

cc @RaananW

Checking, will follow up.

Would that be the expected behavior?

Your example works because you know that the axis that the joint should rotate is the Y-axis, so it is as expected.

In my application however, this axis is not static. the axis of rotation of the joint is a user-input so i need to be able to reassign this axis (for example to (1, 1, 0)).

I understood that if I change the axisA and axisB parameters of the constraint i was changing the corresponding “X axis” of the constraint, as per the documentation:

so driving the corresponding angular X would apply a rotation in my custom axis. This works for the velocity motors (as per my example), but not for position motors.

Is there anything different internally in the way havok handles position motors axis vs velocity motors?

It does seem to be an internal issue in the havok package, which we can’t directly change. I played around with it, and you are right - i would expect it to work. If it’s ok with you, I will wait for @Cedric to confirm and then will see how we can solve this.

1 Like

Maybe @eoin can help?

Hello everyone! Did anyone find a fix for this issue? I am having the same problem on my application.

Sorry, I was busy. I’ll take a look asap.

Same diagnostic and it looks a bit like Position motor does not reach target angle

Any idea @eoin ?

Hey, thanks for the report. Indeed, when setting targets on an angular position motor, we were using those targets as the relative orientation between the bodies, instead of the orientation in constraint space. Will get this fixed in a WASM update, so keep an eye out for @babylonjs/havok version 1.3.12.

3 Likes

This has been released

I just tested with the latest version 1.3.12 and it looks fixed, thank you!

3 Likes