How to stop camera from jumping when player jumps

Hi guys,

I would like to stop ArcRotateCamera from moving upwards when my character jumps. Is there a way to disable the camera Y movement? I have this.camera.lockedTarget = player; which follows the player in all directions. Please help!

Something like the following could work:

scene.registerBeforeRender(() => {
    ...

    player.computeWorldMatrix(true);
    const targetPosition = player.getAbsolutePosition();

    /* Set camera's Y position to anything you'd like */
    targetPosition.y = customPositionY;

    camera.target.copyFrom(targetPosition);

    ...
});

Worked like a charm! thank you!. :slight_smile:

1 Like