# Can I move within a gltf model through keyboard events

**URL:** <https://discourse.threejs.org/t/can-i-move-within-a-gltf-model-through-keyboard-events/25875>\
**Category:** Questions\
**Created:** [May 2, 2021, 1:41am UTC](https://discourse.threejs.org/t/can-i-move-within-a-gltf-model-through-keyboard-events/25875 "2021-05-02T01:41:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mingxuan\_han](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mingxuan_han/32/13163_2.png) [@mingxuan\_han](https://discourse.threejs.org/u/mingxuan_han)\
**Post date:** [May 2, 2021, 1:41am UTC](https://discourse.threejs.org/t/can-i-move-within-a-gltf-model-through-keyboard-events/25875/1 "2021-05-02T01:41:16Z")

</div>

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](https://codesandbox.io/s/agitated-water-toui5?file=/src/ModelCanvas.js), it currently can’t display anything. Where do I make mistakes? Is my keyboard event implementation correct? Thanks.

---

<div class="post-metadata">

**Author:** ![drcmda](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@drcmda](https://discourse.threejs.org/u/drcmda)\
**Post date:** [May 2, 2021, 6:56am UTC](https://discourse.threejs.org/t/can-i-move-within-a-gltf-model-through-keyboard-events/25875/2 "2021-05-02T06:56:06Z")

</div>

You can find some examples for this here [React Three Fiber Documentation](https://docs.pmnd.rs/react-three-fiber/examples/showcase)

Especially this one, a mini Minecraft: [Minecraft - CodeSandbox](https://codesandbox.io/s/minecraft-vkgi6) pointer capture needs fullscreen, clock the external window button to see it working.

---

<div class="post-metadata">

**Author:** ![mingxuan\_han](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mingxuan_han/32/13163_2.png) [@mingxuan\_han](https://discourse.threejs.org/u/mingxuan_han)\
**Post date:** [May 2, 2021, 9:41am UTC](https://discourse.threejs.org/t/can-i-move-within-a-gltf-model-through-keyboard-events/25875/3 "2021-05-02T09:41:22Z")

</div>

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:

1. It still can’t move in the gltf model scene.
2. 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](https://codesandbox.io/s/heuristic-ritchie-hxpys?file=/src/App.js)
