- Home /
 
               Question by 
               XSpitFire · Mar 06, 2021 at 04:32 PM · 
                rotationraycastquaternionnormals  
              
 
              Rotating with a preferred driection.
I do a RayCast to the terrain and then use the RaycastHit.normal to plant flags.
I would like to have the flags to point up with the normal, but have them all face the same direction. As seen in the image flag 1 points to left of the screen and flag 5 to the right. I understand why, but do not know how to rotate it.
I saw LookRotation has an override that takes a forward direction too. I thought it would work with say Vector3.Forward, but if a flag is placed on a wall it points into the wall.
The direction or angle they face can be set by the player
Any tips ?
 CurrentObject.transform.position = hit.point;
 CurrentObject.transform.rotation = Quaternion.LookRotation(hit.normal);
 

 
                 
                flags.jpg 
                (385.7 kB) 
               
 
              
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                