I have a blueprint class with a physics actor as root. I’d like to constrain it the following manner:
- Free movement on XYZ world axes.
- Free rotation around world up axis.
- Limited rotation around local X.
- Limited rotation around local Y.
I got the first 3 limits working with a constraint component with no linear limits, Angular Swing 1 on free, Angular Swing 2 on limited and Twist on free. However as soon as I limit Twist the setup starts to behave weirdly: When facing world X+ then the freedom of rotation is as expected. However as the actor rotates toward world Y it gets tilted and near X- it begins to spin around, doing everything to avoid facing that axis.
I figured I needed to rotate the constraint somehow to keep the “facing X+” sort of intuitive behavior. I tried adjusting that component’s transformation but it didn’t help. Next I added a SceneComponent to store the desired orientation and constrained the root physical mesh to that. It didn’t work out either, the hierarchy of transformations caused a feedback loop. Then I set a SceneComponent as root with the physical mesh, another scene component and the constraint linking them as children. It didn’t work either, the constraint still wasn’t actor relative. (Plus the root didn’t move with the mesh which is an untidy solution.)
I guess I could apply forces every frame to undo any rolling but that solution feels hacky.