Move the camera forward in the direction its facing


i build a buttons in js that move the camera in rotation left and right and forward , but when i rotate the
the camera, and try to move forward, the forward motion not goes in the direction that the camera is facing, how can i fix this.


Would be cool to see what and how you do in the code.

Take a look at these methods: .translateX, .translateY, .translateZ.

You can also use Camera.getWorldDirection() and then translate the camera along the resulting direction vector.


thanks ,
can you show my example to how to work with Camera.getWorldDirection()] ?

camera.position.add( camera.getWorldDirection() );


1 Like

But maybe don’t create a object every time., reuse a Vector3 instead like this:

const direction = new THREE.Vector3;

let speed = 1.0;

function eventOrLoopOrSomething() {


    camera.position.addScaledVector(direction, speed);


But maybe don’t create a object every time.

Good point :v: updated JSFiddle.
Forgot that getWorldDirection creates a new vector internally when target is not provided.

function eventOrLoopOrSomething()

LMAO :rofl:



i can move forward when i rotate the camera, but still cannot find solution to the issue when i rotate the camera
and try to move right or left or backward the direction is all off, its like the axe is not updating the camera rotation position,
any help will be appreciated

Not sure if it helps but I always create a Object3D instance where I want the camera and then parent this to something that is moving in the scene, then lerp the camera to the dummy and use lookAt to orientate the camera to a target. Not the same thing as what you are doing but maybe one possible work around

1 Like

thanks for the help found the solution
using camera.translateZ( distance );
fix it , now is going the right direction