distance grab works better with hmd on

This commit is contained in:
Seth Alves 2015-11-02 14:42:28 -08:00
parent 5a93516330
commit 181901ed19

View file

@ -446,7 +446,7 @@ function MyController(hand) {
this.currentObjectPosition = grabbedProperties.position; this.currentObjectPosition = grabbedProperties.position;
this.currentObjectRotation = grabbedProperties.rotation; this.currentObjectRotation = grabbedProperties.rotation;
this.currentObjectTime = now; this.currentObjectTime = now;
this.handPreviousPosition = handControllerPosition; this.handRelativePreviousPosition = Vec3.subtract(handControllerPosition, MyAvatar.position);
this.handPreviousRotation = handRotation; this.handPreviousRotation = handRotation;
this.actionID = NULL_ACTION_ID; this.actionID = NULL_ACTION_ID;
@ -523,11 +523,10 @@ function MyController(hand) {
this.currentAvatarOrientation = currentOrientation; this.currentAvatarOrientation = currentOrientation;
// how far did hand move this timestep? // how far did hand move this timestep?
var handMoved = Vec3.subtract(handControllerPosition, this.handPreviousPosition); var handMoved = Vec3.subtract(handToAvatar, this.handRelativePreviousPosition);
this.handPreviousPosition = handControllerPosition; this.handRelativePreviousPosition = handToAvatar;
// magnify the hand movement but not the change from avatar movement & rotation // magnify the hand movement but not the change from avatar movement & rotation
handMoved = Vec3.subtract(handMoved, avatarDeltaPosition);
handMoved = Vec3.subtract(handMoved, handMovementFromTurning); handMoved = Vec3.subtract(handMoved, handMovementFromTurning);
var superHandMoved = Vec3.multiply(handMoved, radius); var superHandMoved = Vec3.multiply(handMoved, radius);