After reading the documentation, I have some trouble when I apply it to a model. I’m trying to implement an effect which is similar to FPS, i.e. using the mouse to control view point and WASD to move the camera in a model. Specifically, it can move within a gltf model through keyboard events. In my codesandbox, it currently can’t display anything. Where do I make mistakes? Is my keyboard event implementation correct? Thanks.
You can find some examples for this here React Three Fiber Documentation
Especially this one, a mini Minecraft: Minecraft - CodeSandbox pointer capture needs fullscreen, clock the external window button to see it working.
I have a new implementation through imitating this example. However, the package @react-three/cannon and the underlying package cannon in this example is a bit difficult to understand for me now. I replace the texture in this example with a gltf model, but it has some problems:
- It still can’t move in the gltf model scene.
- It sometimes loses the originally rendered scene, when switching from other web pages.
Can you tell me where is the problem? Here is my codesandbox