Fix paint surface always facing the HMD instead of rotating with the

brush/hand;
This commit is contained in:
Artur Gomes 2017-08-01 10:50:09 +01:00
parent 1f5be31326
commit f17221301a

View file

@ -78,7 +78,11 @@
MAX_POINTS_PER_LINE = 70; // Hard-coded limit in PolyLineEntityItem.h. MAX_POINTS_PER_LINE = 70; // Hard-coded limit in PolyLineEntityItem.h.
function strokeNormal() { function strokeNormal() {
return Vec3.multiplyQbyV(Camera.getOrientation(), Vec3.UNIT_NEG_Z); var controllerPose = isLeftHandDominant
? getControllerWorldLocation(Controller.Standard.LeftHand, true)
: getControllerWorldLocation(Controller.Standard.RightHand, true);
var fingerTipRotation = controllerPose.rotation;
return Quat.getUp(fingerTipRotation);
} }
function changeStrokeColor(red, green, blue) { function changeStrokeColor(red, green, blue) {
@ -564,7 +568,6 @@
} }
updateTriggerPress(); updateTriggerPress();
updateGripPress(); updateGripPress();
} }
function setUp(onTriggerPressed, onTriggerPressing, onTriggerReleased, onGripPressed) { function setUp(onTriggerPressed, onTriggerPressing, onTriggerReleased, onGripPressed) {