mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 03:53:10 +02:00
fix edit log spam with -1 hand
This commit is contained in:
parent
2013f1bd33
commit
0565e0400c
1 changed files with 26 additions and 22 deletions
|
@ -38,30 +38,34 @@ getGrabPointSphereOffset = function(handController, ignoreSensorToWorldScale) {
|
||||||
getControllerWorldLocation = function (handController, doOffset) {
|
getControllerWorldLocation = function (handController, doOffset) {
|
||||||
var orientation;
|
var orientation;
|
||||||
var position;
|
var position;
|
||||||
var pose = Controller.getPoseValue(handController);
|
var valid = false;
|
||||||
var valid = pose.valid;
|
|
||||||
var controllerJointIndex;
|
if (handController >= 0) {
|
||||||
if (pose.valid) {
|
var pose = Controller.getPoseValue(handController);
|
||||||
if (handController === Controller.Standard.RightHand) {
|
valid = pose.valid;
|
||||||
controllerJointIndex = MyAvatar.getJointIndex("_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND");
|
var controllerJointIndex;
|
||||||
} else {
|
if (pose.valid) {
|
||||||
controllerJointIndex = MyAvatar.getJointIndex("_CAMERA_RELATIVE_CONTROLLER_LEFTHAND");
|
if (handController === Controller.Standard.RightHand) {
|
||||||
}
|
controllerJointIndex = MyAvatar.getJointIndex("_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND");
|
||||||
orientation = Quat.multiply(MyAvatar.orientation, MyAvatar.getAbsoluteJointRotationInObjectFrame(controllerJointIndex));
|
} else {
|
||||||
position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, MyAvatar.getAbsoluteJointTranslationInObjectFrame(controllerJointIndex)));
|
controllerJointIndex = MyAvatar.getJointIndex("_CAMERA_RELATIVE_CONTROLLER_LEFTHAND");
|
||||||
|
}
|
||||||
|
orientation = Quat.multiply(MyAvatar.orientation, MyAvatar.getAbsoluteJointRotationInObjectFrame(controllerJointIndex));
|
||||||
|
position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, MyAvatar.getAbsoluteJointTranslationInObjectFrame(controllerJointIndex)));
|
||||||
|
|
||||||
// add to the real position so the grab-point is out in front of the hand, a bit
|
// add to the real position so the grab-point is out in front of the hand, a bit
|
||||||
if (doOffset) {
|
if (doOffset) {
|
||||||
var offset = getGrabPointSphereOffset(handController);
|
var offset = getGrabPointSphereOffset(handController);
|
||||||
position = Vec3.sum(position, Vec3.multiplyQbyV(orientation, offset));
|
position = Vec3.sum(position, Vec3.multiplyQbyV(orientation, offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!HMD.isHandControllerAvailable()) {
|
} else if (!HMD.isHandControllerAvailable()) {
|
||||||
// NOTE: keep this offset in sync with scripts/system/controllers/handControllerPointer.js:493
|
// NOTE: keep this offset in sync with scripts/system/controllers/handControllerPointer.js:493
|
||||||
var VERTICAL_HEAD_LASER_OFFSET = 0.1 * MyAvatar.sensorToWorldScale;
|
var VERTICAL_HEAD_LASER_OFFSET = 0.1 * MyAvatar.sensorToWorldScale;
|
||||||
position = Vec3.sum(Camera.position, Vec3.multiplyQbyV(Camera.orientation, {x: 0, y: VERTICAL_HEAD_LASER_OFFSET, z: 0}));
|
position = Vec3.sum(Camera.position, Vec3.multiplyQbyV(Camera.orientation, {x: 0, y: VERTICAL_HEAD_LASER_OFFSET, z: 0}));
|
||||||
orientation = Quat.multiply(Camera.orientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 }));
|
orientation = Quat.multiply(Camera.orientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 }));
|
||||||
valid = true;
|
valid = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {position: position,
|
return {position: position,
|
||||||
|
|
Loading…
Reference in a new issue