Hello!

I’m having a very severe headache over this problem. I’m setting an objects rotation using
transform.eulerAngles = new Vector3(transform.eulerAngles.x,transform.eulerAngles.y + 360,transform.eulerAngles.z);

But when I try to make the object that this code is attached to a Child of an object that is rotating in a circle then the Object that this code is attached to loses its rotation. This problem seems to only be occurring when the parent’s rotation is something other than 0. Is there a fix to this problem? It’s causing a major headache because I can’t find the solution to this.

GameObject + Correct Rotation = Correct Rotation
GameObject + non-rotating Parent + Correct Rotation = Correct Rotation
GameObject + Rotating Parent + Correct Rotation = Incorrect Rotation

The GameObject is whose rotation I’m setting after I parent it. Thank you for the help!

One solution in situations like this is to not parent. Instead have the ‘child’ follow what would be the parent.

var targetToFollow : Transform;

function LateUpdate() {
   transform.position = targetToFollow.position;
}

Now the pseudo-child follows the parent but does not rotate with the parent. If you need an offset, you can either specify it in code, or you can have the pseudo-child calculate it from the relative positions of the two object in Start().