- Home /
how can i make my enemy face player as well as be parallel to the ground with smooth rotation?
Hello, im trying to make my enemy ai face the player and be parallel to the ground. This is where im at right now, as for the problem, it is that when the enemy follows me downward on a slope the rotation on the x axis resets from 15 to 0 and vice versa every frame.
Some more information about the code is that the "enemyeye" is a empty game object that im using to throw a raycast downward to detect a layermask "ground". also to find ground angle.
There is one more problem that im facing which is that the "slerp" is not working with the look rotation. Whenever i try to add slerp to the rotation it doesnt go above 0.7 where as it should be going 15.
Dont know if this is helpful but the slope that im trying to work on is a 15 degree slope.
Answer by tormentoarmagedoom · Jan 24 at 02:49 PM
You can just make the enemy mesh a child of the object that contains the navmesh agent. So, Navmesh agent does navmeshagent stuff, but its child, the enemy mesh rotation can be controled independently.
Your answer
Follow this Question
Related Questions
Raycasting from object rotation? 1 Answer
click to move workig script!! but pls help with rotation!! :( 1 Answer
How do I get an object to rotate around a different axis based on the raycasts hit angle? 0 Answers
Rotate Object relative to a other(I dont get it after 5 days google searching! pls) 2 Answers
Help finding out which side of a cube a raycast hits 1 Answer