- Home /
Look at and animal ai
i am basically trying to make an animal ai, the system will just look at the first point the animal will go to,(looking at it) and then just walking forward, when it will get to the point it will switch to another point..
the animal model i tryed to make is in blender (just for checking) and the script is currently no more than :
transform.LookAt(Player2); transform.position += transform.forward*1*Time.deltaTime;
in the update function.
there is no errors but for example if at start (in the scene) the animal model rotation is x:270 y:90 z:0 > which looks like the animal is just standing but when the code is attached, the model rotation changes so its look like its laying on the ground, which is probably because of the lookAt but i want it to make the model look like its still standing but also keep the rotation look fine, so it will lookAt the object point and not just giving the animal some weird rotation.
when i created a unity3d cube and attached the script everything went fine, no weird rotations, so its probably something i did in blender.
thanks for help..
Blender's axes are different than Unity's (in Blender Z is up, in Unity Y is up). Could this account for your issue?
well, in blender the model rotation is 0,0,0 so i dont know what to do now.
You can fix this dirty by parenting the model to an empty GameObject to fix the rotation.
now its changed a bit, its doesn't look like the animal is laying on the ground, its look like its standing but its still doesn't looking at the object.
If using @Bored$$anonymous$$ormon 's method to correct model rotation, the look-at script must affect the new dummy parent.
Your answer
Follow this Question
Related Questions
How do i get this guy to hold his position? 3 Answers
Simulating Mouse Input for AI 0 Answers
Rotating enemy object to face the player when moving 2 Answers
Object Look At Mouse 2 Answers
2D LookAt not working as intended 1 Answer