
[ad_1]
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Anybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
Asked
Viewed
728 times
I’m prototyping a 2.5D style game. I have my sprites angled at a 33° angle on the x axis.
I’m using the NavMeshAgent for basic navigation and pathfinding. I’ve set the Angular Speed to 0, to prevent the auto rotation to the destination.
But the x rotation is always reset to 0 on play. Is there a setting I’m missing, or do I need to set the rotation in script?
\$\endgroup\$
You probably need to set navmeshAgent.updateRotation = false
in a script. See updateRotation.
\$\endgroup\$
adding this Code worked for me.
private void Start()
{
// Store the initial rotation
initialRotation = transform.rotation;
// Get the NavMeshAgent component
navMeshAgent = GetComponent<NavMeshAgent>();
}
private void Update()
{
if (navMeshAgent.velocity != Vector3.zero)
{
// Apply the initial rotation
transform.rotation = initialRotation;
}
}
ocb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
\$\endgroup\$
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged .
lang-cs
[ad_2]