# 3D character model movement

**URL:** <https://discourse.threejs.org/t/3d-character-model-movement/46673>\
**Category:** Questions\
**Tags:** character-animation, animation-mixer, models\
**Created:** [January 9, 2023, 1:20pm UTC](https://discourse.threejs.org/t/3d-character-model-movement/46673 "2023-01-09T13:20:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kreysix](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/kreysix/32/28203_2.png) [@kreysix](https://discourse.threejs.org/u/kreysix)\
**Post date:** [January 9, 2023, 1:20pm UTC](https://discourse.threejs.org/t/3d-character-model-movement/46673/1 "2023-01-09T13:20:32Z")

</div>

I have a character model whose movement is controlled through WASD. I have also added a walking animation FBX. But when I press any movement key the model just sticks to the ground whilst animating and moving in that particular direction. The orientation is getting glitchy.

It seems to have been caused by this `Quaternion` modifying block of code, which I’ve used to turn the character in the direction of the pressed key (wasd).

```javascript
 let angleYCameraDirection = Math.atan2(
                    this.camera.position.x - this.model.position.x,
                    this.camera.position.z - this.model.position.z
                );
                // diagonal movement angle offset
                let directionOffset = this.directionOffset(keysPressed);
                this.rotationQuaternion.setFromAxisAngle(
                    this.rotateAngle,
                    angleYCameraDirection + directionOffset
                );
                this.model.quaternion.slerp(this.rotationQuaternion, 0.1);
                this.model.updateMatrixWorld();

```

How can I fix this?

---

<div class="post-metadata">

**Author:** ![PavelBoytchev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/pavelboytchev/32/38639_2.png) [@PavelBoytchev](https://discourse.threejs.org/u/PavelBoytchev)\
**Post date:** [January 9, 2023, 2:17pm UTC](https://discourse.threejs.org/t/3d-character-model-movement/46673/2 "2023-01-09T14:17:07Z")

</div>

@kreysix –

Quaternions are used to rotate, not to move through space. So, if you only change `quaternion` your model will turn towards some direction, but will not move forward. Do you also change your model `position` value?

– Pavel

---

<div class="post-metadata">

**Author:** ![kreysix](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/kreysix/32/28203_2.png) [@kreysix](https://discourse.threejs.org/u/kreysix)\
**Post date:** [January 9, 2023, 2:29pm UTC](https://discourse.threejs.org/t/3d-character-model-movement/46673/3 "2023-01-09T14:29:00Z")

</div>

Yes @PavelBoytchev . Just basic translateZ() to move the model forward/backward

Also my animations are coming from a mixamo fbx model, and the model is from ReadyPlayerMe.

---

<div class="post-metadata">

**Author:** ![PavelBoytchev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/pavelboytchev/32/38639_2.png) [@PavelBoytchev](https://discourse.threejs.org/u/PavelBoytchev)\
**Post date:** [January 9, 2023, 5:57pm UTC](https://discourse.threejs.org/t/3d-character-model-movement/46673/4 "2023-01-09T17:57:15Z")

</div>

@kreysix –

Most likely I have misunderstood you. I though your problem is that the model is not moving forward.

– Pavel
