mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 20:22:27 +02:00
change variable names that use Quat.getForward
This commit is contained in:
parent
2515563a0b
commit
2d1ca99e2e
7 changed files with 25 additions and 26 deletions
|
@ -25,9 +25,9 @@ var prevThumbDown = false;
|
|||
|
||||
function init() {
|
||||
boxPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getForward(Camera.getOrientation())));
|
||||
var front = Quat.getForward(Camera.getOrientation());
|
||||
boxZAxis = Vec3.normalize(Vec3.cross(front, Y_AXIS));
|
||||
boxYAxis = Vec3.normalize(Vec3.cross(boxZAxis, front));
|
||||
var forward = Quat.getForward(Camera.getOrientation());
|
||||
boxZAxis = Vec3.normalize(Vec3.cross(forward, Y_AXIS));
|
||||
boxYAxis = Vec3.normalize(Vec3.cross(boxZAxis, forward));
|
||||
|
||||
boxEntity = Entities.addEntity({
|
||||
type: "Box",
|
||||
|
|
|
@ -8,12 +8,11 @@
|
|||
var PhotoBooth = {};
|
||||
PhotoBooth.init = function () {
|
||||
var success = Clipboard.importEntities(PHOTOBOOTH_SETUP_JSON_URL);
|
||||
var frontFactor = 10;
|
||||
var frontUnitVec = Vec3.normalize(Quat.getForward(MyAvatar.orientation));
|
||||
var frontOffset = Vec3.multiply(frontUnitVec,frontFactor);
|
||||
var forwardFactor = 10;
|
||||
var forwardUnitVector = Vec3.normalize(Quat.getForward(MyAvatar.orientation));
|
||||
var forwardOffset = Vec3.multiply(forwardUnitVector,forwardFactor);
|
||||
var rightFactor = 3;
|
||||
var rightUnitVec = Vec3.normalize(Quat.getRight(MyAvatar.orientation));
|
||||
var spawnLocation = Vec3.sum(Vec3.sum(MyAvatar.position,frontOffset),rightFactor);
|
||||
var spawnLocation = Vec3.sum(Vec3.sum(MyAvatar.position,forwardOffset),rightFactor);
|
||||
if (success) {
|
||||
this.pastedEntityIDs = Clipboard.pasteEntities(spawnLocation);
|
||||
this.processPastedEntities();
|
||||
|
|
|
@ -87,8 +87,8 @@ function moveCloserToCamera(positionAtHUD) {
|
|||
// we don't actually want to render at the slerped look at... instead, we want to render
|
||||
// slightly closer to the camera than that.
|
||||
var MOVE_CLOSER_TO_CAMERA_BY = -0.25;
|
||||
var cameraFront = Quat.getForward(Camera.orientation);
|
||||
var closerToCamera = Vec3.multiply(cameraFront, MOVE_CLOSER_TO_CAMERA_BY); // slightly closer to camera
|
||||
var cameraForward = Quat.getForward(Camera.orientation);
|
||||
var closerToCamera = Vec3.multiply(cameraForward, MOVE_CLOSER_TO_CAMERA_BY); // slightly closer to camera
|
||||
var slightlyCloserPosition = Vec3.sum(positionAtHUD, closerToCamera);
|
||||
|
||||
return slightlyCloserPosition;
|
||||
|
|
|
@ -78,9 +78,9 @@ function calcSpawnInfo(hand, height) {
|
|||
rotation: lookAtRot
|
||||
};
|
||||
} else {
|
||||
var front = Quat.getForward(headRot);
|
||||
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 forward = Quat.getForward(headRot);
|
||||
finalPosition = Vec3.sum(headPos, Vec3.multiply(0.6, forward));
|
||||
var orientation = Quat.lookAt({x: 0, y: 0, z: 0}, forward, {x: 0, y: 1, z: 0});
|
||||
return {
|
||||
position: finalPosition,
|
||||
rotation: Quat.multiply(orientation, {x: 0, y: 1, z: 0, w: 0})
|
||||
|
|
|
@ -298,7 +298,7 @@ function populateUserList(selectData, oldAudioData) {
|
|||
verticalHalfAngle = filter && (frustum.fieldOfView / 2),
|
||||
horizontalHalfAngle = filter && (verticalHalfAngle * frustum.aspectRatio),
|
||||
orientation = filter && Camera.orientation,
|
||||
front = filter && Quat.getForward(orientation),
|
||||
forward = filter && Quat.getForward(orientation),
|
||||
verticalAngleNormal = filter && Quat.getRight(orientation),
|
||||
horizontalAngleNormal = filter && Quat.getUp(orientation);
|
||||
avatars.forEach(function (id) { // sorting the identifiers is just an aid for debugging
|
||||
|
@ -316,8 +316,8 @@ function populateUserList(selectData, oldAudioData) {
|
|||
return;
|
||||
}
|
||||
var normal = id && filter && Vec3.normalize(Vec3.subtract(avatar.position, myPosition));
|
||||
var horizontal = normal && angleBetweenVectorsInPlane(normal, front, horizontalAngleNormal);
|
||||
var vertical = normal && angleBetweenVectorsInPlane(normal, front, verticalAngleNormal);
|
||||
var horizontal = normal && angleBetweenVectorsInPlane(normal, forward, horizontalAngleNormal);
|
||||
var vertical = normal && angleBetweenVectorsInPlane(normal, forward, verticalAngleNormal);
|
||||
if (id && filter && ((Math.abs(horizontal) > horizontalHalfAngle) || (Math.abs(vertical) > verticalHalfAngle))) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -94,9 +94,9 @@
|
|||
},
|
||||
|
||||
shootBall: function(gunProperties) {
|
||||
var forwardVec = Quat.getForward(Quat.multiply(gunProperties.rotation, Quat.fromPitchYawRollDegrees(0, 180, 0)));
|
||||
forwardVec = Vec3.normalize(forwardVec);
|
||||
forwardVec = Vec3.multiply(forwardVec, GUN_FORCE);
|
||||
var forwardVector = Quat.getForward(Quat.multiply(gunProperties.rotation, Quat.fromPitchYawRollDegrees(0, 180, 0)));
|
||||
forwardVector = Vec3.normalize(forwardVector);
|
||||
forwardVector = Vec3.multiply(forwardVector, GUN_FORCE);
|
||||
|
||||
var properties = {
|
||||
name: 'Tutorial Ping Pong Ball',
|
||||
|
@ -111,7 +111,7 @@
|
|||
rotation: gunProperties.rotation,
|
||||
position: this.getGunTipPosition(gunProperties),
|
||||
gravity: PING_PONG_GUN_GRAVITY,
|
||||
velocity: forwardVec,
|
||||
velocity: forwardVector,
|
||||
lifetime: 10
|
||||
};
|
||||
|
||||
|
@ -131,12 +131,12 @@
|
|||
|
||||
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
|
||||
var frontVector = Quat.getForward(properties.rotation);
|
||||
var frontOffset = Vec3.multiply(frontVector, GUN_TIP_FWD_OFFSET);
|
||||
var forwardVector = Quat.getForward(properties.rotation);
|
||||
var forwardOffset = Vec3.multiply(forwardVector, GUN_TIP_FWD_OFFSET);
|
||||
var upVector = Quat.getUp(properties.rotation);
|
||||
var upOffset = Vec3.multiply(upVector, GUN_TIP_UP_OFFSET);
|
||||
|
||||
var gunTipPosition = Vec3.sum(properties.position, frontOffset);
|
||||
var gunTipPosition = Vec3.sum(properties.position, forwardOffset);
|
||||
gunTipPosition = Vec3.sum(gunTipPosition, upOffset);
|
||||
|
||||
return gunTipPosition;
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
|
||||
var SCRIPT_URL = Script.resolvePath("./entity_scripts/magneticBlock.js");
|
||||
|
||||
var frontVector = Quat.getForward(MyAvatar.orientation);
|
||||
frontVector.y += VERTICAL_OFFSET;
|
||||
var forwardVector = Quat.getForward(MyAvatar.orientation);
|
||||
forwardVector.y += VERTICAL_OFFSET;
|
||||
for (var x = 0; x < COLUMNS; x++) {
|
||||
for (var y = 0; y < ROWS; y++) {
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
cloneLimit: 9999
|
||||
}
|
||||
}),
|
||||
position: Vec3.sum(MyAvatar.position, Vec3.sum(frontOffset, frontVector)),
|
||||
position: Vec3.sum(MyAvatar.position, Vec3.sum(forwardOffset, forwardVector)),
|
||||
color: newColor(),
|
||||
script: SCRIPT_URL
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue