/** * Looks from currentPosition to targetPosition (default up is 0,1,0) * @param id * @param name * @param currentPosition GameLib.API.Vector3 * @param targetPosition GameLib.API.Vector3 * @param targetPositionOffset GameLib.API.Vector3 * @param rotationSpeed Number * @param lookAtMatrix GameLib.API.Matrix4 * @param up GameLib.API.Vector3 * @param currentRotation GameLib.API.Quaternion * @constructor */ GameLib.D3.API.LookAt = function ( id, name, currentPosition, targetPosition, targetPositionOffset, rotationSpeed, lookAtMatrix, up, currentRotation ) { if (GameLib.Utils.UndefinedOrNull(id)) { id = GameLib.Utils.RandomId(); } this.id = id; if (GameLib.Utils.UndefinedOrNull(name)) { name = this.constructor.name; } this.name = name; if(GameLib.Utils.UndefinedOrNull(currentPosition)) { currentPosition = new GameLib.API.Vector3(0, 10, 10); } this.currentPosition = currentPosition; if(GameLib.Utils.UndefinedOrNull(targetPosition)) { targetPosition = new GameLib.API.Vector3(0, 0, 0); } this.targetPosition = targetPosition; if(GameLib.Utils.UndefinedOrNull(targetPositionOffset)) { targetPositionOffset = new GameLib.API.Vector3(0, 0, 0); } this.targetPositionOffset = targetPositionOffset; if (GameLib.Utils.UndefinedOrNull(rotationSpeed)) { rotationSpeed = 22.0; } this.rotationSpeed = rotationSpeed; if (GameLib.Utils.UndefinedOrNull(lookAtMatrix)) { lookAtMatrix = new GameLib.API.Matrix4(); } this.lookAtMatrix = lookAtMatrix; if(GameLib.Utils.UndefinedOrNull(up)) { up = new GameLib.API.Vector3(0, 1, 0); } this.up = up; if(GameLib.Utils.UndefinedOrNull(currentRotation)) { currentRotation = new GameLib.API.Quaternion(); } this.currentRotation = currentRotation; };