- Home /
 
               Question by 
               piecewise13 · Jun 20, 2017 at 05:37 PM · 
                2d3dlookat  
              
 
              Making a 2d object lookat a 3d object on the y-axis(c#)
I have an enemy ai with a 2d health bar above his head and I want the health bar to look at the main player but only rotate on the Y-axis. Right now I have:
         Vector3 targetPos = target.position;
         Vector3 lookRot = new Vector3(0, targetPos.y, 0);
         obj.LookAt(lookRot);
but this changings the position of the health bar and makes it spawn in a different location. Anyone know why?
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by JxWolfe · Jun 20, 2017 at 05:46 PM
Just have it look at target Pos, then set the rotation after, it is trying to look up and at 0,somewhere,0
Your answer
 
 
             Follow this Question
Related Questions
2D Sprite Rotation 0 Answers
Using a sprite sheet in a 3d enviroment? 0 Answers
2D Shadows? 3 Answers
2.5D or 3D. A Matter of Performance? 0 Answers
3d or 2d? please help unity creators 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                