I’ve gotten NavMeshes onto my walls and have creepy crawler spiders on them. I have 5 nav meshes (4 walls, floor, no ceiling) each baked manually with separate NavMeshSurfaces, each rotated.

The issue is corners. I have used the nav link component to link the different meshes. The spiders traverse but there’s one issue. Their rotation instantly snaps to the “new normal”. I want interpolation while they go over the link to smooth this rotation and make it look natural.

I’ve adapted this coroutine from OffMeshLinkMoveMethod to try and add Slerp. The problem variable is EndRot, I think. I cannot figure it out for the life of me.

If we have the local rotation and current position, and we have the endPos, and we can assume there is something solid beneath the spider at both points, and we know the corner is a right angle, surely we can calculate the final rotation in order to Slerp into it. Right?

Somebody please help me out.

```
IEnumerator Curve(NavMeshAgent agent, float duration)
{
OffMeshLinkData data = agent.currentOffMeshLinkData;
Vector3 startPos = agent.transform.position;
Vector3 endPos = data.endPos + Vector3.up * agent.baseOffset;
Vector3 direction = (endPos - startPos).normalized;
Quaternion startRot = agent.transform.rotation;
//This here is not quite right
Quaternion endRot = Quaternion.LookRotation(direction);
float normalizedTime = 0.0f;
while (normalizedTime < 1.0f)
{
agent.updateRotation = false;
float yOffset = m_Curve.Evaluate(normalizedTime);
agent.transform.position = Vector3.Lerp(startPos, endPos, normalizedTime) + yOffset * Vector3.up;
agent.transform.rotation = Quaternion.Slerp(startRot, endRot, normalizedTime);
normalizedTime += Time.deltaTime / duration;
yield return null;
}
agent.updateRotation = true;
}
```