Reputation: 1
I've started my journey of making an interactive gallery using react-three. I already have the First-Person mechanics figured out and I made a small room to walk and interact. I want to escalate the environment but since I can't make 3D assets, I bought this https://sketchfab.com/3d-models/vr-art-gallery-el5-e3bda3a7086c49f0a84948fd6808bcf4 .
So..what's the logic to add colliders to the walls so I can't cross and floor so I can walk, using react-three/cannon?
Upvotes: 0
Views: 1158
Reputation: 3565
Your idea can be achieved by using a nav mesh. There's a popular library for this called three-pathfinding.
The idea with three-pathfinding is that you create a navmesh matching the floor of your scene in a 3D editing tool like blender (which supports gltf by the way) and then loading that into your scene and passing it to three-pathfinding.
You then find out where on the navmesh you've clicked and pass that information to the lib and it will do the rest. The demo code has this method that you can use to find where in the scene you are clicking.
Upvotes: 0