I was to know how works agent rotation betweek animation while walking in ceiling.
I dont know why but the first my agent walks nice in ceiling but i get right now all the time turning on the other side of ceiling
I was set off auto traverse link in agent.
And in late update testing :
IEnumerator MoveAcrossNavMeshLink()
{
OffMeshLinkData data = agent.currentOffMeshLinkData;
agent.updateRotation = false;
Vector3 startPos = agent.transform.position;
Vector3 endPos = data.endPos + Vector3.up * agent.baseOffset;
float duration = (endPos - startPos).magnitude / agent.velocity.magnitude;
float t = 0.0f;
float tStep = 1.0f / duration;
while (t < 1.0f)
{
transform.position = Vector3.Lerp(startPos, endPos, t);
agent.destination = transform.position;
t += tStep * Time.deltaTime;
yield return null;
}
transform.position = endPos;
agent.updateRotation = true;
agent.CompleteOffMeshLink();
MoveAcrossNavMeshesStarted = false;
}
In late update
if (agent.isOnOffMeshLink && !MoveAcrossNavMeshesStarted)
{
StartCoroutine(MoveAcrossNavMeshLink());
MoveAcrossNavMeshesStarted = true;
}
Also i have found AgentLinkmover in github but i got same issue.
And, to get agent facing in nice direction we can use this in late update
if (agent.velocity.sqrMagnitude > Mathf.Epsilon)
{
transform.rotation = Quaternion.LookRotation(agent.velocity.normalized);
}
That works nice but not while climbing in other surface.
I have made a little video for explain this better, i apologies about my english.
mlery7
Suggestion to improve that?
Because i cannot find in documentation, with links how to get when im moving to ceiling or floor to do a custom animation.