How to dynamically rotate Physical Constraint?

I would like to dynamically change orientation of my Physical Constraint.

Lets give an example:

Upper cube is “body”, constraint origin is same as wheel, and two constrained bodies are “wheel” and “body”.

Constraint have free Z motion (for suspension travel), and Swing 2 that let wheel to rotate (roll).
Both have physics enabled, and everything works fine here.

But I would like to turn this wheel left-right (just like wheel in cars can be turned by steering wheel) dynamically.
I tried few approaches, but so far nothing works:

  • enable “swing 1” motion and turn wheel by physical forces (or angular motor), but when wheel both turning and rotating wheel starts to wobble (rotation axis of combined roll and turn is no longer wheel axle) - for separate turning or rotating it works.

  • set world rotation for constraint (and/or wheel) - nothing happens because it is still constrained in same orientation

  • I found that I can turn a wheel by setting Angular Rotation Offset roll, but it works only at start - changing this parameter dynamically (it is available from C++) do nothing, and I found no way to update is dynamically

  • I did few experiments with Set Constrained Reference Orientation - it was promising, but eventually I didn’t find this useful. I tried to rotate front and right vectors as car wheel should turn, but wheel behaved in different way I expected.

Any other ideas? Suggestions? Questions?

Physics physics-constraints Constraints constraint

I found how to deal with that, unfortunately by constraints chain, but looks like it works.
So I designed it just how real cars work.

Three physical bodies - body, knuckle and wheel.

Body is constrained (named “strut”) to knuckle with free Z-axis movement (for suspension), and swing 1 for turning wheels. Turning is done by angular motor with lot of strength.

Then knuckle is constrained to wheel by “bearing” that locks all position, ale have free swing to let wheel to rotate (roll).

I hope two constraints would be stable enough.

As side effect I have “knuckle” that may graphically represent all not-rotating parts of suspension and brakes calipers.

Also I have splitted rotating mass of wheel and non-rotating mass connected to wheel.

I am only afraid of stability of chained constrains, but so far so good.