Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get a random point on navmesh #63

Open
orion3dgames opened this issue Dec 7, 2022 · 1 comment
Open

how to get a random point on navmesh #63

orion3dgames opened this issue Dec 7, 2022 · 1 comment

Comments

@orion3dgames
Copy link

Hi there,

Thanks so much for a great library,

I'm trying to get a random point on the navmesh, is this someting possible? And what would be the best way about it?

I know this is a not issue as such, but I have no idea where to ask this question, and it could be a feature? :)

@jorbascrumps
Copy link

If you're using Phaser, you could use Phaser.Geom.Rectangle#getRandomPoint to get a random position and then use NavMesh#isPointInMesh to see if it's inside the navigable area. Otherwise you could reverse engineer the Phaser implementation as it's rather straight forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants