- Home /
 
               Question by 
               louiaugst · Apr 20 at 09:37 PM · 
                rotationgameobject3dvector3localrotation  
              
 
              Point game object to another only on the Local X Axis
I would like to have a Gameobject point to another only on the Local X-axis.
     void FixedUpdate()
         {
             if(started){
                 Vector3 targetPosition = target.position;
                 Vector3 direction = Vector3.ProjectOnPlane(targetPosition - transform.position, transform.right);
                 Quaternion lookRot = Quaternion.LookRotation(direction, transform.right);
                 transform.rotation = Quaternion.RotateTowards(transform.rotation, lookRot, Time.fixedDeltaTime * 45);
             }
On the y-axis it worked with transform.up instead of transform.right, but on the x-axis the Gameobject only rotates permanently around the z-axis.
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Character Rotation Now Matching GameObject's Local Rotation 0 Answers
Recording hand gestures and playing it back on same hand model 1 Answer
Distance between a gameObject and a direction vector. 1 Answer
GameObject facing hit.point doesn't always work 1 Answer
GameObject wont stop rotating ? 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                