remove prints and format

This commit is contained in:
James B. Pollack 2016-07-08 15:08:44 -07:00
parent 3492367c63
commit 5ca14b528b
5 changed files with 147 additions and 81 deletions

View file

@ -23,5 +23,6 @@ Script.load("system/controllers/handControllerGrab.js");
Script.load("system/controllers/handControllerPointer.js");
Script.load("system/controllers/squeezeHands.js");
Script.load("system/controllers/grab.js");
Script.load("system/controllers/teleport.js");
Script.load("system/dialTone.js");
Script.load("system/firstPersonHMD.js");

View file

@ -251,6 +251,7 @@ function propsArePhysical(props) {
// If another script is managing the reticle (as is done by HandControllerPointer), we should not be setting it here,
// and we should not be showing lasers when someone else is using the Reticle to indicate a 2D minor mode.
var EXTERNALLY_MANAGED_2D_MINOR_MODE = true;
function isIn2DMode() {
// In this version, we make our own determination of whether we're aimed a HUD element,
// because other scripts (such as handControllerPointer) might be using some other visualization
@ -258,6 +259,7 @@ function isIn2DMode() {
return (EXTERNALLY_MANAGED_2D_MINOR_MODE &&
(Reticle.pointingAtSystemOverlay || Overlays.getOverlayAtPoint(Reticle.position)));
}
function restore2DMode() {
if (!EXTERNALLY_MANAGED_2D_MINOR_MODE) {
Reticle.setVisible(true);
@ -399,7 +401,6 @@ function MyController(hand) {
this.updateSmoothedTrigger();
if (this.ignoreInput()) {
// print('in ignore input turn off')
this.turnOffVisualizations();
return;
}
@ -520,7 +521,7 @@ function MyController(hand) {
visible: true
};
this.searchSphere = Overlays.addOverlay("sphere", sphereProperties);
print('CREATED SEARCH OVERLAY : '+ this.searchSphere)
} else {
Overlays.editOverlay(this.searchSphere, {
@ -529,7 +530,7 @@ function MyController(hand) {
color: color,
visible: true
});
print('EDITED SEARCH OVERLAY : '+ this.searchSphere)
}
};
@ -547,7 +548,6 @@ function MyController(hand) {
alpha: 1
};
this.overlayLine = Overlays.addOverlay("line3d", lineProperties);
print('CREATED OVERLAY IT IS ' + this.overlayLine )
} else {
Overlays.editOverlay(this.overlayLine, {
@ -560,7 +560,6 @@ function MyController(hand) {
drawInFront: true, // Even when burried inside of something, show it.
alpha: 1
});
print('edited overlay line ' + this.overlayLine )
}
};
@ -767,12 +766,8 @@ function MyController(hand) {
this.overlayLineOff = function() {
if (_this.overlayLine !== null) {
Overlays.deleteOverlay(this.overlayLine);
print('REMOVING OVERLAY LINE' + this.overlayLine)
_this.overlayLine = null;
}
// print('overlay shoudl be null and is line is ' + this.overlayLine)
};
this.searchSphereOff = function() {
@ -805,27 +800,21 @@ function MyController(hand) {
};
this.turnOffVisualizations = function(hand) {
// print('TURN OFF VISUALIZATIONS: ' + hand)
if (USE_ENTITY_LINES_FOR_SEARCHING === true || USE_ENTITY_LINES_FOR_MOVING === true) {
this.lineOff();
// print('after line off')
}
if (USE_OVERLAY_LINES_FOR_SEARCHING === true || USE_OVERLAY_LINES_FOR_MOVING === true) {
this.overlayLineOff();
// print('after overlay line off')
}
if (USE_PARTICLE_BEAM_FOR_MOVING === true) {
this.particleBeamOff();
// print('after particle beam off')
}
this.searchSphereOff();
restore2DMode();
// print('after all turn off calls')
};
this.triggerPress = function(value) {
@ -901,18 +890,34 @@ function MyController(hand) {
this.createHotspots = function() {
var _this = this;
var HAND_EQUIP_SPHERE_COLOR = { red: 90, green: 255, blue: 90 };
var HAND_EQUIP_SPHERE_COLOR = {
red: 90,
green: 255,
blue: 90
};
var HAND_EQUIP_SPHERE_ALPHA = 0.7;
var HAND_EQUIP_SPHERE_RADIUS = 0.01;
var HAND_GRAB_SPHERE_COLOR = { red: 90, green: 90, blue: 255 };
var HAND_GRAB_SPHERE_COLOR = {
red: 90,
green: 90,
blue: 255
};
var HAND_GRAB_SPHERE_ALPHA = 0.3;
var HAND_GRAB_SPHERE_RADIUS = NEAR_GRAB_RADIUS;
var EQUIP_SPHERE_COLOR = { red: 90, green: 255, blue: 90 };
var EQUIP_SPHERE_COLOR = {
red: 90,
green: 255,
blue: 90
};
var EQUIP_SPHERE_ALPHA = 0.3;
var GRAB_BOX_COLOR = { red: 90, green: 90, blue: 255 };
var GRAB_BOX_COLOR = {
red: 90,
green: 90,
blue: 255
};
var GRAB_BOX_ALPHA = 0.1;
this.hotspotOverlays = [];
@ -936,7 +941,6 @@ function MyController(hand) {
overlay: overlay,
type: "hand"
});
print('ADDED HAND SPHERE OVERLAY : '+overlay)
// add larger blue sphere around the palm.
overlay = Overlays.addOverlay("sphere", {
@ -949,13 +953,16 @@ function MyController(hand) {
ignoreRayIntersection: true,
drawInFront: false
});
print('ADDED HAND SPHERE OVERLAY : '+overlay)
this.hotspotOverlays.push({
entityID: undefined,
overlay: overlay,
type: "hand",
localPosition: {x: 0, y: 0, z: 0}
localPosition: {
x: 0,
y: 0,
z: 0
}
});
}
@ -979,13 +986,16 @@ function MyController(hand) {
ignoreRayIntersection: true,
drawInFront: false
});
print('ADDED GRAB BOX OVERLAY : '+ overlay)
_this.hotspotOverlays.push({
entityID: entityID,
overlay: overlay,
type: "near",
localPosition: {x: 0, y: 0, z: 0}
localPosition: {
x: 0,
y: 0,
z: 0
}
});
}
});
@ -1007,7 +1017,6 @@ function MyController(hand) {
ignoreRayIntersection: true,
drawInFront: false
});
print('ADDED SPHERE HOTSTPOT OVERLAY : '+ overlay)
_this.hotspotOverlays.push({
entityID: hotspot.entityID,
@ -1023,7 +1032,9 @@ function MyController(hand) {
var props;
this.hotspotOverlays.forEach(function(overlayInfo) {
if (overlayInfo.type === "hand") {
Overlays.editOverlay(overlayInfo.overlay, { position: _this.getHandPosition() });
Overlays.editOverlay(overlayInfo.overlay, {
position: _this.getHandPosition()
});
} else if (overlayInfo.type === "equip") {
_this.entityPropertyCache.updateEntity(overlayInfo.entityID);
props = _this.entityPropertyCache.getProps(overlayInfo.entityID);
@ -1035,15 +1046,16 @@ function MyController(hand) {
} else if (overlayInfo.type === "near") {
_this.entityPropertyCache.updateEntity(overlayInfo.entityID);
props = _this.entityPropertyCache.getProps(overlayInfo.entityID);
Overlays.editOverlay(overlayInfo.overlay, { position: props.position, rotation: props.rotation });
Overlays.editOverlay(overlayInfo.overlay, {
position: props.position,
rotation: props.rotation
});
}
});
};
this.destroyHotspots = function() {
this.hotspotOverlays.forEach(function(overlayInfo) {
print('deleting overlay hotspot ' + overlayInfo.overlay)
Overlays.deleteOverlay(overlayInfo.overlay);
});
this.hotspotOverlays = [];
@ -1157,7 +1169,11 @@ function MyController(hand) {
if (wearableProps && wearableProps.joints) {
result.push({
entityID: entityID,
localPosition: {x: 0, y: 0, z: 0},
localPosition: {
x: 0,
y: 0,
z: 0
},
worldPosition: entityXform.pos,
radius: EQUIP_RADIUS,
joints: wearableProps.joints
@ -1696,9 +1712,21 @@ function MyController(hand) {
this.fastHandMoveTimer = FAST_HAND_SPEED_REST_TIME;
}
var localHandUpAxis = this.hand === RIGHT_HAND ? {x: 1, y: 0, z: 0} : {x: -1, y: 0, z: 0};
var localHandUpAxis = this.hand === RIGHT_HAND ? {
x: 1,
y: 0,
z: 0
} : {
x: -1,
y: 0,
z: 0
};
var worldHandUpAxis = Vec3.multiplyQbyV(worldHandRotation, localHandUpAxis);
var DOWN = {x: 0, y: -1, z: 0};
var DOWN = {
x: 0,
y: -1,
z: 0
};
var ROTATION_THRESHOLD = Math.cos(Math.PI / 8);
var handIsUpsideDown = false;
@ -1800,8 +1828,16 @@ function MyController(hand) {
}
Entities.editEntity(this.grabbedEntity, {
velocity: {x: 0, y: 0, z: 0},
angularVelocity: {x: 0, y: 0, z: 0},
velocity: {
x: 0,
y: 0,
z: 0
},
angularVelocity: {
x: 0,
y: 0,
z: 0
},
dynamic: false
});
@ -2110,7 +2146,9 @@ function MyController(hand) {
// people are holding something and one of them will be able (if the other releases at the right time) to
// bootstrap themselves with the held object. This happens because the meaning of "otherAvatar" in
// the collision mask hinges on who the physics simulation owner is.
Entities.editEntity(entityID, {"collidesWith": COLLIDES_WITH_WHILE_MULTI_GRABBED});
Entities.editEntity(entityID, {
"collidesWith": COLLIDES_WITH_WHILE_MULTI_GRABBED
});
}
}
setEntityCustomData(GRAB_USER_DATA_KEY, entityID, data);
@ -2124,7 +2162,9 @@ function MyController(hand) {
var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, handJointIndex);
children.forEach(function(childID) {
print("disconnecting stray child of hand: (" + _this.hand + ") " + childID);
Entities.editEntity(childID, {parentID: NULL_UUID});
Entities.editEntity(childID, {
parentID: NULL_UUID
});
});
};
@ -2170,12 +2210,24 @@ function MyController(hand) {
data["dynamic"] &&
data["parentID"] == NULL_UUID &&
!data["collisionless"]) {
deactiveProps["velocity"] = {x: 0.0, y: 0.1, z: 0.0};
deactiveProps["velocity"] = {
x: 0.0,
y: 0.1,
z: 0.0
};
doSetVelocity = false;
}
if (noVelocity) {
deactiveProps["velocity"] = {x: 0.0, y: 0.0, z: 0.0};
deactiveProps["angularVelocity"] = {x: 0.0, y: 0.0, z: 0.0};
deactiveProps["velocity"] = {
x: 0.0,
y: 0.0,
z: 0.0
};
deactiveProps["angularVelocity"] = {
x: 0.0,
y: 0.0,
z: 0.0
};
doSetVelocity = false;
}
@ -2198,14 +2250,32 @@ function MyController(hand) {
deactiveProps = {
parentID: this.previousParentID,
parentJointIndex: this.previousParentJointIndex,
velocity: {x: 0.0, y: 0.0, z: 0.0},
angularVelocity: {x: 0.0, y: 0.0, z: 0.0}
velocity: {
x: 0.0,
y: 0.0,
z: 0.0
},
angularVelocity: {
x: 0.0,
y: 0.0,
z: 0.0
}
};
Entities.editEntity(entityID, deactiveProps);
} else if (noVelocity) {
Entities.editEntity(entityID, {velocity: {x: 0.0, y: 0.0, z: 0.0},
angularVelocity: {x: 0.0, y: 0.0, z: 0.0},
dynamic: data["dynamic"]});
Entities.editEntity(entityID, {
velocity: {
x: 0.0,
y: 0.0,
z: 0.0
},
angularVelocity: {
x: 0.0,
y: 0.0,
z: 0.0
},
dynamic: data["dynamic"]
});
}
} else {
data = null;
@ -2353,4 +2423,3 @@ function handleMenuItemEvent(menuItem) {
}
Menu.menuItemEvent.connect(handleMenuItemEvent);

View file

@ -39,7 +39,7 @@ var NUMBER_OF_STEPS = 6;
// var NUMBER_OF_STEPS = 20;
var TARGET_MODEL_URL = 'http://hifi-content.s3.amazonaws.com/james/teleporter/target.fbx';
var TARGET_MODEL_URL = Script.resolvePath("../assets/models/teleport.fbx");
var TARGET_MODEL_DIMENSIONS = {
x: 1.15,
y: 0.5,
@ -584,22 +584,18 @@ function registerMappings() {
teleportMapping.from(Controller.Standard.LeftPrimaryThumb).peek().to(leftPad.buttonPress);
teleportMapping.from(Controller.Standard.LeftPrimaryThumb).when(leftTrigger.down).to(function(value) {
print('tel 1')
teleporter.enterTeleportMode('left')
return;
});
teleportMapping.from(Controller.Standard.RightPrimaryThumb).when(rightTrigger.down).to(function(value) {
print('tel 2')
teleporter.enterTeleportMode('right')
return;
});
teleportMapping.from(Controller.Standard.RT).when(Controller.Standard.RightPrimaryThumb).to(function(value) {
print('tel 3')
teleporter.enterTeleportMode('right')
return;
});
teleportMapping.from(Controller.Standard.LT).when(Controller.Standard.LeftPrimaryThumb).to(function(value) {
print('tel 4')
teleporter.enterTeleportMode('left')
return;
});