Quantcast
Channel: Questions in topic: "issue"
Viewing all articles
Browse latest Browse all 827

Local position issue

$
0
0
Hi guys, I have a problem with two simple code lines. I don't know if i'm doing something wrong. Here's the code. float localX = Mathf.Cos(angle * Mathf.Deg2Rad) * transform.GetChild(0).localPosition.x; transform.GetChild(0).localPosition = new Vector3(localX, 0, 0); Angle is the rotation value in radiants of the parent object. I want the child to be closer to the parent when the angle increases but when I click play the position of the child is always 0 (in terms of local position). I did a debug to check the values of the Cos function and they are correct so I don't know why i get this error. Can someone help me?

Viewing all articles
Browse latest Browse all 827

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>