transform.LookAt(target.position);
I’m trying to use this code to have a AI lookAt the enemies but it looks way to high.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A little more information would be nice. How are the objects placed in the hierarchy? Is
targeta parent or a child object?What
transform.LookAtdoes is pointing thetransform.forwardat the target’s position.Can you try
transform.LookAt(Vector3(target.transform.position.x, transform.position.y, target.transform.position.z);?If that doesn’t work, can you try adding
transform.Translate(Vector3.forward * Time.deltaTime);?With the last code you can see the object moving towards the target. That way you are sure it’s pointing the right direction. Maybe you think it’s looking too high because your model is wrong.