Adjusting FollowerEntity Rotation(X,Z) While Traversing OffMeshLink Without Aborting Coroutine

I want to set updateRotation = false while passing through an OffMeshLink, such as a ladder, in order to adjust the x and z axis rotation of the FollowerEntity according to the incline of the ladder. However, when I call updateRotation = false inside the OffMeshLink coroutine, the coroutine immediately aborts.

Could you please help me resolve this issue and allow the rotation adjustment to happen without the coroutine aborting?

Could possibly be a bug? I’ll notify Aron on this one, and will see what happens on my end as well. Just for curiosity’s sake, what about if you set updateRotation to false right before starting the coroutine? (if that’s an option)

That works, but it’s a bit inconvenient. It would be ideal if updateRotation = false could be set directly within the coroutine itself.

Gotcha. Do you mind posting a snippet of your code so I can follow along here a bit more closely? Just the relevant parts :+1:

Hi

This is a limitation right now. I’m considering changing those components to IEnableableComponent, so that they can be toggled like this.

As a workaround, you could do the rotation itself in the Update method:

IEnumerable IOffMeshLinkStateMachine.OnTraverseOffMeshLink (AgentOffMeshLinkTraversalContext ctx) {
    rotateAgent = true;
    // ...
}

void Update () {
    if (rotateAgent) {
         // ...
         ai.updateRotation = false;
         ai.rotation = ...;
    }
}
1 Like