- Home /
Rotating a Projector Shadow blob Z to align with the Y axis of the object its following
I have a projector rotated 90 degrees in X(PITCH) so its Z(ROLL) axis is facing the ground.
It follows an object as it moves around with a Y offset.
shadow.transform.position = new Vector3(transform.position.x,
transform.position.y + yOffset,
transform.position.z);
I want the projector to rotate around the Z(ROLL) axis to match the objects Y(YAW) axis.
This is to make the shadow shape align correctly as it is not just a blob but a defined shape.
I tried this:
shadow.transform.rotation = new Quaternion (shadow.transform.rotation.x,
shadow.transform.rotation.y,
transform.rotation.y,
shadow.transform.rotation.w);
Thinking I could just copy the Y into the projectors Z.
This doesn't work, does anyone know of the proper method to perform this sort of thing?
Here's a screenshot: http://img443.imageshack.us/img443/4317/lunarshadow.jpg
Answer by sh0v0r · Dec 04, 2010 at 11:18 AM
Turned out to be very simple
shadow.transform.localEulerAngles = new Vector3(shadow.transform.localEulerAngles.x, transform.localEulerAngles.y, shadow.transform.localEulerAngles.z);
Your answer
Follow this Question
Related Questions
Flip over an object (smooth transition) 3 Answers
If a ball that you roll has a projector for shadows, how do you stop the rotation of the projector? 1 Answer
How to make a blob shadow project from a fixed angle as the object rotates? 2 Answers
[Solved] Projectors rotation projection 1 Answer
Quaternion - Rotate / Unrotate Error 0 Answers