A common problem in many 3d games, is restraining the players avatar to the environment. So a player appears to be on the floor and can't walk through walls and other obstructions. A popular method is to use a Navigation Mesh, abbreviated as NavMesh. When using the Three.JS library, you'll need to create a NavMesh then use code to use this mesh to restrict movement. Until Blender 2.79b you could use the Blender Game Engine to create a NavMesh. Since Blender 2.8 this has not been possible. In this tutorial I show you how you can use Unity and a custom exporter script to create the NavMesh. Then you can import this into Blender. Tweak it and export it as a GLB file to load into your Three.JS app. Then using a library it is possible to use the NavMesh to generate paths around the mesh.
Download the repo, then follow the YouTube links below to learn how to create and use a NavMesh to control the motion of an avatar.
- Creating a NavMesh Learn how to use Unity and Blender to create a NavMesh
- Using a NavMesh Learn how to use Don McCurdy's Pathfinding library and Three.JS to constrain an avatar to a NavMesh