start transitioning to new grab methods

This commit is contained in:
James B. Pollack 2015-09-21 16:45:23 -07:00
parent f3eef9322c
commit cd6ad306ac
2 changed files with 36 additions and 3 deletions

View file

@ -30,7 +30,7 @@ var wand = Entities.addEntity({
position: center, position: center,
gravity: { gravity: {
x: 0, x: 0,
y: -9.8, y: 0,
z: 0, z: 0,
}, },
dimensions: { dimensions: {
@ -45,7 +45,8 @@ var wand = Entities.addEntity({
}); });
function cleanup() { function cleanup() {
Entities.deleteEntity(wand); // the line below this is commented out to make the wand that you create persistent.
Entities.deleteEntity(wand);
} }

View file

@ -45,6 +45,7 @@
} }
BubbleWand.prototype = { BubbleWand.prototype = {
timePassed:null,
currentBubble: null, currentBubble: null,
preload: function(entityID) { preload: function(entityID) {
this.entityID = entityID; this.entityID = entityID;
@ -55,6 +56,7 @@
Script.update.disconnect(this.update); Script.update.disconnect(this.update);
}, },
update: function(deltaTime) { update: function(deltaTime) {
this.timePassed=deltaTime;
var defaultGrabData = { var defaultGrabData = {
activated: false, activated: false,
avatarId: null avatarId: null
@ -210,7 +212,37 @@
}); });
} },
startNearGrab: function() {
print('START NEAR GRAB')
if (_this.currentBubble === null) {
_this.createBubbleAtTipOfWand();
}
},
continueNearGrab: function() {
if (this.timePassed === null) {
this.timePassed = Date.now();
} else {
var newTime = = Date.now() - this.timePassed;
// this.timePassed = newTime;
}
print('CONTINUE NEAR GRAB::' + this.timePassed);
},
releaseGrab: function() {
//delete the lights and reset state
if (this.hasSpotlight) {
Entities.deleteEntity(this.spotlight);
Entities.deleteEntity(this.glowLight);
this.hasSpotlight = false;
this.glowLight = null;
this.spotlight = null;
this.whichHand = null;
}
},
} }