Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
472 views
in Technique[技术] by (71.8m points)

unity3d - 2d text focuses on camera but get rotate 180 when camera rotates around the object

I have created multiple gameobjects in the scene with parent child relationship. When I move the camera with a joystick it moves around the node in an orbit. but when the camera moves vertically the 2D text on Node gameobject which focuses the camera by LookAround(), it rotates 180 degrees. Which is in the opposite direction.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use Transform.LookAt. Get a reference to the camera's transform, for example with Transform mainCam = Camera.main.transform then in the update function of your 2D text or any object you want to look at the camera use transform.LookAt(mainCam);


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...