mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-08 23:57:19 +02:00
change all references of Quat.getFront to Quat.getForward in scripts directory
This commit is contained in:
parent
b7980569cc
commit
a964edee91
40 changed files with 55 additions and 55 deletions
|
@ -4,7 +4,7 @@ var uuid = Entities.addEntity({
|
||||||
shape: "Icosahedron",
|
shape: "Icosahedron",
|
||||||
dimensions: Vec3.HALF,
|
dimensions: Vec3.HALF,
|
||||||
script: Script.resolvePath('../../tutorials/entity_scripts/ambientSound.js'),
|
script: Script.resolvePath('../../tutorials/entity_scripts/ambientSound.js'),
|
||||||
position: Vec3.sum(Vec3.multiply(5, Quat.getFront(MyAvatar.orientation)), MyAvatar.position),
|
position: Vec3.sum(Vec3.multiply(5, Quat.getForward(MyAvatar.orientation)), MyAvatar.position),
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
soundURL: WAVE,
|
soundURL: WAVE,
|
||||||
maxVolume: 0.1,
|
maxVolume: 0.1,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
orientation = Quat.safeEulerAngles(orientation);
|
orientation = Quat.safeEulerAngles(orientation);
|
||||||
orientation.x = 0;
|
orientation.x = 0;
|
||||||
orientation = Quat.fromVec3Degrees(orientation);
|
orientation = Quat.fromVec3Degrees(orientation);
|
||||||
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(orientation)));
|
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getForward(orientation)));
|
||||||
|
|
||||||
// Math.random ensures no caching of script
|
// Math.random ensures no caching of script
|
||||||
var SCRIPT_URL = Script.resolvePath("myEntityScript.js")
|
var SCRIPT_URL = Script.resolvePath("myEntityScript.js")
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
orientation = Quat.safeEulerAngles(orientation);
|
orientation = Quat.safeEulerAngles(orientation);
|
||||||
orientation.x = 0;
|
orientation.x = 0;
|
||||||
orientation = Quat.fromVec3Degrees(orientation);
|
orientation = Quat.fromVec3Degrees(orientation);
|
||||||
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(orientation)));
|
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getForward(orientation)));
|
||||||
|
|
||||||
// Math.random ensures no caching of script
|
// Math.random ensures no caching of script
|
||||||
var SCRIPT_URL = Script.resolvePath("batonSoundTestEntityScript.js")
|
var SCRIPT_URL = Script.resolvePath("batonSoundTestEntityScript.js")
|
||||||
|
|
|
@ -4,7 +4,7 @@ var DIV = NUM_ENTITIES / Math.PI / 2;
|
||||||
var PASS_SCRIPT_URL = Script.resolvePath('entityServerStampedeTest-entity.js');
|
var PASS_SCRIPT_URL = Script.resolvePath('entityServerStampedeTest-entity.js');
|
||||||
var FAIL_SCRIPT_URL = Script.resolvePath('entityStampedeTest-entity-fail.js');
|
var FAIL_SCRIPT_URL = Script.resolvePath('entityStampedeTest-entity-fail.js');
|
||||||
|
|
||||||
var origin = Vec3.sum(MyAvatar.position, Vec3.multiply(5, Quat.getFront(MyAvatar.orientation)));
|
var origin = Vec3.sum(MyAvatar.position, Vec3.multiply(5, Quat.getForward(MyAvatar.orientation)));
|
||||||
origin.y += HMD.eyeHeight;
|
origin.y += HMD.eyeHeight;
|
||||||
|
|
||||||
var uuids = [];
|
var uuids = [];
|
||||||
|
|
|
@ -4,7 +4,7 @@ var DIV = NUM_ENTITIES / Math.PI / 2;
|
||||||
var PASS_SCRIPT_URL = Script.resolvePath('').replace('.js', '-entity.js');
|
var PASS_SCRIPT_URL = Script.resolvePath('').replace('.js', '-entity.js');
|
||||||
var FAIL_SCRIPT_URL = Script.resolvePath('').replace('.js', '-entity-fail.js');
|
var FAIL_SCRIPT_URL = Script.resolvePath('').replace('.js', '-entity-fail.js');
|
||||||
|
|
||||||
var origin = Vec3.sum(MyAvatar.position, Vec3.multiply(5, Quat.getFront(MyAvatar.orientation)));
|
var origin = Vec3.sum(MyAvatar.position, Vec3.multiply(5, Quat.getForward(MyAvatar.orientation)));
|
||||||
origin.y += HMD.eyeHeight;
|
origin.y += HMD.eyeHeight;
|
||||||
|
|
||||||
var uuids = [];
|
var uuids = [];
|
||||||
|
|
|
@ -19,7 +19,7 @@ var WIDTH = MAX_DIM * NUM_SPHERES;
|
||||||
var entities = [];
|
var entities = [];
|
||||||
var right = Quat.getRight(Camera.orientation);
|
var right = Quat.getRight(Camera.orientation);
|
||||||
// Starting position will be 30 meters in front of the camera
|
// Starting position will be 30 meters in front of the camera
|
||||||
var position = Vec3.sum(Camera.position, Vec3.multiply(30, Quat.getFront(Camera.orientation)));
|
var position = Vec3.sum(Camera.position, Vec3.multiply(30, Quat.getForward(Camera.orientation)));
|
||||||
position = Vec3.sum(position, Vec3.multiply(-WIDTH/2, right));
|
position = Vec3.sum(position, Vec3.multiply(-WIDTH/2, right));
|
||||||
|
|
||||||
for (var i = 0; i < NUM_SPHERES; ++i) {
|
for (var i = 0; i < NUM_SPHERES; ++i) {
|
||||||
|
|
|
@ -143,10 +143,10 @@ function testInverse() {
|
||||||
|
|
||||||
function testFront() {
|
function testFront() {
|
||||||
var test0 = IDENTITY;
|
var test0 = IDENTITY;
|
||||||
assert(mat4FuzzyEqual({x: 0, y: 0, z: -1}, Mat4.getFront(test0)));
|
assert(mat4FuzzyEqual({x: 0, y: 0, z: -1}, Mat4.getForward(test0)));
|
||||||
|
|
||||||
var test1 = Mat4.createFromScaleRotAndTrans(ONE_HALF, ROT_Y_180, ONE_TWO_THREE);
|
var test1 = Mat4.createFromScaleRotAndTrans(ONE_HALF, ROT_Y_180, ONE_TWO_THREE);
|
||||||
assert(mat4FuzzyEqual({x: 0, y: 0, z: 1}, Mat4.getFront(test1)));
|
assert(mat4FuzzyEqual({x: 0, y: 0, z: 1}, Mat4.getForward(test1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testMat4() {
|
function testMat4() {
|
||||||
|
|
|
@ -43,7 +43,7 @@ var HOW_FAR_UP = RANGE / 1.5; // higher (for uneven ground) above range/2 (for
|
||||||
|
|
||||||
var totalCreated = 0;
|
var totalCreated = 0;
|
||||||
var offset = Vec3.sum(Vec3.multiply(HOW_FAR_UP, Vec3.UNIT_Y),
|
var offset = Vec3.sum(Vec3.multiply(HOW_FAR_UP, Vec3.UNIT_Y),
|
||||||
Vec3.multiply(HOW_FAR_IN_FRONT_OF_ME, Quat.getFront(Camera.orientation)));
|
Vec3.multiply(HOW_FAR_IN_FRONT_OF_ME, Quat.getForward(Camera.orientation)));
|
||||||
var center = Vec3.sum(MyAvatar.position, offset);
|
var center = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
|
||||||
function randomVector(range) {
|
function randomVector(range) {
|
||||||
|
|
|
@ -20,9 +20,9 @@ orientation = Quat.safeEulerAngles(orientation);
|
||||||
orientation.x = 0;
|
orientation.x = 0;
|
||||||
orientation = Quat.fromVec3Degrees(orientation);
|
orientation = Quat.fromVec3Degrees(orientation);
|
||||||
|
|
||||||
var centerUp = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(orientation)));
|
var centerUp = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getForward(orientation)));
|
||||||
centerUp.y += 0.5;
|
centerUp.y += 0.5;
|
||||||
var centerDown = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(orientation)));
|
var centerDown = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getForward(orientation)));
|
||||||
centerDown.y -= 0.5;
|
centerDown.y -= 0.5;
|
||||||
|
|
||||||
var ENTITY_SHADER_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/shaders/uniformTest.fs";
|
var ENTITY_SHADER_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/shaders/uniformTest.fs";
|
||||||
|
|
|
@ -15,7 +15,7 @@ MyAvatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||||
orientation = Quat.safeEulerAngles(MyAvatar.orientation);
|
orientation = Quat.safeEulerAngles(MyAvatar.orientation);
|
||||||
orientation.x = 0;
|
orientation.x = 0;
|
||||||
orientation = Quat.fromVec3Degrees(orientation);
|
orientation = Quat.fromVec3Degrees(orientation);
|
||||||
var tablePosition = Vec3.sum(MyAvatar.position, Quat.getFront(orientation));
|
var tablePosition = Vec3.sum(MyAvatar.position, Quat.getForward(orientation));
|
||||||
tablePosition.y += 0.5;
|
tablePosition.y += 0.5;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ var UPDATE_HZ = 60; // standard script update rate
|
||||||
var UPDATE_INTERVAL = 1000/UPDATE_HZ; // standard script update interval
|
var UPDATE_INTERVAL = 1000/UPDATE_HZ; // standard script update interval
|
||||||
var UPDATE_WORK_EFFORT = 0; // 1000 is light work, 1000000 ~= 30ms
|
var UPDATE_WORK_EFFORT = 0; // 1000 is light work, 1000000 ~= 30ms
|
||||||
|
|
||||||
var basePosition = Vec3.sum(Camera.getPosition(), Quat.getFront(Camera.getOrientation()));
|
var basePosition = Vec3.sum(Camera.getPosition(), Quat.getForward(Camera.getOrientation()));
|
||||||
|
|
||||||
var timerBox = Entities.addEntity(
|
var timerBox = Entities.addEntity(
|
||||||
{ type: "Box",
|
{ type: "Box",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
describe('Entity', function() {
|
describe('Entity', function() {
|
||||||
var center = Vec3.sum(
|
var center = Vec3.sum(
|
||||||
MyAvatar.position,
|
MyAvatar.position,
|
||||||
Vec3.multiply(3, Quat.getFront(Camera.getOrientation()))
|
Vec3.multiply(3, Quat.getForward(Camera.getOrientation()))
|
||||||
);
|
);
|
||||||
var boxEntity;
|
var boxEntity;
|
||||||
var boxProps = {
|
var boxProps = {
|
||||||
|
|
|
@ -24,8 +24,8 @@ var boxZAxis, boxYAxis;
|
||||||
var prevThumbDown = false;
|
var prevThumbDown = false;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
boxPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation())));
|
boxPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getForward(Camera.getOrientation())));
|
||||||
var front = Quat.getFront(Camera.getOrientation());
|
var front = Quat.getForward(Camera.getOrientation());
|
||||||
boxZAxis = Vec3.normalize(Vec3.cross(front, Y_AXIS));
|
boxZAxis = Vec3.normalize(Vec3.cross(front, Y_AXIS));
|
||||||
boxYAxis = Vec3.normalize(Vec3.cross(boxZAxis, front));
|
boxYAxis = Vec3.normalize(Vec3.cross(boxZAxis, front));
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
PhotoBooth.init = function () {
|
PhotoBooth.init = function () {
|
||||||
var success = Clipboard.importEntities(PHOTOBOOTH_SETUP_JSON_URL);
|
var success = Clipboard.importEntities(PHOTOBOOTH_SETUP_JSON_URL);
|
||||||
var frontFactor = 10;
|
var frontFactor = 10;
|
||||||
var frontUnitVec = Vec3.normalize(Quat.getFront(MyAvatar.orientation));
|
var frontUnitVec = Vec3.normalize(Quat.getForward(MyAvatar.orientation));
|
||||||
var frontOffset = Vec3.multiply(frontUnitVec,frontFactor);
|
var frontOffset = Vec3.multiply(frontUnitVec,frontFactor);
|
||||||
var rightFactor = 3;
|
var rightFactor = 3;
|
||||||
var rightUnitVec = Vec3.normalize(Quat.getRight(MyAvatar.orientation));
|
var rightUnitVec = Vec3.normalize(Quat.getRight(MyAvatar.orientation));
|
||||||
|
|
|
@ -87,7 +87,7 @@ function moveCloserToCamera(positionAtHUD) {
|
||||||
// we don't actually want to render at the slerped look at... instead, we want to render
|
// we don't actually want to render at the slerped look at... instead, we want to render
|
||||||
// slightly closer to the camera than that.
|
// slightly closer to the camera than that.
|
||||||
var MOVE_CLOSER_TO_CAMERA_BY = -0.25;
|
var MOVE_CLOSER_TO_CAMERA_BY = -0.25;
|
||||||
var cameraFront = Quat.getFront(Camera.orientation);
|
var cameraFront = Quat.getForward(Camera.orientation);
|
||||||
var closerToCamera = Vec3.multiply(cameraFront, MOVE_CLOSER_TO_CAMERA_BY); // slightly closer to camera
|
var closerToCamera = Vec3.multiply(cameraFront, MOVE_CLOSER_TO_CAMERA_BY); // slightly closer to camera
|
||||||
var slightlyCloserPosition = Vec3.sum(positionAtHUD, closerToCamera);
|
var slightlyCloserPosition = Vec3.sum(positionAtHUD, closerToCamera);
|
||||||
|
|
||||||
|
|
|
@ -463,7 +463,7 @@ Grabber.prototype.moveEvent = function(event) {
|
||||||
var orientation = Camera.getOrientation();
|
var orientation = Camera.getOrientation();
|
||||||
var dragOffset = Vec3.multiply(drag.x, Quat.getRight(orientation));
|
var dragOffset = Vec3.multiply(drag.x, Quat.getRight(orientation));
|
||||||
dragOffset = Vec3.sum(dragOffset, Vec3.multiply(-drag.y, Quat.getUp(orientation)));
|
dragOffset = Vec3.sum(dragOffset, Vec3.multiply(-drag.y, Quat.getUp(orientation)));
|
||||||
var axis = Vec3.cross(dragOffset, Quat.getFront(orientation));
|
var axis = Vec3.cross(dragOffset, Quat.getForward(orientation));
|
||||||
axis = Vec3.normalize(axis);
|
axis = Vec3.normalize(axis);
|
||||||
var ROTATE_STRENGTH = 0.4; // magic number tuned by hand
|
var ROTATE_STRENGTH = 0.4; // magic number tuned by hand
|
||||||
var angle = ROTATE_STRENGTH * Math.sqrt((drag.x * drag.x) + (drag.y * drag.y));
|
var angle = ROTATE_STRENGTH * Math.sqrt((drag.x * drag.x) + (drag.y * drag.y));
|
||||||
|
@ -487,7 +487,7 @@ Grabber.prototype.moveEvent = function(event) {
|
||||||
|
|
||||||
if (this.mode === "verticalCylinder") {
|
if (this.mode === "verticalCylinder") {
|
||||||
// for this mode we recompute the plane based on current Camera
|
// for this mode we recompute the plane based on current Camera
|
||||||
var planeNormal = Quat.getFront(Camera.getOrientation());
|
var planeNormal = Quat.getForward(Camera.getOrientation());
|
||||||
planeNormal.y = 0;
|
planeNormal.y = 0;
|
||||||
planeNormal = Vec3.normalize(planeNormal);
|
planeNormal = Vec3.normalize(planeNormal);
|
||||||
var pointOnCylinder = Vec3.multiply(planeNormal, this.xzDistanceToGrab);
|
var pointOnCylinder = Vec3.multiply(planeNormal, this.xzDistanceToGrab);
|
||||||
|
|
|
@ -1481,7 +1481,7 @@ function MyController(hand) {
|
||||||
var pickRay = {
|
var pickRay = {
|
||||||
origin: PICK_WITH_HAND_RAY ? worldHandPosition : Camera.position,
|
origin: PICK_WITH_HAND_RAY ? worldHandPosition : Camera.position,
|
||||||
direction: PICK_WITH_HAND_RAY ? Quat.getUp(worldHandRotation) : Vec3.mix(Quat.getUp(worldHandRotation),
|
direction: PICK_WITH_HAND_RAY ? Quat.getUp(worldHandRotation) : Vec3.mix(Quat.getUp(worldHandRotation),
|
||||||
Quat.getFront(Camera.orientation),
|
Quat.getForward(Camera.orientation),
|
||||||
HAND_HEAD_MIX_RATIO),
|
HAND_HEAD_MIX_RATIO),
|
||||||
length: PICK_MAX_DISTANCE
|
length: PICK_MAX_DISTANCE
|
||||||
};
|
};
|
||||||
|
|
|
@ -174,7 +174,7 @@ function calculateRayUICollisionPoint(position, direction) {
|
||||||
// interect HUD plane, 1m in front of camera, using formula:
|
// interect HUD plane, 1m in front of camera, using formula:
|
||||||
// scale = hudNormal dot (hudPoint - position) / hudNormal dot direction
|
// scale = hudNormal dot (hudPoint - position) / hudNormal dot direction
|
||||||
// intersection = postion + scale*direction
|
// intersection = postion + scale*direction
|
||||||
var hudNormal = Quat.getFront(Camera.getOrientation());
|
var hudNormal = Quat.getForward(Camera.getOrientation());
|
||||||
var hudPoint = Vec3.sum(Camera.getPosition(), hudNormal); // must also scale if PLANAR_PERPENDICULAR_HUD_DISTANCE!=1
|
var hudPoint = Vec3.sum(Camera.getPosition(), hudNormal); // must also scale if PLANAR_PERPENDICULAR_HUD_DISTANCE!=1
|
||||||
var denominator = Vec3.dot(hudNormal, direction);
|
var denominator = Vec3.dot(hudNormal, direction);
|
||||||
if (denominator === 0) {
|
if (denominator === 0) {
|
||||||
|
|
|
@ -816,7 +816,7 @@ function mouseClickEvent(event) {
|
||||||
if (0 < x && sizeOK) {
|
if (0 < x && sizeOK) {
|
||||||
selectedEntityID = foundEntity;
|
selectedEntityID = foundEntity;
|
||||||
orientation = MyAvatar.orientation;
|
orientation = MyAvatar.orientation;
|
||||||
intersection = rayPlaneIntersection(pickRay, P, Quat.getFront(orientation));
|
intersection = rayPlaneIntersection(pickRay, P, Quat.getForward(orientation));
|
||||||
|
|
||||||
|
|
||||||
if (!event.isShifted) {
|
if (!event.isShifted) {
|
||||||
|
@ -1338,12 +1338,12 @@ function handeMenuEvent(menuItem) {
|
||||||
}
|
}
|
||||||
function getPositionToCreateEntity() {
|
function getPositionToCreateEntity() {
|
||||||
var HALF_TREE_SCALE = 16384;
|
var HALF_TREE_SCALE = 16384;
|
||||||
var direction = Quat.getFront(MyAvatar.orientation);
|
var direction = Quat.getForward(MyAvatar.orientation);
|
||||||
var distance = 1;
|
var distance = 1;
|
||||||
var position = Vec3.sum(MyAvatar.position, Vec3.multiply(direction, distance));
|
var position = Vec3.sum(MyAvatar.position, Vec3.multiply(direction, distance));
|
||||||
|
|
||||||
if (Camera.mode === "entity" || Camera.mode === "independent") {
|
if (Camera.mode === "entity" || Camera.mode === "independent") {
|
||||||
position = Vec3.sum(Camera.position, Vec3.multiply(Quat.getFront(Camera.orientation), distance))
|
position = Vec3.sum(Camera.position, Vec3.multiply(Quat.getForward(Camera.orientation), distance))
|
||||||
}
|
}
|
||||||
position.y += 0.5;
|
position.y += 0.5;
|
||||||
if (position.x > HALF_TREE_SCALE || position.y > HALF_TREE_SCALE || position.z > HALF_TREE_SCALE) {
|
if (position.x > HALF_TREE_SCALE || position.y > HALF_TREE_SCALE || position.z > HALF_TREE_SCALE) {
|
||||||
|
@ -1355,13 +1355,13 @@ function getPositionToCreateEntity() {
|
||||||
function getPositionToImportEntity() {
|
function getPositionToImportEntity() {
|
||||||
var dimensions = Clipboard.getContentsDimensions();
|
var dimensions = Clipboard.getContentsDimensions();
|
||||||
var HALF_TREE_SCALE = 16384;
|
var HALF_TREE_SCALE = 16384;
|
||||||
var direction = Quat.getFront(MyAvatar.orientation);
|
var direction = Quat.getForward(MyAvatar.orientation);
|
||||||
var longest = 1;
|
var longest = 1;
|
||||||
longest = Math.sqrt(Math.pow(dimensions.x, 2) + Math.pow(dimensions.z, 2));
|
longest = Math.sqrt(Math.pow(dimensions.x, 2) + Math.pow(dimensions.z, 2));
|
||||||
var position = Vec3.sum(MyAvatar.position, Vec3.multiply(direction, longest));
|
var position = Vec3.sum(MyAvatar.position, Vec3.multiply(direction, longest));
|
||||||
|
|
||||||
if (Camera.mode === "entity" || Camera.mode === "independent") {
|
if (Camera.mode === "entity" || Camera.mode === "independent") {
|
||||||
position = Vec3.sum(Camera.position, Vec3.multiply(Quat.getFront(Camera.orientation), longest))
|
position = Vec3.sum(Camera.position, Vec3.multiply(Quat.getForward(Camera.orientation), longest))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (position.x > HALF_TREE_SCALE || position.y > HALF_TREE_SCALE || position.z > HALF_TREE_SCALE) {
|
if (position.x > HALF_TREE_SCALE || position.y > HALF_TREE_SCALE || position.z > HALF_TREE_SCALE) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ function calcSpawnInfo(hand, height) {
|
||||||
rotation: lookAtRot
|
rotation: lookAtRot
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
var front = Quat.getFront(headRot);
|
var front = Quat.getForward(headRot);
|
||||||
finalPosition = Vec3.sum(headPos, Vec3.multiply(0.6, front));
|
finalPosition = Vec3.sum(headPos, Vec3.multiply(0.6, front));
|
||||||
var orientation = Quat.lookAt({x: 0, y: 0, z: 0}, front, {x: 0, y: 1, z: 0});
|
var orientation = Quat.lookAt({x: 0, y: 0, z: 0}, front, {x: 0, y: 1, z: 0});
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -158,7 +158,7 @@ CameraManager = function() {
|
||||||
that.zoomDistance = INITIAL_ZOOM_DISTANCE;
|
that.zoomDistance = INITIAL_ZOOM_DISTANCE;
|
||||||
that.targetZoomDistance = that.zoomDistance + 3.0;
|
that.targetZoomDistance = that.zoomDistance + 3.0;
|
||||||
var focalPoint = Vec3.sum(Camera.getPosition(),
|
var focalPoint = Vec3.sum(Camera.getPosition(),
|
||||||
Vec3.multiply(that.zoomDistance, Quat.getFront(Camera.getOrientation())));
|
Vec3.multiply(that.zoomDistance, Quat.getForward(Camera.getOrientation())));
|
||||||
|
|
||||||
// Determine the correct yaw and pitch to keep the camera in the same location
|
// Determine the correct yaw and pitch to keep the camera in the same location
|
||||||
var dPos = Vec3.subtract(focalPoint, Camera.getPosition());
|
var dPos = Vec3.subtract(focalPoint, Camera.getPosition());
|
||||||
|
@ -435,7 +435,7 @@ CameraManager = function() {
|
||||||
});
|
});
|
||||||
var q = Quat.multiply(yRot, xRot);
|
var q = Quat.multiply(yRot, xRot);
|
||||||
|
|
||||||
var pos = Vec3.multiply(Quat.getFront(q), that.zoomDistance);
|
var pos = Vec3.multiply(Quat.getForward(q), that.zoomDistance);
|
||||||
Camera.setPosition(Vec3.sum(that.focalPoint, pos));
|
Camera.setPosition(Vec3.sum(that.focalPoint, pos));
|
||||||
|
|
||||||
yRot = Quat.angleAxis(that.yaw - 180, {
|
yRot = Quat.angleAxis(that.yaw - 180, {
|
||||||
|
|
|
@ -2517,7 +2517,7 @@ SelectionDisplay = (function() {
|
||||||
onBegin: function(event) {
|
onBegin: function(event) {
|
||||||
pickRay = generalComputePickRay(event.x, event.y);
|
pickRay = generalComputePickRay(event.x, event.y);
|
||||||
|
|
||||||
upDownPickNormal = Quat.getFront(lastCameraOrientation);
|
upDownPickNormal = Quat.getForward(lastCameraOrientation);
|
||||||
// Remove y component so the y-axis lies along the plane we picking on - this will
|
// Remove y component so the y-axis lies along the plane we picking on - this will
|
||||||
// give movements that follow the mouse.
|
// give movements that follow the mouse.
|
||||||
upDownPickNormal.y = 0;
|
upDownPickNormal.y = 0;
|
||||||
|
|
|
@ -36,7 +36,7 @@ SoundArray = function(audioOptions, autoUpdateAudioPosition) {
|
||||||
};
|
};
|
||||||
this.updateAudioPosition = function() {
|
this.updateAudioPosition = function() {
|
||||||
var position = MyAvatar.position;
|
var position = MyAvatar.position;
|
||||||
var forwardVector = Quat.getFront(MyAvatar.orientation);
|
var forwardVector = Quat.getForward(MyAvatar.orientation);
|
||||||
this.audioOptions.position = Vec3.sum(position, forwardVector);
|
this.audioOptions.position = Vec3.sum(position, forwardVector);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,7 +33,7 @@ Script.setTimeout(function() {
|
||||||
}, STARTUP_DELAY);
|
}, STARTUP_DELAY);
|
||||||
|
|
||||||
function addNameTag() {
|
function addNameTag() {
|
||||||
var nameTagPosition = Vec3.sum(MyAvatar.getHeadPosition(), Vec3.multiply(HEAD_OFFSET, Quat.getFront(MyAvatar.orientation)));
|
var nameTagPosition = Vec3.sum(MyAvatar.getHeadPosition(), Vec3.multiply(HEAD_OFFSET, Quat.getForward(MyAvatar.orientation)));
|
||||||
nameTagPosition.y += HEIGHT_ABOVE_HEAD;
|
nameTagPosition.y += HEIGHT_ABOVE_HEAD;
|
||||||
var nameTagProperties = {
|
var nameTagProperties = {
|
||||||
name: MyAvatar.displayName + ' Name Tag',
|
name: MyAvatar.displayName + ' Name Tag',
|
||||||
|
@ -49,7 +49,7 @@ function addNameTag() {
|
||||||
|
|
||||||
function updateNameTag() {
|
function updateNameTag() {
|
||||||
var nameTagProps = Entities.getEntityProperties(nameTagEntityID);
|
var nameTagProps = Entities.getEntityProperties(nameTagEntityID);
|
||||||
var nameTagPosition = Vec3.sum(MyAvatar.getHeadPosition(), Vec3.multiply(HEAD_OFFSET, Quat.getFront(MyAvatar.orientation)));
|
var nameTagPosition = Vec3.sum(MyAvatar.getHeadPosition(), Vec3.multiply(HEAD_OFFSET, Quat.getForward(MyAvatar.orientation)));
|
||||||
nameTagPosition.y += HEIGHT_ABOVE_HEAD;
|
nameTagPosition.y += HEIGHT_ABOVE_HEAD;
|
||||||
|
|
||||||
Entities.editEntity(nameTagEntityID, {
|
Entities.editEntity(nameTagEntityID, {
|
||||||
|
|
|
@ -298,7 +298,7 @@ function populateUserList(selectData, oldAudioData) {
|
||||||
verticalHalfAngle = filter && (frustum.fieldOfView / 2),
|
verticalHalfAngle = filter && (frustum.fieldOfView / 2),
|
||||||
horizontalHalfAngle = filter && (verticalHalfAngle * frustum.aspectRatio),
|
horizontalHalfAngle = filter && (verticalHalfAngle * frustum.aspectRatio),
|
||||||
orientation = filter && Camera.orientation,
|
orientation = filter && Camera.orientation,
|
||||||
front = filter && Quat.getFront(orientation),
|
front = filter && Quat.getForward(orientation),
|
||||||
verticalAngleNormal = filter && Quat.getRight(orientation),
|
verticalAngleNormal = filter && Quat.getRight(orientation),
|
||||||
horizontalAngleNormal = filter && Quat.getUp(orientation);
|
horizontalAngleNormal = filter && Quat.getUp(orientation);
|
||||||
avatars.forEach(function (id) { // sorting the identifiers is just an aid for debugging
|
avatars.forEach(function (id) { // sorting the identifiers is just an aid for debugging
|
||||||
|
|
|
@ -253,7 +253,7 @@ function addTerrainBlock() {
|
||||||
if (alreadyThere) {
|
if (alreadyThere) {
|
||||||
// there is already a terrain block under MyAvatar.
|
// there is already a terrain block under MyAvatar.
|
||||||
// try in front of the avatar.
|
// try in front of the avatar.
|
||||||
facingPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(8.0, Quat.getFront(Camera.getOrientation())));
|
facingPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(8.0, Quat.getForward(Camera.getOrientation())));
|
||||||
facingPosition = Vec3.sum(facingPosition, {
|
facingPosition = Vec3.sum(facingPosition, {
|
||||||
x: 8,
|
x: 8,
|
||||||
y: 8,
|
y: 8,
|
||||||
|
|
|
@ -53,7 +53,7 @@ var deleteButton = toolBar.addOverlay("image", {
|
||||||
});
|
});
|
||||||
|
|
||||||
function inFrontOfMe(distance) {
|
function inFrontOfMe(distance) {
|
||||||
return Vec3.sum(Camera.getPosition(), Vec3.multiply(distance, Quat.getFront(Camera.getOrientation())));
|
return Vec3.sum(Camera.getPosition(), Vec3.multiply(distance, Quat.getForward(Camera.getOrientation())));
|
||||||
}
|
}
|
||||||
|
|
||||||
function onButtonClick() {
|
function onButtonClick() {
|
||||||
|
|
|
@ -44,8 +44,8 @@ var FIXED_LOCATION = false;
|
||||||
|
|
||||||
if (!FIXED_LOCATION) {
|
if (!FIXED_LOCATION) {
|
||||||
var flockPosition = Vec3.sum(MyAvatar.position,Vec3.sum(
|
var flockPosition = Vec3.sum(MyAvatar.position,Vec3.sum(
|
||||||
Vec3.multiply(Quat.getFront(MyAvatar.orientation), DISTANCE_ABOVE_ME),
|
Vec3.multiply(Quat.getForward(MyAvatar.orientation), DISTANCE_ABOVE_ME),
|
||||||
Vec3.multiply(Quat.getFront(MyAvatar.orientation), DISTANCE_IN_FRONT_OF_ME)));
|
Vec3.multiply(Quat.getForward(MyAvatar.orientation), DISTANCE_IN_FRONT_OF_ME)));
|
||||||
} else {
|
} else {
|
||||||
var flockPosition = { x: 4999.6, y: 4986.5, z: 5003.5 };
|
var flockPosition = { x: 4999.6, y: 4986.5, z: 5003.5 };
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ function updateButterflies(deltaTime) {
|
||||||
var HORIZ_SCALE = 0.50;
|
var HORIZ_SCALE = 0.50;
|
||||||
var VERT_SCALE = 0.50;
|
var VERT_SCALE = 0.50;
|
||||||
var newHeading = Math.random() * 360.0;
|
var newHeading = Math.random() * 360.0;
|
||||||
var newVelocity = Vec3.multiply(HORIZ_SCALE, Quat.getFront(Quat.fromPitchYawRollDegrees(0.0, newHeading, 0.0)));
|
var newVelocity = Vec3.multiply(HORIZ_SCALE, Quat.getForward(Quat.fromPitchYawRollDegrees(0.0, newHeading, 0.0)));
|
||||||
newVelocity.y = (Math.random() + 0.5) * VERT_SCALE;
|
newVelocity.y = (Math.random() + 0.5) * VERT_SCALE;
|
||||||
Entities.editEntity(butterflies[i], { rotation: Quat.fromPitchYawRollDegrees(-80 + Math.random() * 20, newHeading, (Math.random() - 0.5) * 10),
|
Entities.editEntity(butterflies[i], { rotation: Quat.fromPitchYawRollDegrees(-80 + Math.random() * 20, newHeading, (Math.random() - 0.5) * 10),
|
||||||
velocity: newVelocity } );
|
velocity: newVelocity } );
|
||||||
|
|
|
@ -18,7 +18,7 @@ var orientation = MyAvatar.orientation;
|
||||||
orientation = Quat.safeEulerAngles(orientation);
|
orientation = Quat.safeEulerAngles(orientation);
|
||||||
orientation.x = 0;
|
orientation.x = 0;
|
||||||
orientation = Quat.fromVec3Degrees(orientation);
|
orientation = Quat.fromVec3Degrees(orientation);
|
||||||
var center = Vec3.sum(MyAvatar.getHeadPosition(), Vec3.multiply(2, Quat.getFront(orientation)));
|
var center = Vec3.sum(MyAvatar.getHeadPosition(), Vec3.multiply(2, Quat.getForward(orientation)));
|
||||||
|
|
||||||
// An entity is described and created by specifying a map of properties
|
// An entity is described and created by specifying a map of properties
|
||||||
var cow = Entities.addEntity({
|
var cow = Entities.addEntity({
|
||||||
|
|
|
@ -127,8 +127,8 @@ function mousePressEvent(event) {
|
||||||
deleteDice();
|
deleteDice();
|
||||||
} else if (clickedOverlay == diceButton) {
|
} else if (clickedOverlay == diceButton) {
|
||||||
var HOW_HARD = 2.0;
|
var HOW_HARD = 2.0;
|
||||||
var position = Vec3.sum(Camera.getPosition(), Quat.getFront(Camera.getOrientation()));
|
var position = Vec3.sum(Camera.getPosition(), Quat.getForward(Camera.getOrientation()));
|
||||||
var velocity = Vec3.multiply(HOW_HARD, Quat.getFront(Camera.getOrientation()));
|
var velocity = Vec3.multiply(HOW_HARD, Quat.getForward(Camera.getOrientation()));
|
||||||
shootDice(position, velocity);
|
shootDice(position, velocity);
|
||||||
madeSound = false;
|
madeSound = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0.5,
|
y: 0.5,
|
||||||
z: 0
|
z: 0
|
||||||
}), Vec3.multiply(0.5, Quat.getFront(Camera.getOrientation())));
|
}), Vec3.multiply(0.5, Quat.getForward(Camera.getOrientation())));
|
||||||
|
|
||||||
var flashlight = Entities.addEntity({
|
var flashlight = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
|
|
|
@ -15,7 +15,7 @@ var orientation = MyAvatar.orientation;
|
||||||
orientation = Quat.safeEulerAngles(orientation);
|
orientation = Quat.safeEulerAngles(orientation);
|
||||||
orientation.x = 0;
|
orientation.x = 0;
|
||||||
orientation = Quat.fromVec3Degrees(orientation);
|
orientation = Quat.fromVec3Degrees(orientation);
|
||||||
var center = Vec3.sum(MyAvatar.getHeadPosition(), Vec3.multiply(2, Quat.getFront(orientation)));
|
var center = Vec3.sum(MyAvatar.getHeadPosition(), Vec3.multiply(2, Quat.getForward(orientation)));
|
||||||
|
|
||||||
var CLUB_MODEL = "http://hifi-production.s3.amazonaws.com/tutorials/golfClub/putter_VR.fbx";
|
var CLUB_MODEL = "http://hifi-production.s3.amazonaws.com/tutorials/golfClub/putter_VR.fbx";
|
||||||
var CLUB_COLLISION_HULL = "http://hifi-production.s3.amazonaws.com/tutorials/golfClub/club_collision_hull.obj";
|
var CLUB_COLLISION_HULL = "http://hifi-production.s3.amazonaws.com/tutorials/golfClub/club_collision_hull.obj";
|
||||||
|
|
|
@ -14,7 +14,7 @@ var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0.5,
|
y: 0.5,
|
||||||
z: 0
|
z: 0
|
||||||
}), Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
|
}), Vec3.multiply(1, Quat.getForward(Camera.getOrientation())));
|
||||||
|
|
||||||
// this is just a model exported from blender with a texture named 'Picture' on one face. also made it emissive so it doesn't require lighting.
|
// this is just a model exported from blender with a texture named 'Picture' on one face. also made it emissive so it doesn't require lighting.
|
||||||
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/tutorials/pictureFrame/finalFrame.fbx";
|
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/tutorials/pictureFrame/finalFrame.fbx";
|
||||||
|
|
|
@ -14,7 +14,7 @@ var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0.5,
|
y: 0.5,
|
||||||
z: 0
|
z: 0
|
||||||
}), Vec3.multiply(0.5, Quat.getFront(Camera.getOrientation())));
|
}), Vec3.multiply(0.5, Quat.getForward(Camera.getOrientation())));
|
||||||
|
|
||||||
|
|
||||||
var pingPongGunProperties = {
|
var pingPongGunProperties = {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(1.5, Quat.getFront(Camera.getOrientation())));
|
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(1.5, Quat.getForward(Camera.getOrientation())));
|
||||||
var SCRIPT_URL = "http://hifi-production.s3.amazonaws.com/tutorials/entity_scripts/pistol.js";
|
var SCRIPT_URL = "http://hifi-production.s3.amazonaws.com/tutorials/entity_scripts/pistol.js";
|
||||||
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/tutorials/pistol/gun.fbx";
|
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/tutorials/pistol/gun.fbx";
|
||||||
var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/tutorials/pistol/drop.wav'
|
var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/tutorials/pistol/drop.wav'
|
||||||
|
|
|
@ -13,7 +13,7 @@ var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0.5,
|
y: 0.5,
|
||||||
z: 0
|
z: 0
|
||||||
}), Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
|
}), Vec3.multiply(1, Quat.getForward(Camera.getOrientation())));
|
||||||
|
|
||||||
function makeBell() {
|
function makeBell() {
|
||||||
var soundMakerProperties = {
|
var soundMakerProperties = {
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
// Position yourself facing in the direction you were originally facing, but with a
|
// Position yourself facing in the direction you were originally facing, but with a
|
||||||
// point on the ground *away* meters from *position* and in front of you.
|
// point on the ground *away* meters from *position* and in front of you.
|
||||||
|
|
||||||
var offset = Quat.getFront(MyAvatar.orientation);
|
var offset = Quat.getForward(MyAvatar.orientation);
|
||||||
offset.y = 0.0;
|
offset.y = 0.0;
|
||||||
offset = Vec3.multiply(-away, Vec3.normalize(offset));
|
offset = Vec3.multiply(-away, Vec3.normalize(offset));
|
||||||
var newAvatarPosition = Vec3.sum(position, offset);
|
var newAvatarPosition = Vec3.sum(position, offset);
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function inFrontOfMe() {
|
function inFrontOfMe() {
|
||||||
return Vec3.sum(MyAvatar.position, Vec3.multiply(BALL_DROP_DISTANCE, Quat.getFront(MyAvatar.orientation)));
|
return Vec3.sum(MyAvatar.position, Vec3.multiply(BALL_DROP_DISTANCE, Quat.getForward(MyAvatar.orientation)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function avatarHalfHeight() {
|
function avatarHalfHeight() {
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
shootBall: function(gunProperties) {
|
shootBall: function(gunProperties) {
|
||||||
var forwardVec = Quat.getFront(Quat.multiply(gunProperties.rotation, Quat.fromPitchYawRollDegrees(0, 180, 0)));
|
var forwardVec = Quat.getForward(Quat.multiply(gunProperties.rotation, Quat.fromPitchYawRollDegrees(0, 180, 0)));
|
||||||
forwardVec = Vec3.normalize(forwardVec);
|
forwardVec = Vec3.normalize(forwardVec);
|
||||||
forwardVec = Vec3.multiply(forwardVec, GUN_FORCE);
|
forwardVec = Vec3.multiply(forwardVec, GUN_FORCE);
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
|
|
||||||
getGunTipPosition: function(properties) {
|
getGunTipPosition: function(properties) {
|
||||||
//the tip of the gun is going to be in a different place than the center, so we move in space relative to the model to find that position
|
//the tip of the gun is going to be in a different place than the center, so we move in space relative to the model to find that position
|
||||||
var frontVector = Quat.getFront(properties.rotation);
|
var frontVector = Quat.getForward(properties.rotation);
|
||||||
var frontOffset = Vec3.multiply(frontVector, GUN_TIP_FWD_OFFSET);
|
var frontOffset = Vec3.multiply(frontVector, GUN_TIP_FWD_OFFSET);
|
||||||
var upVector = Quat.getUp(properties.rotation);
|
var upVector = Quat.getUp(properties.rotation);
|
||||||
var upOffset = Vec3.multiply(upVector, GUN_TIP_UP_OFFSET);
|
var upOffset = Vec3.multiply(upVector, GUN_TIP_UP_OFFSET);
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
var gunProps = Entities.getEntityProperties(this.entityID, ['position', 'rotation']);
|
var gunProps = Entities.getEntityProperties(this.entityID, ['position', 'rotation']);
|
||||||
this.position = gunProps.position;
|
this.position = gunProps.position;
|
||||||
this.rotation = gunProps.rotation;
|
this.rotation = gunProps.rotation;
|
||||||
this.firingDirection = Quat.getFront(this.rotation);
|
this.firingDirection = Quat.getForward(this.rotation);
|
||||||
var upVec = Quat.getUp(this.rotation);
|
var upVec = Quat.getUp(this.rotation);
|
||||||
this.barrelPoint = Vec3.sum(this.position, Vec3.multiply(upVec, this.laserOffsets.y));
|
this.barrelPoint = Vec3.sum(this.position, Vec3.multiply(upVec, this.laserOffsets.y));
|
||||||
this.laserTip = Vec3.sum(this.barrelPoint, Vec3.multiply(this.firingDirection, this.laserLength));
|
this.laserTip = Vec3.sum(this.barrelPoint, Vec3.multiply(this.firingDirection, this.laserLength));
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
var SCRIPT_URL = Script.resolvePath("./entity_scripts/magneticBlock.js");
|
var SCRIPT_URL = Script.resolvePath("./entity_scripts/magneticBlock.js");
|
||||||
|
|
||||||
var frontVector = Quat.getFront(MyAvatar.orientation);
|
var frontVector = Quat.getForward(MyAvatar.orientation);
|
||||||
frontVector.y += VERTICAL_OFFSET;
|
frontVector.y += VERTICAL_OFFSET;
|
||||||
for (var x = 0; x < COLUMNS; x++) {
|
for (var x = 0; x < COLUMNS; x++) {
|
||||||
for (var y = 0; y < ROWS; y++) {
|
for (var y = 0; y < ROWS; y++) {
|
||||||
|
|
Loading…
Reference in a new issue