I'm trying to make my player look at ball but he never looks exactly the direction of the ball he always gets a little crooked what should I do to him exactly look toward the ball?
Quaternion rotation = Quaternion.LookRotation(Messi.transform.position - malhaBolaTransform.transform.position, Vector3.down);
rotation.x = 0;
rotation.z = 0;
Messi.transform.rotation = Quaternion.Slerp(Messi.transform.rotation, rotation, Time.deltaTime * smooth);
have you tried using the Transform.LookAt function. here is a link to itlookat_function
go to your scripting refence manual and search for lootat
Answer by marcelobr
Mar 18, 2013 at 03:06 AM
link doesn't work....
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
11 People are following this question.
how to get my look at script to only work on the Y axis?
What is the best way to let a character follow a moving object with his head
Indicator rotating around player
Follower Airplane problem
Make player look at pointed target