mirror of
https://github.com/lubosz/overte.git
synced 2025-08-13 09:12:35 +02:00
Merge pull request #8869 from hyperlogic/bug-fix/edit-picking-with-hand-controllers
edit.js: Fix for picking and manipulating objects via hand controllers.
This commit is contained in:
commit
ca0d6587b5
1 changed files with 5 additions and 4 deletions
|
@ -16,6 +16,8 @@ HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
SPACE_LOCAL = "local";
|
SPACE_LOCAL = "local";
|
||||||
SPACE_WORLD = "world";
|
SPACE_WORLD = "world";
|
||||||
|
|
||||||
|
Script.include("./controllers.js");
|
||||||
|
|
||||||
function objectTranslationPlanePoint(position, dimensions) {
|
function objectTranslationPlanePoint(position, dimensions) {
|
||||||
var newPosition = { x: position.x, y: position.y, z: position.z };
|
var newPosition = { x: position.x, y: position.y, z: position.z };
|
||||||
newPosition.y -= dimensions.y / 2.0;
|
newPosition.y -= dimensions.y / 2.0;
|
||||||
|
@ -1046,12 +1048,11 @@ SelectionDisplay = (function() {
|
||||||
that.triggerMapping.from(Controller.Standard.RT).peek().to(makeTriggerHandler(Controller.Standard.RightHand));
|
that.triggerMapping.from(Controller.Standard.RT).peek().to(makeTriggerHandler(Controller.Standard.RightHand));
|
||||||
that.triggerMapping.from(Controller.Standard.LT).peek().to(makeTriggerHandler(Controller.Standard.LeftHand));
|
that.triggerMapping.from(Controller.Standard.LT).peek().to(makeTriggerHandler(Controller.Standard.LeftHand));
|
||||||
function controllerComputePickRay() {
|
function controllerComputePickRay() {
|
||||||
var controllerPose = Controller.getPoseValue(activeHand);
|
var controllerPose = getControllerWorldLocation(activeHand, true);
|
||||||
if (controllerPose.valid && that.triggered) {
|
if (controllerPose.valid && that.triggered) {
|
||||||
var controllerPosition = Vec3.sum(Vec3.multiplyQbyV(MyAvatar.orientation, controllerPose.translation),
|
var controllerPosition = controllerPose.translation;
|
||||||
MyAvatar.position);
|
|
||||||
// This gets point direction right, but if you want general quaternion it would be more complicated:
|
// This gets point direction right, but if you want general quaternion it would be more complicated:
|
||||||
var controllerDirection = Quat.getUp(Quat.multiply(MyAvatar.orientation, controllerPose.rotation));
|
var controllerDirection = Quat.getUp(controllerPose.rotation);
|
||||||
return {origin: controllerPosition, direction: controllerDirection};
|
return {origin: controllerPosition, direction: controllerDirection};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue