Detect offmesh link in a path? (166486)

Hi,

My question is pretty simple: is there any way to detect if a path is using an offmesh link?
I would basically need to detect if a part of the path, between 2 corners, is an offmesh link or not…

Any idea?

Thanks!

Yeah, sorry. I haven't used 2D before, it seems Y and Z are swapped there. So transform.up should indeed be correct. In which direction is the character moving? Totally random or e.g. perpendicular to the correct direction?

1 Answer

1

You can use NavMeshAgent.nextOffMeshLinkData to check if there is an offmesh link in the path.

Oh indeed I didn't notice this one... many tanks!

However, it works only for 1 offmesh link.. how to check if there are several in the path?

No problem, thank you for your effort anyway! My player is moving almost in the correct direction. If my Rotation is 0 my player is moving up (Thats correct) if my rotation is -90 its moving down but it should move to the right. If the rotation is 180/-180 its moving up again.. I'm very confused because i dont understand why. I've tried dividing my .forward like if(InputY != 0) { transform.Translate((transform.up / 2) * InputY); } but it doesnt help me