Open pierroo opened 1 month ago
In the following official demo, the nav mesh isn't flat:
https://mugen87.github.io/yuka/examples/navigation/navmeshPerformance/
You can use the standard FollowPathBehavior
steering behavior for this use case.
Thank you for this great link once again. Is there a way to see the code of this example?
On the other hand, we can see the convex region aren't perfectly aligned to the underlying model:
is there a parameter when creating the navmeshconvexregion to reduce the precision of it so I could have less region for better performance on my end? I have a smaller map than this example, but 10 times more regions, obviously because of the number of triangles underneath but if there is a way to adjust that would be great as well
Is there a way to see the code of this example?
https://github.com/Mugen87/yuka/blob/master/examples/navigation/navmeshPerformance/index.html
is there a parameter when creating the navmeshconvexregion to reduce the precision of it so I could have less region for better performance on my end?
NavMesh
tries to merge convex regions when possible but this behavior is true
by default. If you need a more simplified nav mesh, you have to ensure during the design phase of the underlying geometry.
thanks for all these!
so my (hopefully last) question would be:
can we use wanderBehavior AND followPathBehavior + onPathBehavior together? I feel like they contradict each other.
I would like wanderBehavior because I want the vehicle to wander randomly without following a specific path. Yet if I want the vehicle to respect the boundaries + respect the Y position, I need onPathBehavior and followPathBehavior which both needs a predefined path, which is contradictory to wander behavior, no?
There is also an issue that remains, when I give them a followPathBehavior, they completely disregard the navmesh in between: they can go through / fly above / go under the geometry etc; they just take the shortest LINE from point A to point B regardless of what's in between.
I tried to play with the value of followPathBehavior.nextWaypointDistance like in your example shared above; I tried to add a onPathBehavior with a super low value for radius or a super high (onPathBehavior.radius), but to no avail: my vehicle will just cut through everything to reach their target and not respect the Y position of the regions. Am I missing something?
EDIT: On the other hand, this example you shared seems to create a spatialIndex, yet it isn't used anywhere? (in the follow path function etc) or is creating it enough for it to be used natively by every "findPath" function etc when the navMesh.spatialIndex is defined?
I am trying to make a vehicle wandering all over the navmesh randomly.
However the navmesh isn't just a flat plane, but has lot of ups and downs etc.
Every docs and examples and codepen I find online using Yuka are having super simple and flat navmesh; so navigating along a slope or mountain is never a question.
So I was thinking to apply Yuka on a Rigidbody from rapier to at least have the gravity and make sure the vehicle is constantly touching ground, but it's a nightmare to manage force applied etc.
Is there a way to make sure a vehicle follows the NavmeshConvex including its y position?
EDIT: unless I raycast from every vehicle inside their useframe toward under them and adjust their y position accordingly, but this sound like a very heavy query on each frame no?