Yo @Cedric … That get Next path function you exposed… Thats safe to call each frame right?
Also… Do you no of a way to detect if we are on the off mesh link… some kind of isOffMeshLink when traversing an Off Mesh Link… OR does recast already have that property and its not exposed ???
YO @Cedric … Sorry to bother again tonight. But just need to know if you know of a way or is it possible to expose or add a IsAgentTraversingOffMeshLink type flag so we know when we are on an off mesh link… that way i can detect when we hit an off mesh like then rotate towards the end off mesh link position… What do you think ???
I can do it this coming week. until then, you can try to use getclosest location with the character position. if it’s too far from it, then you are off linking.
Crap … Yo @Cedric … Ran. into another issue while traversing off mesh links…
The get next waypoint does not update while traversing the off mesh link… It does not switch to the next waypoint till you complete the off mesh link… so you still stay facing the off mesh link START position and not the END position like what is desired.
So in addition to detecting if we are traversing an off mesh link, we need to get NEXT NEXT (or the one after the next) waypoint to rotate towards…
The getAgentState function lets us check for DT_CROWDAGENT_STATE_OFFMESH to detect if we are traversing an off mesh link… Works great.
The overOffmeshConnection function will return true when we first pass over an off mesh link. Also works greats and only return true when you first hit the start off mesh link and not when we hit the end off mesh link. So its more of a off mesh link trigger. And also works great.
There is still an issue with getAgentNextTargetPath returning the start off mesh link position until it completely traverses off mesh link… So the player will rotate and look behind at the start off mesh link then correct when it finishes the off mesh traversing.
But the rest is look really good… Can you please add the getAgentState and overOffmeshConnection function to the agent as described above … Please
I was able to everything I need to with just the getAgentState… basically rotation depends on velocity… so now when the state is offmesh , I simply calculate a new off mesh velocity by tracking last position. That seems to work pretty good