mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 15:34:47 +02:00
bow work
This commit is contained in:
parent
c0cb8b542e
commit
fb5b600211
2 changed files with 233 additions and 157 deletions
|
@ -66,8 +66,6 @@
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
createGlowBox: function() {
|
createGlowBox: function() {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
// notching system
|
// notching system
|
||||||
// make arrows more visible
|
// make arrows more visible
|
||||||
// make arrow rotate toward ground as it flies
|
// make arrow rotate toward ground as it flies
|
||||||
// different model? compound bow will look better in the HMD, and be easier to aim. this is what HTC uses in the longbow demo: http://www.turbosquid.com/3d-models/3d-model-bow-arrow/773106
|
// different model? compound bow will look better in the HMD, and be easier to aim. http://www.turbosquid.com/3d-models/3d-model-bow-arrow/773106
|
||||||
// add noise when you release arrow -> add the sound to the arrow and keep it with position so you hear it whizz by
|
// add noise when you release arrow -> add the sound to the arrow and keep it with position so you hear it whizz by
|
||||||
// add noise when you draw string
|
// add noise when you draw string
|
||||||
// re-enable arrows sticking when they hit
|
// re-enable arrows sticking when they hit
|
||||||
|
@ -53,6 +53,8 @@
|
||||||
z: 0
|
z: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var ARROW_TIP_OFFSET = 0.32;
|
||||||
|
|
||||||
var TOP_NOTCH_OFFSET = 0.5;
|
var TOP_NOTCH_OFFSET = 0.5;
|
||||||
var BOTTOM_NOTCH_OFFSET = 0.5;
|
var BOTTOM_NOTCH_OFFSET = 0.5;
|
||||||
|
|
||||||
|
@ -76,24 +78,21 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var NOTCH_DETECTOR_DIMENSIONS = {
|
var NOTCH_DETECTOR_DIMENSIONS = {
|
||||||
x: 0,
|
x: 0.25,
|
||||||
y: 0,
|
y: 0.25,
|
||||||
z: 0
|
z: 0.25
|
||||||
};
|
};
|
||||||
|
|
||||||
var NOTCH_DETECTOR_DISTANCE = 0.1;
|
var NOTCH_DETECTOR_DISTANCE = 0.1;
|
||||||
|
|
||||||
var RELOAD_DETECTOR_OFFSET = {
|
var RELOAD_DETECTOR_OFFSET = 0.3;
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
z: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
var RELOAD_DETECTOR_DIMENSIONS = {
|
var RELOAD_DETECTOR_DIMENSIONS = {
|
||||||
x: 0,
|
x: 0.5,
|
||||||
y: 0,
|
y: 0.5,
|
||||||
z: 0
|
z: 0.5
|
||||||
};
|
};
|
||||||
|
|
||||||
var RELOAD_DETECTOR_DISTANCE = 0.1;
|
var RELOAD_DETECTOR_DISTANCE = 0.1;
|
||||||
|
|
||||||
var _this;
|
var _this;
|
||||||
|
@ -120,14 +119,17 @@
|
||||||
// release to fire
|
// release to fire
|
||||||
|
|
||||||
Bow.prototype = {
|
Bow.prototype = {
|
||||||
|
useNotching: true,
|
||||||
isGrabbed: false,
|
isGrabbed: false,
|
||||||
stringDrawn: false,
|
stringDrawn: false,
|
||||||
hasArrow: false,
|
hasArrow: false,
|
||||||
arrowTipPosition: null,
|
arrowTipPosition: null,
|
||||||
arrowIsBurning: false,
|
|
||||||
hasArrowLoaded: false,
|
hasArrowLoaded: false,
|
||||||
|
reloadDetector: null,
|
||||||
hasArrowNotched: false,
|
hasArrowNotched: false,
|
||||||
|
notchDetector: null,
|
||||||
arrow: null,
|
arrow: null,
|
||||||
|
arrowIsBurning: false,
|
||||||
fire: null,
|
fire: null,
|
||||||
stringData: {
|
stringData: {
|
||||||
currentColor: {
|
currentColor: {
|
||||||
|
@ -155,6 +157,139 @@
|
||||||
this.hand = 'right';
|
this.hand = 'right';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
startNearGrab: function() {
|
||||||
|
if (this.isGrabbed === true) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.isGrabbed = true;
|
||||||
|
this.initialHand = this.hand;
|
||||||
|
this.createReloadDetector();
|
||||||
|
|
||||||
|
Entities.editEntity(this.entityID, {
|
||||||
|
userData: JSON.stringify({
|
||||||
|
grabbableKey: {
|
||||||
|
turnOffOtherHand: true,
|
||||||
|
turnOffOppositeBeam: true,
|
||||||
|
invertSolidWhileHeld: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
continueNearGrab: function() {
|
||||||
|
this.bowProperties = Entities.getEntityProperties(this.entityID, ["position", "rotation"]);
|
||||||
|
if (this.notchDetector === null) {
|
||||||
|
this.createNotchDetector();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateNotchDetectorPosition();
|
||||||
|
this.updateReloadDetectorPosition();
|
||||||
|
|
||||||
|
this.checkStringHand();
|
||||||
|
|
||||||
|
if (this.useNotching === true) {
|
||||||
|
this.checkArrowHand();
|
||||||
|
|
||||||
|
if (this.hasArrowLoaded === false) {
|
||||||
|
this.updateArrowPositionPreNotch();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasArrowLoaded === true) {
|
||||||
|
this.updateNotchDetectorPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (this.hasArrowNotched === true) {
|
||||||
|
//only test for strings now that an arrow is notched
|
||||||
|
// this.checkStringHand();
|
||||||
|
//should probably draw a string straight across the bow until its notched
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
releaseGrab: function() {
|
||||||
|
if (this.isGrabbed === true && this.hand === this.initialHand) {
|
||||||
|
this.isGrabbed = false;
|
||||||
|
this.stringDrawn = false;
|
||||||
|
this.deleteStrings();
|
||||||
|
this.hasArrow = false;
|
||||||
|
Entities.deleteEntity(this.arrow);
|
||||||
|
Entities.editEntity(this.entityID, {
|
||||||
|
userData: JSON.stringify({
|
||||||
|
grabbableKey: {
|
||||||
|
turnOffOtherHand: false,
|
||||||
|
turnOffOppositeBeam: true,
|
||||||
|
invertSolidWhileHeld: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
Entities.deleteEntity(this.reloadDetector);
|
||||||
|
Entities.deleteEntity(this.notchDetector);
|
||||||
|
this.notchDetector = null;
|
||||||
|
this.reloadDetector = null;
|
||||||
|
// if(this.useNotching===true){
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
createStrings: function() {
|
||||||
|
this.createTopString();
|
||||||
|
this.createBottomString();
|
||||||
|
},
|
||||||
|
|
||||||
|
createTopString: function() {
|
||||||
|
var stringProperties = {
|
||||||
|
type: 'Line',
|
||||||
|
position: Vec3.sum(this.bowProperties.position, TOP_NOTCH_OFFSET),
|
||||||
|
dimensions: LINE_DIMENSIONS
|
||||||
|
};
|
||||||
|
|
||||||
|
this.topString = Entities.addEntity(stringProperties);
|
||||||
|
},
|
||||||
|
|
||||||
|
createBottomString: function() {
|
||||||
|
var stringProperties = {
|
||||||
|
type: 'Line',
|
||||||
|
position: Vec3.sum(this.bowProperties.position, BOTTOM_NOTCH_OFFSET),
|
||||||
|
dimensions: LINE_DIMENSIONS
|
||||||
|
};
|
||||||
|
|
||||||
|
this.bottomString = Entities.addEntity(stringProperties);
|
||||||
|
},
|
||||||
|
|
||||||
|
deleteStrings: function() {
|
||||||
|
Entities.deleteEntity(this.topString);
|
||||||
|
Entities.deleteEntity(this.bottomString);
|
||||||
|
},
|
||||||
|
|
||||||
|
updateStringPositions: function() {
|
||||||
|
|
||||||
|
var upVector = Quat.getUp(this.bowProperties.rotation);
|
||||||
|
var upOffset = Vec3.multiply(upVector, TOP_NOTCH_OFFSET);
|
||||||
|
var downVector = Vec3.multiply(-1, Quat.getUp(this.bowProperties.rotation));
|
||||||
|
var downOffset = Vec3.multiply(downVector, BOTTOM_NOTCH_OFFSET);
|
||||||
|
|
||||||
|
this.topStringPosition = Vec3.sum(this.bowProperties.position, upOffset);
|
||||||
|
this.bottomStringPosition = Vec3.sum(this.bowProperties.position, downOffset);
|
||||||
|
|
||||||
|
Entities.editEntity(this.topString, {
|
||||||
|
position: this.topStringPosition
|
||||||
|
});
|
||||||
|
|
||||||
|
Entities.editEntity(this.bottomString, {
|
||||||
|
position: this.bottomStringPosition
|
||||||
|
});
|
||||||
|
|
||||||
|
Entities.editEntity(this.preNotchString, {
|
||||||
|
position: this.topStringPosition
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
drawStrings: function() {
|
drawStrings: function() {
|
||||||
|
|
||||||
this.updateStringPositions();
|
this.updateStringPositions();
|
||||||
|
@ -182,134 +317,39 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
createStrings: function() {
|
|
||||||
this.createTopString();
|
|
||||||
this.createBottomString();
|
|
||||||
},
|
|
||||||
|
|
||||||
deleteStrings: function() {
|
createPreNotchString: function() {
|
||||||
Entities.deleteEntity(this.topString);
|
|
||||||
Entities.deleteEntity(this.bottomString);
|
|
||||||
},
|
|
||||||
|
|
||||||
createTopString: function() {
|
|
||||||
var stringProperties = {
|
var stringProperties = {
|
||||||
type: 'Line',
|
type: 'Line',
|
||||||
position: Vec3.sum(this.bowProperties.position, TOP_NOTCH_OFFSET),
|
position: Vec3.sum(this.bowProperties.position, TOP_NOTCH_OFFSET),
|
||||||
dimensions: LINE_DIMENSIONS
|
dimensions: LINE_DIMENSIONS
|
||||||
};
|
};
|
||||||
|
|
||||||
this.topString = Entities.addEntity(stringProperties);
|
this.preNotchString = Entities.addEntity(stringProperties);
|
||||||
},
|
},
|
||||||
|
|
||||||
createBottomString: function() {
|
drawPreNotchStrings: function() {
|
||||||
var stringProperties = {
|
|
||||||
type: 'Line',
|
|
||||||
position: Vec3.sum(this.bowProperties.position, BOTTOM_NOTCH_OFFSET),
|
|
||||||
dimensions: LINE_DIMENSIONS
|
|
||||||
};
|
|
||||||
|
|
||||||
this.bottomString = Entities.addEntity(stringProperties);
|
this.updateStringPositions();
|
||||||
},
|
|
||||||
|
|
||||||
updateStringPositions: function() {
|
Entities.editEntity(this.preNotchString, {
|
||||||
|
linePoints: [{
|
||||||
var upVector = Quat.getUp(this.bowProperties.rotation);
|
x: 0,
|
||||||
var upOffset = Vec3.multiply(upVector, TOP_NOTCH_OFFSET);
|
y: 0,
|
||||||
var downVector = Vec3.multiply(-1, Quat.getUp(this.bowProperties.rotation));
|
z: 0
|
||||||
var downOffset = Vec3.multiply(downVector, BOTTOM_NOTCH_OFFSET);
|
}, Vec3.sum({
|
||||||
|
x: 0,
|
||||||
this.topStringPosition = Vec3.sum(this.bowProperties.position, upOffset);
|
y: 0,
|
||||||
this.bottomStringPosition = Vec3.sum(this.bowProperties.position, downOffset);
|
z: 0
|
||||||
|
}, BOTTOM_NOTCH_OFFSET * 2)],
|
||||||
Entities.editEntity(this.topString, {
|
lineWidth: 5,
|
||||||
position: this.topStringPosition
|
color: this.stringData.currentColor
|
||||||
});
|
});
|
||||||
Entities.editEntity(this.bottomString, {
|
|
||||||
position: this.bottomStringPosition
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
startNearGrab: function() {
|
|
||||||
if (this.isGrabbed === true) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.isGrabbed = true;
|
|
||||||
this.initialHand = this.hand;
|
|
||||||
Entities.editEntity(this.entityID, {
|
|
||||||
userData: JSON.stringify({
|
|
||||||
grabbableKey: {
|
|
||||||
turnOffOtherHand: true,
|
|
||||||
turnOffOppositeBeam: true,
|
|
||||||
invertSolidWhileHeld: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
continueNearGrab: function() {
|
|
||||||
this.bowProperties = Entities.getEntityProperties(this.entityID, ["position", "rotation"]);
|
|
||||||
|
|
||||||
this.checkStringHand();
|
|
||||||
|
|
||||||
if (this.useNotching === true) {
|
|
||||||
|
|
||||||
|
|
||||||
if (this.hasArrowLoaded === false) {
|
|
||||||
this.updateReloadDetectorPosition();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.hasArrowLoaded === true) {
|
|
||||||
this.updateNotchDetectorPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.checkArrowHand();
|
|
||||||
|
|
||||||
if (this.hasArrowNotched === true) {
|
|
||||||
//only test for strings now that an arrow is notched
|
|
||||||
this.checkStringHand();
|
|
||||||
//should probably draw a string straight across the bow until its notched
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
createStringPreNotch: function() {
|
|
||||||
var properties = {};
|
|
||||||
this.preNotchString = Entities.addEntitiy(properties);
|
|
||||||
},
|
|
||||||
|
|
||||||
updatePreNotchStringPosition: function() {
|
|
||||||
var position;
|
|
||||||
Entities.editEntityProperties(this.preNotchString, {
|
|
||||||
position: position
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
deletePreNotchString: function() {
|
deletePreNotchString: function() {
|
||||||
Entities.deleteEntity(this.preNotchString);
|
Entities.deleteEntity(this.preNotchString);
|
||||||
},
|
},
|
||||||
releaseGrab: function() {
|
|
||||||
if (this.isGrabbed === true && this.hand === this.initialHand) {
|
|
||||||
this.isGrabbed = false;
|
|
||||||
this.stringDrawn = false;
|
|
||||||
this.deleteStrings();
|
|
||||||
this.hasArrow = false;
|
|
||||||
Entities.deleteEntity(this.arrow);
|
|
||||||
Entities.editEntity(this.entityID, {
|
|
||||||
userData: JSON.stringify({
|
|
||||||
grabbableKey: {
|
|
||||||
turnOffOtherHand: false,
|
|
||||||
turnOffOppositeBeam: true,
|
|
||||||
invertSolidWhileHeld: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
checkArrowHand: function() {
|
checkArrowHand: function() {
|
||||||
if (this.initialHand === 'left') {
|
if (this.initialHand === 'left') {
|
||||||
|
@ -332,8 +372,11 @@
|
||||||
testForHandInReloadDetector: function() {
|
testForHandInReloadDetector: function() {
|
||||||
var arrowHandPosition = this.getArrowHandPosition();
|
var arrowHandPosition = this.getArrowHandPosition();
|
||||||
var reloadDetectorPosition = Entities.getEntityProperties(this.reloadDetector, "position");
|
var reloadDetectorPosition = Entities.getEntityProperties(this.reloadDetector, "position");
|
||||||
var fromArrowHandToReloadDetector = Vec3.distance(arrowHandPosition, reloadDetectorPosition);
|
var fromArrowHandToReloadDetector = Vec3.subtract(arrowHandPosition, reloadDetectorPosition);
|
||||||
if (fromArrowHandToReloadDetector < RELEOAD_DETECTOR_DISTANCE) {
|
var distance = Vec3.length(fromArrowHandToReloadDetector);
|
||||||
|
print('fromArrowHandToReloadDetector distance :: '+distance);
|
||||||
|
if (fromArrowHandToReloadDetector < RELOAD_DETECTOR_DISTANCE) {
|
||||||
|
print('ARROW LOADED');
|
||||||
this.hasArrowLoaded = true;
|
this.hasArrowLoaded = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -341,8 +384,10 @@
|
||||||
testForHandInNotchDetector: function() {
|
testForHandInNotchDetector: function() {
|
||||||
var arrowHandPosition = this.getArrowHandPosition();
|
var arrowHandPosition = this.getArrowHandPosition();
|
||||||
var notchDetectorPosition = Entities.getEntityProperties(this.notchDetector, "position");
|
var notchDetectorPosition = Entities.getEntityProperties(this.notchDetector, "position");
|
||||||
var fromArrowHandToNotchDetector = Vec3.distance(arrowHandPosition, notchDetectorPosition);
|
var fromArrowHandToNotchDetector = Vec3.subtract(arrowHandPosition, notchDetectorPosition);
|
||||||
if (fromArrowHandToNotchDetector < NOTCH_DETECTOR_DISTANCE) {
|
var distance = Vec3.length(fromArrowHandToNotchDetector);
|
||||||
|
if (distance < NOTCH_DETECTOR_DISTANCE) {
|
||||||
|
print('ARROW NOTCHED');
|
||||||
this.hasArrowNotched = true;
|
this.hasArrowNotched = true;
|
||||||
this.notchArrow();
|
this.notchArrow();
|
||||||
}
|
}
|
||||||
|
@ -452,21 +497,33 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
updateArrowPositionPreNotch: function() {
|
updateArrowPositionPreNotch: function() {
|
||||||
|
|
||||||
var arrowHandPosition = this.getArrowHandPosition();
|
|
||||||
|
|
||||||
|
|
||||||
Entities.editEntity(this.arrow, {
|
Entities.editEntity(this.arrow, {
|
||||||
position: arrowPosition
|
position: this.getArrowHandPosition(),
|
||||||
|
rotatin: this.getArrowHandRotation()
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.arrowIsBurning === true) {
|
if (this.arrowIsBurning === true) {
|
||||||
Entities.editEntity(this.fire, {
|
Entities.editEntity(this.fire, {
|
||||||
position: this.arrow.position
|
position: arrowHandPosition
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateArrowPositionInNotch: function() {
|
||||||
|
var notchPosition = this.notchDetectorPosition;
|
||||||
|
|
||||||
|
Entities.editEntityProperties(this.arrow, {
|
||||||
|
position: notchPosition
|
||||||
|
})
|
||||||
|
|
||||||
|
if (this.arrowIsBurning === true) {
|
||||||
|
Entities.editEntity(this.fire, {
|
||||||
|
position: arrowTipPosition
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
createArrow: function() {
|
createArrow: function() {
|
||||||
// print('CREATING ARROW');
|
// print('CREATING ARROW');
|
||||||
var arrowProperties = {
|
var arrowProperties = {
|
||||||
|
@ -494,6 +551,12 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getArrowTipPosition: function() {
|
||||||
|
var arrowPosition = this.getArrowPosition();
|
||||||
|
var arrowTipPosition = Vec3.sum(arrowPosition, ARROW_TIP_OFFSET);
|
||||||
|
return arrowTipPosition
|
||||||
|
},
|
||||||
|
|
||||||
releaseArrow: function() {
|
releaseArrow: function() {
|
||||||
var handToHand = Vec3.subtract(this.stringData.grabHandPosition, this.stringData.handPosition);
|
var handToHand = Vec3.subtract(this.stringData.grabHandPosition, this.stringData.handPosition);
|
||||||
|
|
||||||
|
@ -539,14 +602,33 @@
|
||||||
return min2 + (max2 - min2) * ((value - min1) / (max1 - min1));
|
return min2 + (max2 - min2) * ((value - min1) / (max1 - min1));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getReloadDetectorPosition: function() {
|
||||||
|
var avatarHeadPosition = MyAvatar.getHeadPosition();
|
||||||
|
var offsetDirection;
|
||||||
|
this.initialHand === 'left' ? offsetDirection = Quat.getRight(MyAvatar.orientation) : offsetDirection = Vec3.multiply(-1, Quat.getRight(MyAvatar.orientation));
|
||||||
|
var offset = Vec3.multiply(offsetDirection, RELOAD_DETECTOR_OFFSET);
|
||||||
|
var detectorPosition = Vec3.sum(avatarHeadPosition, offset);
|
||||||
|
|
||||||
|
return detectorPosition
|
||||||
|
},
|
||||||
|
|
||||||
createReloadDetector: function() {
|
createReloadDetector: function() {
|
||||||
|
|
||||||
|
var detectorPosition = this.getReloadDetectorPosition();
|
||||||
|
|
||||||
var detectorProperties = {
|
var detectorProperties = {
|
||||||
type: 'Box',
|
type: 'Box',
|
||||||
shapeType: 'box',
|
visible: true,
|
||||||
visible: false,
|
ignoreForCollisions: true,
|
||||||
dimensions: RELOAD_DETECTOR_DIMENSIONS,
|
dimensions: RELOAD_DETECTOR_DIMENSIONS,
|
||||||
position: detectorPosition
|
position: detectorPosition,
|
||||||
|
color: {
|
||||||
|
red: 255,
|
||||||
|
green: 0,
|
||||||
|
blue: 0
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.reloadDetector = Entities.addEntity(detectorProperties);
|
this.reloadDetector = Entities.addEntity(detectorProperties);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -555,37 +637,34 @@
|
||||||
|
|
||||||
var detectorProperties = {
|
var detectorProperties = {
|
||||||
type: 'Box',
|
type: 'Box',
|
||||||
shapeType: 'box',
|
visible: true,
|
||||||
visible: false,
|
ignoreForCollisions: true,
|
||||||
dimensions: NOTCH_DETECTOR_DIMENSIONS,
|
dimensions: NOTCH_DETECTOR_DIMENSIONS,
|
||||||
position: detectorPosition
|
position: detectorPosition,
|
||||||
|
color: {
|
||||||
|
red: 0,
|
||||||
|
green: 255,
|
||||||
|
blue: 0
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.notchDetector = Entities.addEntity(detectorProperties);
|
this.notchDetector = Entities.addEntity(detectorProperties);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateReloadDetectorPosition: function() {
|
updateReloadDetectorPosition: function() {
|
||||||
this.reloadDetectorPosition = Vec3.sum(MyAvatar.position, RELOAD_DETECTOR_OFFSET);
|
this.reloadDetectorPosition = this.getReloadDetectorPosition();
|
||||||
Entities.editEntity(this.reloadDetector, {
|
Entities.editEntity(this.reloadDetector, {
|
||||||
position: thi8s.reloadDetectorPosition
|
position: this.reloadDetectorPosition
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
updateNotchDetectorPosition: function() {
|
updateNotchDetectorPosition: function() {
|
||||||
this.notchDetectorPosition = Vec3.sum(MyAvatar.position, NOTCH_DETECTOR_OFFSET);
|
this.notchDetectorPosition = Vec3.sum(this.bowProperties.position, NOTCH_DETECTOR_OFFSET);
|
||||||
Entities.editEntity(this.notchDetector, {
|
Entities.editEntity(this.notchDetector, {
|
||||||
position: this.notchDetectorPosition
|
position: this.notchDetectorPosition
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
updateArrowInHand: function() {
|
|
||||||
var arrowHandPosition = this.getArrowHandPosition();
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
updateArrowInNotch: function() {
|
|
||||||
var notchPosition = this.notchPosition
|
|
||||||
},
|
|
||||||
|
|
||||||
setArrowOnFire: function() {
|
setArrowOnFire: function() {
|
||||||
|
|
||||||
var myOrientation = Quat.fromPitchYawRollDegrees(-90, 0, 0.0);
|
var myOrientation = Quat.fromPitchYawRollDegrees(-90, 0, 0.0);
|
||||||
|
@ -598,7 +677,6 @@
|
||||||
lastFrame: 10000
|
lastFrame: 10000
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var fire = Entities.addEntity({
|
var fire = Entities.addEntity({
|
||||||
type: "ParticleEffect",
|
type: "ParticleEffect",
|
||||||
name: "Hifi-Arrow-Fire",
|
name: "Hifi-Arrow-Fire",
|
||||||
|
|
Loading…
Reference in a new issue