Skip to content

Instantly share code, notes, and snippets.

@jakevsrobots
Created December 5, 2012 00:41
Show Gist options
  • Save jakevsrobots/4210763 to your computer and use it in GitHub Desktop.
Save jakevsrobots/4210763 to your computer and use it in GitHub Desktop.
// Get a Matrix4 which contains position, rotation and scale info for the cube
var matrix = cube.matrix;
// Move the matrix behind and above the cube a bit
matrix.translate(Vector3(0, 400, 400));
// Make the matrix's rotation point it at the cube's position
matrix.lookAt(matrix.position, cube.up, matrix.up);
// Set the camera's position and rotation from the matrix
camera.position.getPositionFromMatrix(matrix);
camera.position.getRotationFromMatrix(matrix);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment