mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 16:53:08 +02:00
cleanup and mostly? working
This commit is contained in:
parent
aa832311f5
commit
8e81c3252a
3 changed files with 23 additions and 23 deletions
|
@ -1217,7 +1217,6 @@ Controller.enableMapping(MAPPING_NAME);
|
|||
var beamDisabler;
|
||||
|
||||
function createBeamDisabler() {
|
||||
print('CREATING DISABLER')
|
||||
var disablerProps = {
|
||||
name: 'Hifi-Beam-Disabler',
|
||||
type: 'Sphere',
|
||||
|
@ -1231,7 +1230,7 @@ function createBeamDisabler() {
|
|||
green: 0,
|
||||
blue: 0
|
||||
},
|
||||
visible: true,
|
||||
visible: false,
|
||||
position: MyAvatar.position,
|
||||
ignoreForCollisions: true,
|
||||
collisionsWillMove: false,
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
|
||||
|
||||
var USE_DEBOUNCE = false;
|
||||
|
||||
function interval() {
|
||||
var lastTime = new Date().getTime();
|
||||
|
||||
|
@ -112,7 +113,7 @@
|
|||
blue: 255
|
||||
}
|
||||
},
|
||||
sinceLastUpdate:0,
|
||||
sinceLastUpdate: 0,
|
||||
preload: function(entityID) {
|
||||
this.entityID = entityID;
|
||||
this.stringPullSound = SoundCache.getSound(STRING_PULL_SOUND_URL);
|
||||
|
@ -157,8 +158,8 @@
|
|||
var foundProps = Entities.getEntityProperties(entityId);
|
||||
if (foundProps.name == "Hifi-Beam-Disabler") {
|
||||
print('FOUND THE BEAM DISABLER')
|
||||
setEntityCustomData('beamDisablerKey',entityId,{
|
||||
handToDisable:this.initialHand==='left'?1:0
|
||||
setEntityCustomData('beamDisablerKey', entityId, {
|
||||
handToDisable: this.initialHand === 'left' ? 1 : 0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -166,16 +167,15 @@
|
|||
setEntityCustomData('grabbableKey', this.entityID, {
|
||||
grabbable: false,
|
||||
invertSolidWhileHeld: true,
|
||||
turnOffOppositeBeam: true,
|
||||
spatialKey: BOW_SPATIAL_KEY
|
||||
});
|
||||
|
||||
},
|
||||
continueNearGrab: function() {
|
||||
this.deltaTime = checkInterval();
|
||||
|
||||
//debounce during debugging -- maybe we're updating too fast?
|
||||
if (USE_DEBOUNCE === true) {
|
||||
this.deltaTime = checkInterval();
|
||||
this.sinceLastUpdate = this.sinceLastUpdate + this.deltaTime;
|
||||
|
||||
if (this.sinceLastUpdate > 60) {
|
||||
|
@ -216,18 +216,18 @@
|
|||
releaseGrab: function() {
|
||||
print('RELEASE GRAB EVENT')
|
||||
if (this.isGrabbed === true && this.hand === this.initialHand) {
|
||||
var ids = Entities.findEntities(MyAvatar.position, 1);
|
||||
var ids = Entities.findEntities(MyAvatar.position, 1);
|
||||
|
||||
for (var i in ids) {
|
||||
var entityId = ids[i];
|
||||
var foundProps = Entities.getEntityProperties(entityId);
|
||||
if (foundProps.name == "Hifi-Beam-Disabler") {
|
||||
print('FOUND THE BEAM DISABLER')
|
||||
setEntityCustomData('beamDisablerKey',entityId,{
|
||||
handToDisable:'none'
|
||||
})
|
||||
for (var i in ids) {
|
||||
var entityId = ids[i];
|
||||
var foundProps = Entities.getEntityProperties(entityId);
|
||||
if (foundProps.name == "Hifi-Beam-Disabler") {
|
||||
print('FOUND THE BEAM DISABLER')
|
||||
setEntityCustomData('beamDisablerKey', entityId, {
|
||||
handToDisable: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.isGrabbed = false;
|
||||
|
@ -235,7 +235,6 @@
|
|||
this.deleteStrings();
|
||||
setEntityCustomData('grabbableKey', this.entityID, {
|
||||
grabbable: true,
|
||||
turnOffOppositeBeam: true,
|
||||
invertSolidWhileHeld: true,
|
||||
spatialKey: BOW_SPATIAL_KEY
|
||||
});
|
||||
|
@ -458,7 +457,7 @@
|
|||
print('TRIGGER VALUE??' + this.triggerValue)
|
||||
// firing the arrow
|
||||
print('HIT RELEASE LOOP IN CHECK');
|
||||
|
||||
|
||||
this.drawStrings();
|
||||
this.hasArrowNotched = false;
|
||||
this.aiming = false;
|
||||
|
@ -467,7 +466,7 @@
|
|||
|
||||
|
||||
} 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
|
||||
|
||||
this.aiming = true;
|
||||
|
@ -542,7 +541,10 @@
|
|||
|
||||
//scale the shot strength by the distance you've pulled the arrow back and set its release velocity to be in the direction of the v
|
||||
var arrowForce = this.scaleArrowShotStrength(pullBackDistance);
|
||||
var handToNotch = Vec3.normalize(handToNotch);
|
||||
|
||||
var releaseVelocity = Vec3.multiply(handToNotch, arrowForce);
|
||||
// var releaseVelocity2 = Vec3.multiply()
|
||||
|
||||
//make the arrow physical, give it gravity, a lifetime, and set our velocity
|
||||
var arrowProperties = {
|
||||
|
@ -550,8 +552,8 @@
|
|||
velocity: releaseVelocity,
|
||||
gravity: ARROW_GRAVITY,
|
||||
lifetime: 10,
|
||||
position:notchPosition,
|
||||
rotation:arrowRotation
|
||||
position: arrowProperties.position,
|
||||
rotation: arrowProperties.rotation
|
||||
};
|
||||
|
||||
//actually shoot the arrow and play its sound
|
||||
|
|
|
@ -46,7 +46,6 @@ var bow = Entities.addEntity({
|
|||
script: SCRIPT_URL,
|
||||
userData: JSON.stringify({
|
||||
grabbableKey: {
|
||||
turnOffOppositeBeam:true,
|
||||
invertSolidWhileHeld: true,
|
||||
spatialKey: {
|
||||
relativePosition: {
|
||||
|
|
Loading…
Reference in a new issue