- Home /
Question by
vinod.kapoor · Jul 03, 2012 at 11:07 AM ·
gameobjectdirectionrotating
rotate transform toward a desired direction
hello friends. I wish to rotate my gameobject from the current direction by an angle. i calculated the angle, but struck with rotating the object. please help
var moveDirection : Vector3 = target - transform.position; var fwd = transform.forward; var vect : Vector3 = moveDirection.normalized; var rotationangle = Vector3.Angle(fwd,vect);
the rotation required should be smooth.
Comment
Answer by AA8A5 · Dec 13, 2013 at 01:05 PM
Also you should use http://docs.unity3d.com/Documentation/ScriptReference/Vector3.Slerp.html for interpolation
Your answer
Follow this Question
Related Questions
Rotating Object not colliding? 1 Answer
Rotation is jumpy 2 Answers
Fixing instantiated object in one direction? 0 Answers
How to change object direction when Camera Rotates 0 Answers