- Home /
Question by
JimNotaro · Apr 25, 2016 at 04:32 AM ·
rotationparentworldspaceparent-childlocalspace
Transform.rotation is setting local rotatoin
I am trying to preserve an objects world rotation through parenting it. I am using this code to do that
function OnTriggerStay(other:Collider){
var tmp : Vector3 = this.transform.rotation.eulerAngles;
this.transform.SetParent(other.gameObject.transform.parent.parent);
this.transform.rotation.eulerAngles = tmp;
}
But this is just setting the local rotation to what the objects world rotation was before the parenting. Which is confusing me because I though transform.rotation set the world rotation.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612075532im_/https://answers.unity.com/themes/thub/images/avi.jpg)