Hello. Tell me how to implement this type of movement. The character can only walk forward when the forward button is pressed. Use the arrows to rotate the model. Below is my code, but it does not work correctly. If I rotate the model, then when I press the forward button, it flies very quickly in the other direction.
Mover.prototype.rotate = function(direction){
this.entity.rotateLocal(0,1,0)
}
Mover.prototype.walk = function(dt){
const forward = this.entity.forward
forward.z *= -0.001
const pos = this.entity.getPosition().add(forward)
this.entity.rigidbody.teleport(pos)
}