x


Make an Object Look At Target Y Axis

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);
             
more ▼

asked Mar 18, 2013 at 02:47 AM

marcelobr gravatar image

marcelobr
3 21 931 53

have you tried using the Transform.LookAt function. here is a link to itlookat_function

Mar 18, 2013 at 03:05 AM bodec

go to your scripting refence manual and search for lootat

Mar 18, 2013 at 03:11 AM bodec
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

link doesn't work....

more ▼

answered Mar 18, 2013 at 03:06 AM

marcelobr gravatar image

marcelobr
3 21 931 53

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x13

asked: Mar 18, 2013 at 02:47 AM

Seen: 443 times

Last Updated: Mar 18, 2013 at 03:11 AM