more vis work

This commit is contained in:
David Kelly 2017-03-23 09:19:04 -07:00
parent a0c19d6b59
commit aa085e577d

View file

@ -200,15 +200,6 @@ function positionFractionallyTowards(posA, posB, frac) {
return Vec3.sum(posA, Vec3.multiply(frac, Vec3.subtract(posB, posA))); return Vec3.sum(posA, Vec3.multiply(frac, Vec3.subtract(posB, posA)));
} }
function fadeEffects() {
if (particleEffect) {
Entities.editEntity(particleEffect, {isEmitting: 0, lifespan: 1.0});
}
if(makingConnectionParticleEffect) {
Entities.editEntity(makingConnectionParticleEffect, {isEmitting: 0, lifespan: 1.5});
}
}
function deleteParticleEffect() { function deleteParticleEffect() {
if (particleEffect) { if (particleEffect) {
particleEffect = Entities.deleteEntity(particleEffect); particleEffect = Entities.deleteEntity(particleEffect);
@ -241,8 +232,8 @@ function calcParticlePos(myHand, otherHand, otherOrientation, reset) {
// this is called frequently, but usually does nothing // this is called frequently, but usually does nothing
function updateVisualization() { function updateVisualization() {
if (state == STATES.inactive) { if (state == STATES.inactive) {
fadeEffects(); deleteParticleEffect();
stopHandshakeSound(); deleteMakeConnectionParticleEffect();
return; return;
} }
@ -384,6 +375,9 @@ function startHandshake(fromKeyboard) {
function endHandshake() { function endHandshake() {
debug("ending handshake for", currentHand); debug("ending handshake for", currentHand);
deleteParticleEffect();
deleteMakeConnectionParticleEffect();
currentHand = undefined; currentHand = undefined;
// note that setting the state to inactive should really // note that setting the state to inactive should really
// only be done here, unless we change how the triggering works, // only be done here, unless we change how the triggering works,
@ -495,7 +489,7 @@ function makeConnection(id) {
successfulHandshakeInjector.restart(); successfulHandshakeInjector.restart();
} }
Controller.triggerHapticPulse(HAPTIC_DATA.success.strength, HAPTIC_DATA.success.duration, handToHaptic(currentHand)); Controller.triggerHapticPulse(HAPTIC_DATA.success.strength, HAPTIC_DATA.success.duration, handToHaptic(currentHand));
endHandshake(); // don't change state (so animation continues while gripped)
}, MAKING_CONNECTION_TIMEOUT); }, MAKING_CONNECTION_TIMEOUT);
} }