- Home /
NavMeshAgent rotating with terrain
I am currently using navmeshagent.setdestination to move my tank around my terrain. This works well except when moving up a hill, the tank basically slides up it horizontally rather than rotating to the slope of the hill. A few things I've tried:
1) Physics.Raycast(gameObject.transform.position, Vector3.down, out alignHit); transform.up -= (transform.up - alignHit.normal);
This rotates to the slope, but the model no longer rotates toward the destination.
2) I've tried setting navmeshagent.updateUpAxis to true. This doesn't seem to effect anything.
It seems like maybe the issue is trying to rotate my object after setDestination has been called. Is there any way around this, or do I just need to write up another means of changing the position/rotation en route to the destination. Thanks!
Your answer
Follow this Question
Related Questions
GameObject with NavMeshAgent resets rotation when game starts 2 Answers
Terrain tree painter lays trees horizontally on the ground 1 Answer
Correct Normal alignment while keeping heading rotation from NavMeshAgent? 0 Answers
Why do grouped Terrain objects move together but don't rotate as one? 1 Answer