mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
Cleanup comments
This commit is contained in:
parent
031761fa57
commit
ccf125c047
3 changed files with 12 additions and 35 deletions
|
@ -23,7 +23,6 @@
|
|||
var properties;
|
||||
|
||||
this.preload = function(entityID) {
|
||||
// print('bubble preload')
|
||||
_this.entityID = entityID;
|
||||
Script.update.connect(_this.update);
|
||||
};
|
||||
|
@ -35,28 +34,20 @@
|
|||
properties = tmpProperties;
|
||||
}
|
||||
|
||||
// var defaultBubbleData={
|
||||
// avatarID:'noAvatar'
|
||||
// }
|
||||
|
||||
//we want to play the particle burst exactly once, so we make sure that this is a bubble we own.
|
||||
var entityData = getEntityCustomData(BUBBLE_USER_DATA_KEY, _this.entityID);
|
||||
|
||||
if (entityData && entityData.avatarID && entityData.avatarID === MyAvatar.sessionUUID) {
|
||||
_this.bubbleCreator = true
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
this.unload = function(entityID) {
|
||||
Script.update.disconnect(this.update);
|
||||
|
||||
print('bubble unload')
|
||||
|
||||
//only play particle burst for our bubbles
|
||||
if (this.bubbleCreator) {
|
||||
print('PLAYING BURST')
|
||||
this.createBurstParticles();
|
||||
}
|
||||
|
||||
|
@ -84,7 +75,7 @@
|
|||
emitRate: 100,
|
||||
animationIsPlaying: true,
|
||||
position: position,
|
||||
lifespan: 1,
|
||||
lifespan: 0.2,
|
||||
dimensions: {
|
||||
x: 1,
|
||||
y: 1,
|
||||
|
|
|
@ -17,7 +17,7 @@ Script.include("../../libraries/utils.js");
|
|||
|
||||
var WAND_MODEL = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wand/wand.fbx';
|
||||
var WAND_COLLISION_SHAPE = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wand/collisionHull.obj';
|
||||
var WAND_SCRIPT_URL = Script.resolvePath("wand.js?"+randInt(0,500));
|
||||
var WAND_SCRIPT_URL = Script.resolvePath("wand.js");
|
||||
//create the wand in front of the avatar blahy
|
||||
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {x: 0, y: 0.5, z: 0}), Vec3.multiply(0.5, Quat.getFront(Camera.getOrientation())));
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
var BUBBLE_MODEL = "http://hifi-public.s3.amazonaws.com/james/bubblewand/models/bubble/bubble.fbx";
|
||||
var BUBBLE_SCRIPT = Script.resolvePath('bubble.js');
|
||||
//test
|
||||
|
||||
var BUBBLE_USER_DATA_KEY = "BubbleKey";
|
||||
var BUBBLE_INITIAL_DIMENSIONS = {
|
||||
x: 0.01,
|
||||
|
@ -36,10 +36,10 @@
|
|||
var SHRINK_FACTOR = 0.001;
|
||||
var SHRINK_LOWER_LIMIT = 0.02;
|
||||
var WAND_TIP_OFFSET = 0.095;
|
||||
var VELOCITY_STRENGTH_LOWER_LIMIT = 0.01;
|
||||
var VELOCITY_STRENGH_MAX = 10;
|
||||
var VELOCITY_THRESHOLD = 0.5;
|
||||
|
||||
var GRAB_USER_DATA_KEY = "grabKey";
|
||||
|
||||
var _this;
|
||||
|
||||
var BubbleWand = function() {
|
||||
|
@ -58,19 +58,16 @@
|
|||
Script.update.disconnect(this.update);
|
||||
},
|
||||
update: function(deltaTime) {
|
||||
print('BW update')
|
||||
var GRAB_USER_DATA_KEY = "grabKey";
|
||||
var defaultGrabData = {
|
||||
activated: false,
|
||||
avatarId: null
|
||||
};
|
||||
var grabData = getEntityCustomData(GRAB_USER_DATA_KEY, _this.entityID, defaultGrabData);
|
||||
print('grabData'+JSON.stringify(grabData))
|
||||
if (grabData.activated && grabData.avatarId === MyAvatar.sessionUUID) {
|
||||
|
||||
if (grabData.activated && grabData.avatarId === MyAvatar.sessionUUID) {
|
||||
// remember we're being grabbed so we can detect being released
|
||||
_this.beingGrabbed = true;
|
||||
print('being grabbed')
|
||||
|
||||
//the first time we want to make a bubble
|
||||
if (_this.currentBubble === null) {
|
||||
_this.createBubbleAtTipOfWand();
|
||||
|
@ -90,7 +87,6 @@
|
|||
|
||||
} else if (_this.beingGrabbed) {
|
||||
// if we are not being grabbed, and we previously were, then we were just released, remember that
|
||||
print('let go')
|
||||
_this.beingGrabbed = false;
|
||||
|
||||
//remove the current bubble when the wand is released
|
||||
|
@ -98,7 +94,7 @@
|
|||
_this.currentBubble = null
|
||||
return
|
||||
}
|
||||
print('not grabbed')
|
||||
|
||||
|
||||
},
|
||||
getWandTipPosition: function(properties) {
|
||||
|
@ -114,7 +110,6 @@
|
|||
},
|
||||
addCollisionsToBubbleAfterCreation: function(bubble) {
|
||||
|
||||
print('adding collisions to bubble' + bubble);
|
||||
Entities.editEntity(bubble, {
|
||||
collisionsWillMove: true
|
||||
})
|
||||
|
@ -131,7 +126,6 @@
|
|||
return gravity
|
||||
},
|
||||
growBubbleWithWandVelocity: function(properties, deltaTime) {
|
||||
print('grow bubble')
|
||||
var wandPosition = properties.position;
|
||||
var wandTipPosition = this.getWandTipPosition(properties)
|
||||
|
||||
|
@ -142,13 +136,6 @@
|
|||
|
||||
var velocityStrength = Vec3.length(velocity);
|
||||
velocityStrength = velocityStrength;
|
||||
// if (velocityStrength < VELOCITY_STRENGTH_LOWER_LIMIT) {
|
||||
// velocityStrength = 0
|
||||
// }
|
||||
|
||||
// if (velocityStrength > VELOCITY_STRENGTH_MAX) {
|
||||
// velocityStrength = VELOCITY_STRENGTH_MAX
|
||||
// }
|
||||
|
||||
//store the last position of the wand for velocity calculations
|
||||
this.lastPosition = wandPosition;
|
||||
|
@ -157,7 +144,6 @@
|
|||
var dimensions = Entities.getEntityProperties(this.currentBubble).dimensions;
|
||||
|
||||
if (velocityStrength > VELOCITY_THRESHOLD) {
|
||||
print('velocity over threshold')
|
||||
//add some variation in bubble sizes
|
||||
var bubbleSize = randInt(BUBBLE_SIZE_MIN, BUBBLE_SIZE_MAX);
|
||||
bubbleSize = bubbleSize / BUBBLE_DIVISOR;
|
||||
|
@ -165,7 +151,6 @@
|
|||
//release the bubble if its dimensions are bigger than the bubble size
|
||||
if (dimensions.x > bubbleSize) {
|
||||
|
||||
print('release the bubble')
|
||||
//bubbles pop after existing for a bit -- so set a random lifetime
|
||||
var lifetime = randInt(BUBBLE_LIFETIME_MIN, BUBBLE_LIFETIME_MAX);
|
||||
|
||||
|
@ -178,7 +163,9 @@
|
|||
//wait to make the bubbles collidable, so that they dont hit each other and the wand
|
||||
Script.setTimeout(this.addCollisionsToBubbleAfterCreation(this.currentBubble), lifetime / 2);
|
||||
|
||||
//we want to pop the bubble for just one person
|
||||
this.setBubbleOwner(this.currentBubble);
|
||||
|
||||
//release the bubble -- when we create a new bubble, it will carry on and this update loop will affect the new bubble
|
||||
this.createBubbleAtTipOfWand();
|
||||
return
|
||||
|
@ -206,7 +193,6 @@
|
|||
});
|
||||
},
|
||||
setBubbleOwner: function(bubble) {
|
||||
print('SET BUBBLE OWNER', bubble)
|
||||
setEntityCustomData(BUBBLE_USER_DATA_KEY, bubble, {
|
||||
avatarID: MyAvatar.sessionUUID,
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue