- Home /
Ideas for keeping a rigidbody's rotation aligned with parent axes?
Hey, I've been trying to get a rigidbody cube to rotate around a parent object's pivot point while keeping the movement constrained. Image below:
The idea is to lock the rotation of the cube when not aligned with an axis. In the situation on the left, the cube is aligned with all three axes, meaning it can rotate along any of them. On the right, it is only aligned with the Angular Z axis, unlocking only that one.
What I'm having trouble with is switching directions at the intersection points.
My first thought was to simply lock the unaligned axes in the ConfigurableJoint settings. However, because I'm using a slight buffer when judging whether or not to lock the axis (avoiding the need for perfect alignment), it often seems to find itself in an unsolvable situation and resets the rotation. You can see this behavior here: IMGUR. Or maybe it's the physics forces knocking the cube out of place?
So yeah, I'd love to get some suggestions on how to approach this, been stuck for a while. Perhaps with corrective torque instead of locking the actual rotation? Not sure. Thanks in advance!
Your answer
![](https://koobas.hobune.stream/wayback/20220613041211im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Skateboarder behaving incorrectly on half-pipe 1 Answer
Follow a curve using physics or transform manipulation 2 Answers
Turning a rigidbody that's in motion 2 Answers
How to get rotation relative to the ground normal? 0 Answers
How do I determine which Euler Axis of an object will change when the object is rotated? 1 Answer