Question by
ElementalVenom · Dec 05, 2015 at 06:04 PM ·
rotationgameobjecttransformtrackingtransform.lookat
transform.lookat not working?
So I have this kinda sentry thing. I set it to look at the player via transform.lookat. Here is the code:
if (target != null) {
Vector3 target2;
if(target.tag=="Player"){
target=target.transform.FindChild("Armature").gameObject;
target2=new Vector3(target.transform.position.x,0,target.transform.position.y);
}else{
target2=new Vector3(target.transform.position.x,0,target.transform.position.y);
}
transform.LookAt (target2);
}
But when i move around the sentry it barley even moves. Ill be right behind it and it will have only moved like 2 degrees rotation from its origional rotation. A.K.A. Its not tracking/following the player correctly at all. Any help?
Comment
Your answer
Follow this Question
Related Questions
Clamp without Quaternion? 0 Answers
Auto level an object 0 Answers
GameObject not looking at me.. 1 Answer
Problem retrieving transform.position after parent rotation 0 Answers
what is the difference between transform.look at and quaternion.look rotation 0 Answers