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?