Hey all, I am currently trying to get my enemy to constantly look at the player like they did in the TornadoTwins tutorial and my script is;
#pragma strict
var player : Transform;
function Update ()
{
transform.LookAt(player);
}
I know this is right because I did it before and it worked fine, however now its like whatever object I attach this script to freaks out and the object rocks backwards and forwards and its moving so fast that its transparent. I have tested it with multiple models from and outside of unity. Please help and sorry I can’t explain it better. All I want is a simple lookAt script.
On What Object you are using this script? is it a child or something?
– anon67277319thanks for your reply, Nope, its just a cube with a cylinder as a child, the script is attached to the parent.
– slayer29179Thanks! that worked, and it's so weird? I repeated the same process in my scene and it worked perfect :S oh well thank you!
– slayer29179A gameObject named "player" isn't important. In the Inspector, make sure you have the correct thing dragged into the
– Owen-Reynoldsplayerscript slot. Maybe by mistake you're trying to look at yourself.I guess you didn't created the object for the player or the both game gameObjectsd were not at the correct positions and your welcome c:
– anon67277319