- Home /
Simple Arrow pointing to my enemy.
Hello everyone, i have a 3d arrow in my game and i want it to be pointing to my enemy all the time. Initially i was using a simple lookat(enemy) in a script applied to my arrow, but instead of rotating it, it is actually deforming the mesh which is horrible... How can I fix the script ahead to make it to what i want? Thanks everyone...
var enemy: Transform;
function Update () {
var difference : Vector3 = enemy.transform - transform ;
transform.rotation = Quaternion .LookRotation (difference.normalized );
// This line ahed was my old version which distorts my arrow :(
//transform.LookAt(enemy);
}
Answer by robertbu · Feb 16, 2013 at 01:15 AM
LookAt() is not going to deform your mesh. If you mesh is getting deformed, it is happening somewhere else. More likely I suspect the issue has to do with the perspective of the camera. Try moving you camera further away from your subjects and changing to a smaller field of view.
It has notting to do with the camera, i see it getting distorted even in the viewport... :\
And the only script accessing the arrow is that one... :\
Let it be, problem solved, it had something to do with the parenting.... Apparently, it can't be in the same parenting level as the camera, weird. :\
It may have to do with the distance between the camera and the arrow.
Your answer
![](https://koobas.hobune.stream/wayback/20220613092759im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Enemy and hero. Distance 1 Answer
Creating an enemy that can go towards lights 0 Answers
How to fire an arrow. C# 2 Answers
Find intersecting points between vectors 1 Answer
Unity ML-Agents Game,Unity ML-Agents Space Shooter Game 0 Answers