Angular drive doesn't work with locked motions

I’m trying to create a physics constraint using the Physics Asset Tool. I’ve noticed that the Angular Motor doesn’t seem to work if one or more angular motions are locked.

To reproduce this:

  1. Create a Physics Constraint in PhAT
  2. Configure it as a Hinge Joint
  3. Enable the Angular Orientation Drive with a high enough spring parameter
  4. Simulate, gravity will freely change the orientation as if there’s no motor enabled

Is this the expected behaviour? Setting the locked motions as Limited or Free makes the motor work, but I’d like to keep them locked if possible.

Hi,

This behavior is expected. The reason is that under the hood PhysX will ignore the motor if you have any degrees of freedom locked: docs

Depending on the effect you’re trying to achieve you could use soft spring limits which are found under angular limits. These will work as traditional springs though, meaning that velocity motors will not work.

If you have access to the code you could try playing with the angular motor mode. We are using SLERP, which is the only case where angular motors will be turned off. If you change this to Swing & Twist you would have better luck, though I don’t know the full implications of this.

I may take a look at this at some point and see if we can switch to it so that this case is no longer a problem.

Please let me know if you run into any more issues.

Thanks for the response, Ori. Yes, I’m now using Swing & Twist motors and, fortunately, that led to some great results.

However, it was very difficult to find the correct Build.cs setup to get access to PhysX. I’d also like to ask: is there any legal issues when using PhysX code directly in game’s code?

I’m curious what you mean by finding the correct build.cs - I would have expected the only changes you’d have to make would be inside constraintinstance.cpp

As for releasing PhysX code directly: this is up to NVIDIA. I’m not sure what their plans are for this, but my guess is this will not happen any time soon.

What I mean is that I’m accessing PhysX functions directly in my game’s code, I did not change UE4’s FConstraintInstance. So I had to adjust my Build.cs to include PhysX headers. Does this process of calling PhysX functions from my game module have any legal issues?

calling PhysX functions from your game is fine