How to get random point in NavRegion3D?

Godot Version

4.2.2.

Question

Hi, I want to have a character that randomly teleports around the map, how could I get a random point around a NavRegion3D? I know how to have them TP there.

The navigationregion3d doesn’t have a position or size, so you can’t pick a point inside it. The navigationregion3d will have a navigationmesh3d, which also has no size. But the navigationmesh3d is probably based on some source geometry? So you would have to get the size of the source geometry and then pick a random point inside it’s dimensions. This will be complicated if there are multiple parts of your source geometry.

If your level is just a rectangle, then you can use it’s size to pick a position inside it. Please share more about your setup if you need specific help.

Dw dude, I figured it out, calling .get_verticies() on the NavMesh gets me a bunch of positions i can get the dudes to teleport to.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.