This commit is contained in:
James B. Pollack 2015-11-05 14:29:58 -08:00
parent 87503ca4c6
commit 31b540ca38
2 changed files with 25 additions and 20 deletions

View file

@ -170,7 +170,7 @@
}, },
collisionWithEntity: function(me, otherEntity, collision) { collisionWithEntity: function(me, otherEntity, collision) {
print('ARROW HAD COLLISION')
if (this.stickOnCollision === true) { if (this.stickOnCollision === true) {
Vec3.print('penetration = ', collision.penetration); Vec3.print('penetration = ', collision.penetration);
Vec3.print('collision contact point = ', collision.contactPoint); Vec3.print('collision contact point = ', collision.contactPoint);

View file

@ -368,6 +368,7 @@
} }
this.triggerValue = Controller.getActionValue(this.stringTriggerAction); this.triggerValue = Controller.getActionValue(this.stringTriggerAction);
// print('TRIGGER VALUE:::' + this.triggerValue)
if (this.triggerValue < DRAW_STRING_THRESHOLD && this.stringDrawn === true) { if (this.triggerValue < DRAW_STRING_THRESHOLD && this.stringDrawn === true) {
@ -379,11 +380,11 @@
// this.releaseArrow(); // this.releaseArrow();
} else if (this.triggerValue >= DRAW_STRING_THRESHOLD && this.stringDrawn === true) { } else if (this.triggerValue >= DRAW_STRING_THRESHOLD && this.stringDrawn === true) {
print('HIT CONTINUE LOOP IN CHECK') // print('HIT CONTINUE LOOP IN CHECK')
//continuing to aim the arrow //continuing to aim the arrow
this.stringData.handPosition = this.getStringHandPosition(); this.stringData.handPosition = this.getStringHandPosition();
this.stringData.handRotation = this.getStringHandRotation(); this.stringData.handRotation = this.getStringHandRotation();
this.initialHand === 'right' ? this.stringData.grabHandPosition = Controller.getSpatialControlPosition(RIGHT_TIP) : this.stringData.grabHandPosition = Controller.getSpatialControlPosition(LEFT_TIP); this.stringData.grabHandPosition = this.getGrabHandPosition();
this.stringData.grabHandRotation = this.getGrabHandRotation(); this.stringData.grabHandRotation = this.getGrabHandRotation();
this.drawStrings(); this.drawStrings();
this.updateArrowPositionInNotch(); this.updateArrowPositionInNotch();
@ -395,7 +396,8 @@
this.createStrings(); this.createStrings();
this.stringData.handPosition = this.getStringHandPosition(); this.stringData.handPosition = this.getStringHandPosition();
this.stringData.handRotation = this.getStringHandRotation(); this.stringData.handRotation = this.getStringHandRotation();
this.initialHand === 'right' ? this.stringData.grabHandPosition = Controller.getSpatialControlPosition(RIGHT_TIP) : this.stringData.grabHandPosition = Controller.getSpatialControlPosition(LEFT_TIP); this.stringData.grabHandPosition = this.getGrabHandPosition();
this.stringData.grabHandRotation = this.getGrabHandRotation(); this.stringData.grabHandRotation = this.getGrabHandRotation();
this.drawStrings(); this.drawStrings();
@ -436,33 +438,36 @@
updateArrowPositionInNotch: function() { updateArrowPositionInNotch: function() {
//move it backwards //move it backwards
var handToNotch = Vec3.subtract(this.stringData.handPosition, this.notchDetectorPosition); var handToNotch = Vec3.subtract(this.stringData.handPosition, this.notchDetectorPosition);
var pullBackDistance = Vec3.length(handToNotch); // var pullBackDistance = Vec3.length(handToNotch);
if (pullBackDistance >= 0.6) { // if (pullBackDistance >= 0.6) {
pullBackDistance = 0.6; // pullBackDistance = 0.6;
} // }
var pullBackOffset = Vec3.multiply(handToNotch, pullBackDistance); // var pullBackOffset = Vec3.multiply(handToNotch, pullBackDistance);
var arrowPosition = Vec3.sum(this.notchDetectorPosition, pullBackOffset); // var arrowPosition = Vec3.sum(this.notchDetectorPosition, pullBackOffset);
var pushForwardOffset = Vec3.multiply(handToNotch, ARROW_OFFSET); // var pushForwardOffset = Vec3.multiply(handToNotch, ARROW_OFFSET);
var finalArrowPosition = Vec3.sum(arrowPosition, pushForwardOffset); // var finalArrowPosition = Vec3.sum(arrowPosition, pushForwardOffset);
var arrowRotation = this.orientationOf(handToNotch); var arrowRotation = this.orientationOf(handToNotch);
print('ARROW ROTATION:: ' + JSON.stringify(arrowRotation));
Entities.editEntity(this.arrow, { Entities.editEntity(this.arrow, {
position: finalArrowPosition, position: this.notchDetectorPosition,
rotation: arrowRotation rotation: arrowRotation
}) })
if (this.arrowIsBurning === true) { var currentRotation = Entities.getEntityProperties(this.arrow,"rotation").rotation
Entities.editEntity(this.fire, { print('ACTUAL ARROW ROTATION::' +JSON.stringify(currentRotation));
position: arrowTipPosition
}); print('DIFFERENCE::: '+(1-Quat.dot(arrowRotation,currentRotation)));
} // if (this.arrowIsBurning === true) {
// Entities.editEntity(this.fire, {
// position: arrowTipPosition
// });
// }
}, },