[Solved] Property 'enterPointerlock' does not exist on type 'AbstractEngine'.ts(2339) any

Hey folks!

I’m after making an updates on all my packages, and I’m now getting this error in my project:

“Property ‘enterPointerlock’ does not exist on type ‘AbstractEngine’.ts(2339)”

private createCamera() {

  const focusPoint = this.createCameraFocusPoint(); // Create the camera focus point

  // Parameters: name, alpha (rotation), beta (height), radius (distance), target position, scene
  this.camera = new ArcRotateCamera("playerCamera", Math.PI / 1, Math.PI / 4.5, 19, focusPoint.position, this.scene);
  this.camera.attachControl(this.scene.getEngine().getRenderingCanvas(), true);
  
  // Now lock the camera's target to the focusPoint mesh
  this.camera.lockedTarget = focusPoint;

 // Remove default camera controls that may interfere
  this.camera.inputs.removeByType("ArcRotateCameraKeyboardMoveInput");
  this.camera.inputs.removeByType("ArcRotateCameraMouseWheelInput");

  this.camera.lowerBetaLimit = 0.2; // Prevent the camera from looking directly up
  this.camera.upperBetaLimit = Math.PI / 2 + 1; // Prevent the camera from looking directly down
  const pointersInput = this.camera.inputs.attached.pointers as ArcRotateCameraPointersInput;
  if (pointersInput) {
      pointersInput.angularSensibilityX = 1500; // Adjust as needed
      pointersInput.angularSensibilityY = 1500; // Adjust as needed
  }
  // Enable pointer lock on canvas click for immersive experience
  this.scene.onPointerDown = () => {
  this.scene.getEngine().enterPointerlock();
};
}

Everything works the same, but the error being there is bugging me… is there any idea on what’s causing this and how to fix?

I appreciate the help!

Just make sure to cast your engine as Engine:

(this.scene.getEngine() as Engine).enterPointerlock();
1 Like

Wow, that was quick! Thanks :smiley:

1 Like

always :smiley: