[SOLVED] Unable to translate camera with orbitCamera script from tutorials

I’m trying to move my orbitCamera up on the y axis in the update loop like so:

camera.translate(0, 0.01, 0);

But it’s not moving at all. However when I remove the orbitCamera script it works fine. I even tried

camera.setPosition(camera.getLocalPosition().x,camera.getLocalPosition().y + 0.01,camera.getLocalPosition().z);

The movement is within distanceMax and distanceMin.

Hi @Gamer_Wael,

The orbit-camera.js script forces a new position for the camera per frame, based on the active pivot point. So changing the camera entity position on any other script won’t have any effect, since its position will be reset eventually at the start/end of the frame.

If you would like to change the position using the orbit-camera.js script, trying updating the pivot point Vec3 somewhere in your code:

this.cameraEntity.script.orbitCamera._pivotPoint.y += 0.01;
1 Like

Ah, thanks a lot. I tried changing the focusEntity but that only rotated the camera. I didn’t think of changing pivot point.

1 Like