mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
simplify valid check for rotation
This commit is contained in:
parent
956078bc91
commit
2360e90d39
1 changed files with 6 additions and 16 deletions
|
@ -234,17 +234,12 @@ function Teleporter() {
|
||||||
this.rightRay = function() {
|
this.rightRay = function() {
|
||||||
var pose = Controller.getPoseValue(Controller.Standard.RightHand);
|
var pose = Controller.getPoseValue(Controller.Standard.RightHand);
|
||||||
var rightPosition = pose.valid ? Vec3.sum(Vec3.multiplyQbyV(MyAvatar.orientation, pose.translation), MyAvatar.position) : MyAvatar.getHeadPosition();
|
var rightPosition = pose.valid ? Vec3.sum(Vec3.multiplyQbyV(MyAvatar.orientation, pose.translation), MyAvatar.position) : MyAvatar.getHeadPosition();
|
||||||
var rightRotation = pose.valid ? Quat.multiply(MyAvatar.orientation, pose.rotation) : MyAvatar.headOrientation;
|
var rightRotation = pose.valid ? Quat.multiply(MyAvatar.orientation, pose.rotation) :
|
||||||
|
Quat.multiply(MyAvatar.headOrientation, Quat.angleAxis(-90, {x: 1, y: 0, z: 0}));
|
||||||
var rightFinal = Quat.multiply(rightRotation, Quat.angleAxis(-90, {
|
|
||||||
x: 1,
|
|
||||||
y: 0,
|
|
||||||
z: 0
|
|
||||||
}));
|
|
||||||
|
|
||||||
var rightPickRay = {
|
var rightPickRay = {
|
||||||
origin: rightPosition,
|
origin: rightPosition,
|
||||||
direction: Quat.getUp(pose.valid ? rightRotation : rightFinal),
|
direction: Quat.getUp(rightRotation),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.rightPickRay = rightPickRay;
|
this.rightPickRay = rightPickRay;
|
||||||
|
@ -287,17 +282,12 @@ function Teleporter() {
|
||||||
this.leftRay = function() {
|
this.leftRay = function() {
|
||||||
var pose = Controller.getPoseValue(Controller.Standard.LeftHand);
|
var pose = Controller.getPoseValue(Controller.Standard.LeftHand);
|
||||||
var leftPosition = pose.valid ? Vec3.sum(Vec3.multiplyQbyV(MyAvatar.orientation, pose.translation), MyAvatar.position) : MyAvatar.getHeadPosition();
|
var leftPosition = pose.valid ? Vec3.sum(Vec3.multiplyQbyV(MyAvatar.orientation, pose.translation), MyAvatar.position) : MyAvatar.getHeadPosition();
|
||||||
var leftRotation = pose.valid ? Quat.multiply(MyAvatar.orientation, pose.rotation) : MyAvatar.headOrientation;
|
var leftRotation = pose.valid ? Quat.multiply(MyAvatar.orientation, pose.rotation) :
|
||||||
|
Quat.multiply(MyAvatar.headOrientation, Quat.angleAxis(-90, {x: 1, y: 0, z: 0}));
|
||||||
var leftFinal = Quat.multiply(leftRotation, Quat.angleAxis(-90, {
|
|
||||||
x: 1,
|
|
||||||
y: 0,
|
|
||||||
z: 0
|
|
||||||
}));
|
|
||||||
|
|
||||||
var leftPickRay = {
|
var leftPickRay = {
|
||||||
origin: leftPosition,
|
origin: leftPosition,
|
||||||
direction: Quat.getUp(pose.valid ? leftRotation : leftFinal),
|
direction: Quat.getUp(leftRotation),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.leftPickRay = leftPickRay;
|
this.leftPickRay = leftPickRay;
|
||||||
|
|
Loading…
Reference in a new issue