Created
December 5, 2012 00:41
-
-
Save jakevsrobots/4210763 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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