Fixing typos.

This commit is contained in:
r3tk0n 2019-02-25 13:47:31 -08:00
parent 5d3a778b0b
commit a66c76bf38

View file

@ -146,7 +146,7 @@ Script.include("/~/system/libraries/controllers.js");
Messages.sendLocalMessage('Hifi-unhighlight-entity', JSON.stringify(message)); Messages.sendLocalMessage('Hifi-unhighlight-entity', JSON.stringify(message));
var newTargetPosLocal = MyAvatar.worldToJointPoint(targetProps.position); var newTargetPosLocal = MyAvatar.worldToJointPoint(targetProps.position);
var newTargetRotLocal = this.targetProps.rotation; var newTargetRotLocal = targetProps.rotation;
if (this.shouldManipulateTarget()) { if (this.shouldManipulateTarget()) {
var rotBetween = this.calculateEntityRotationManipulation(worldControllerRotation); var rotBetween = this.calculateEntityRotationManipulation(worldControllerRotation);
var newTargetRotLocal = Quat.multiply(rotBetween, newTargetRotLocal); var newTargetRotLocal = Quat.multiply(rotBetween, newTargetRotLocal);
@ -243,6 +243,7 @@ Script.include("/~/system/libraries/controllers.js");
var newTargetPosLocal = MyAvatar.worldToJointPoint(newTargetPosition); var newTargetPosLocal = MyAvatar.worldToJointPoint(newTargetPosition);
var newTargetRotLocal = this.initialEntityRotation; var newTargetRotLocal = this.initialEntityRotation;
if (this.shouldManipulateTarget()) { if (this.shouldManipulateTarget()) {
print("Test this thing.");
var rotBetween = this.calculateEntityRotationManipulation(worldControllerRotation); var rotBetween = this.calculateEntityRotationManipulation(worldControllerRotation);
var newTargetRotLocal = Quat.multiply(rotBetween, newTargetRotLocal); var newTargetRotLocal = Quat.multiply(rotBetween, newTargetRotLocal);
} }
@ -272,7 +273,8 @@ Script.include("/~/system/libraries/controllers.js");
this.grabbing = false; this.grabbing = false;
this.potentialEntityWithContextOverlay = false; this.potentialEntityWithContextOverlay = false;
MyAvatar.clearJointData(FAR_GRAB_JOINTS[this.hand]); // RKNOTE: Here, we should edit the entity's position and rotation data with the current joint rotation data. MyAvatar.clearJointData(FAR_GRAB_JOINTS[this.hand]); // RKNOTE: Here, we should edit the entity's position and rotation data with the current joint rotation data.
this.setTargetRotation(this.lastFarGrabJointRotation); this.setTargetRotation(Quat.multiply(this.lastFarGrabJointRotation, this.initialEntityRotation));
this.initialEntityRotation = Quat.IDENTITY;
this.targetEntityID = null; this.targetEntityID = null;
}; };
@ -386,19 +388,19 @@ Script.include("/~/system/libraries/controllers.js");
this.setLeftGrip = function (value) { this.setLeftGrip = function (value) {
this.leftGrip = value; this.leftGrip = value;
} };
this.setRightGrip = function (value) { this.setRightGrip = function (value) {
this.rightGrip = value; this.rightGrip = value;
} };
this.getDominantGrip = function () { this.getDominantGrip = function () {
return (MyAvatar.getDominantHand() === "left" ? (_this.leftGrip) : (_this.rightGrip)); return (MyAvatar.getDominantHand() === "left" ? (_this.leftGrip) : (_this.rightGrip));
} };
this.getOffhandGrip = function () { this.getOffhandGrip = function () {
return (MyAvatar.getDominantHand() === "left" ? (_this.rightGrip) : (_this.leftGrip)); return (MyAvatar.getDominantHand() === "left" ? (_this.rightGrip) : (_this.leftGrip));
} };
this.shouldShowLaser = function () { this.shouldShowLaser = function () {
return (_this.getOffHandTrigger() > TRIGGER_ON_VALUE) ? true : false; return (_this.getOffHandTrigger() > TRIGGER_ON_VALUE) ? true : false;
@ -454,8 +456,7 @@ Script.include("/~/system/libraries/controllers.js");
print("Fargrab Error: No target to edit position."); print("Fargrab Error: No target to edit position.");
return; return;
} else { } else {
var props; var props = { position: newPos };
props.position = newPos;
Entities.editEntity(this.targetEntityID, props); Entities.editEntity(this.targetEntityID, props);
} }
}; };
@ -465,25 +466,24 @@ Script.include("/~/system/libraries/controllers.js");
print("Fargrab Error: No target to edit rotation."); print("Fargrab Error: No target to edit rotation.");
return; return;
} else { } else {
var props; var props = { rotation: newRot };
props.rotation = newRot; Entities.editEntity(this.targetEntityID, props);
Entitis.editEntity(this.targetEntityID, props);
} }
}; };
this.shouldManipulateTarget = function () { this.shouldManipulateTarget = function () {
return (this.getDominantGrip() > TRIGGER_ON_VALUE); return (this.getDominantGrip() > TRIGGER_ON_VALUE);
} };
this.calculateEntityRotationManipulation = function (controllerRotation) { this.calculateEntityRotationManipulation = function (controllerRotation) {
return Quat.multiply(controllerRotation, Quat.inverse(this.initialControllerRotation)); return Quat.multiply(controllerRotation, Quat.inverse(this.initialControllerRotation));
} };
this.setJointTranslation(newTargetPosLocal) { this.setJointTranslation = function (newTargetPosLocal) {
MyAvatar.setJointTranslation(FAR_GRAB_JOINTS[this.hand], newTargetPosLocal); MyAvatar.setJointTranslation(FAR_GRAB_JOINTS[this.hand], newTargetPosLocal);
}; };
this.setJointRotation(newTargetRotLocal) { this.setJointRotation = function (newTargetRotLocal) {
this.lastFarGrabJointRotation = newTargetRotLocal; this.lastFarGrabJointRotation = newTargetRotLocal;
MyAvatar.setJointRotation(FAR_GRAB_JOINTS[this.hand], newTargetRotLocal); MyAvatar.setJointRotation(FAR_GRAB_JOINTS[this.hand], newTargetRotLocal);
}; };