Function for a still camera? WEBGL

Hello! I started programming about a month ago. Anyways I was working on a first-person demo and decided to make it so the mouse would move the camera. To test it out I used cam.pan and made it follow mouseX and mouseY. So the camera is panning and being controlled I was wondering if there is a function to set the camera still and make it still follow mouseX and mouseY?

let cam;

function setup() {
  createCanvas(400, 400, WEBGL);
   cam = createCamera();
}

function draw() {
  background(100,200,300);
      push();
      translate(35, 440,-300);
      box(-900,300,300);
      pop();
  cam.pan(mouseX,mouseY)
}

Can you elaborate? Iā€™m not sure I understand the behavior you want.

1 Like