Skip to main content

Place your camera target at the center of the arc rotation (That's usually where you want the camera to look anyway). Then simply transform the camera's position around the target with a rotation that uses the appropriate axis.

pseudo code:
//some angle & some other angle = only the amount you want the camera to rotate since last frame.

//pitch
position = (Rotate(some angle, cameraRight) * (position - target)) + target;


//yaw, Y-up system
position = (rotateRotate(some other angle, (0,1,0)) * (position - target)) + target;

view = LookAt(position, target, up);

Edit: fixed missing parenthesis

Place your camera target at the center of the arc rotation (That's usually where you want the camera to look anyway). Then simply transform the camera's position around the target with a rotation that uses the appropriate axis.

pseudo code:
//some angle & some other angle = only the amount you want the camera to rotate since last frame.

//pitch
position = (Rotate(some angle, cameraRight) * (position - target)) + target;


//yaw, Y-up system
position = (rotate(some other angle, (0,1,0) * (position - target)) + target;

view = LookAt(position, target, up);

Place your camera target at the center of the arc rotation (That's usually where you want the camera to look anyway). Then simply transform the camera's position around the target with a rotation that uses the appropriate axis.

pseudo code:
//some angle & some other angle = only the amount you want the camera to rotate since last frame.

//pitch
position = (Rotate(some angle, cameraRight) * (position - target)) + target;


//yaw, Y-up system
position = (Rotate(some other angle, (0,1,0)) * (position - target)) + target;

view = LookAt(position, target, up);

Edit: fixed missing parenthesis

deleted 2 characters in body
Source Link
Steve H
  • 5.1k
  • 21
  • 21

Place your camera target at the center of the arc rotation (That's usually where you want the camera to look anyway). Then simply transform the camera's position around the target with a rotation that uses the appropriate axis.

pseudo code:
//some angle & some other angle = only the amount you want the camera to rotate since last frame.

//pitch
position = (Rotate(some angle, cameraRight)) * (position - target)) + target;


//yaw, Y-up system
position = (rotate(some other angle, (0,1,0)) * (position - target)) + target;

view = LookAt(position, target, up);

Place your camera target at the center of the arc rotation (That's usually where you want the camera to look anyway). Then simply transform the camera's position around the target with a rotation that uses the appropriate axis.

pseudo code:
//some angle & some other angle = only the amount you want the camera to rotate since last frame.

//pitch
position = (Rotate(some angle, cameraRight)) * (position - target)) + target;


//yaw, Y-up system
position = (rotate(some other angle, (0,1,0)) * (position - target)) + target;

view = LookAt(position, target, up);

Place your camera target at the center of the arc rotation (That's usually where you want the camera to look anyway). Then simply transform the camera's position around the target with a rotation that uses the appropriate axis.

pseudo code:
//some angle & some other angle = only the amount you want the camera to rotate since last frame.

//pitch
position = (Rotate(some angle, cameraRight) * (position - target)) + target;


//yaw, Y-up system
position = (rotate(some other angle, (0,1,0) * (position - target)) + target;

view = LookAt(position, target, up);
Source Link
Steve H
  • 5.1k
  • 21
  • 21

Place your camera target at the center of the arc rotation (That's usually where you want the camera to look anyway). Then simply transform the camera's position around the target with a rotation that uses the appropriate axis.

pseudo code:
//some angle & some other angle = only the amount you want the camera to rotate since last frame.

//pitch
position = (Rotate(some angle, cameraRight)) * (position - target)) + target;


//yaw, Y-up system
position = (rotate(some other angle, (0,1,0)) * (position - target)) + target;

view = LookAt(position, target, up);