mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 05:52:38 +02:00
use head pose for controller in case there are no hand controllers available
This commit is contained in:
parent
c50cd865e5
commit
c082c74cc0
2 changed files with 8 additions and 2 deletions
|
@ -204,7 +204,7 @@ function overlayFromWorldPoint(point) {
|
|||
}
|
||||
|
||||
function activeHudPoint2d(activeHand) { // if controller is valid, update reticle position and answer 2d point. Otherwise falsey.
|
||||
var controllerPose = getControllerWorldLocation(activeHand, true);
|
||||
var controllerPose = getControllerWorldLocation(activeHand, true); // note: this will use head pose of hand pose is invalid (third eye)
|
||||
if (!controllerPose.valid) {
|
||||
return; // Controller is cradled.
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ getControllerWorldLocation = function (handController, doOffset) {
|
|||
var orientation;
|
||||
var position;
|
||||
var pose = Controller.getPoseValue(handController);
|
||||
var valid = pose.valid;
|
||||
if (pose.valid) {
|
||||
orientation = Quat.multiply(MyAvatar.orientation, pose.rotation);
|
||||
position = Vec3.sum(Vec3.multiplyQbyV(MyAvatar.orientation, pose.translation), MyAvatar.position);
|
||||
|
@ -46,10 +47,15 @@ getControllerWorldLocation = function (handController, doOffset) {
|
|||
if (doOffset) {
|
||||
position = Vec3.sum(position, Vec3.multiplyQbyV(orientation, getGrabPointSphereOffset(handController)));
|
||||
}
|
||||
} else if (!HMD.isHandControllerAvailable()){
|
||||
position = MyAvatar.getHeadPosition();
|
||||
orientation = Quat.multiply(MyAvatar.headOrientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 }));
|
||||
valid = true;
|
||||
}
|
||||
|
||||
return {position: position,
|
||||
translation: position,
|
||||
orientation: orientation,
|
||||
rotation: orientation,
|
||||
valid: pose.valid};
|
||||
valid: valid};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue