Hello, How would I go about constraining an object’s Z axis rotation? As I want it to stay upwards.
Just check the box in the rigid body constraints.
Yes. But the objects inside another object(its a child).
24 hour bump
Don’t really understand what the issue is exactly?
So, you have 2 objects:
Parent
-Child
You want to constrain the Z-rotation of the object “Child” no matter what the parent does?
Rigidbody might do it, but I would just make a script and directly attach it to the “Child” object:
private var originalZ : float
function Awake()
{
originalZ = transform.eulerAngles.z
}
function Update()
{
transform.eulerAngles.z = originalZ
}
Somewhat messy solution (should NOT be used with a physics/rigidbody simulation). Prolly a better one out there
Yes. And your script dos not work.
One week bump.
You need to be more specific - there are a million ways a script can “not” work - the interesting part is in how it doesn’t work.
My object does not stay constrained on the Z axis. It still rotates when the car flips.