Merge remote-tracking branch 'upstream/master' into loadingFade

This commit is contained in:
SamGondelman 2016-08-08 10:55:20 -07:00
commit 0ec1da4a0d
2 changed files with 10 additions and 7 deletions

View file

@ -25,7 +25,7 @@
<ul class="nav nav-pills nav-stacked"> <ul class="nav nav-pills nav-stacked">
</ul> </ul>
<button id="advanced-toggle-button" hidden=true class="btn btn-info advanced-toggle">Show advanced</button> <button id="advanced-toggle-button" class="btn btn-info advanced-toggle">Show advanced</button>
<button class="btn btn-success save-button">Save and restart</button> <button class="btn btn-success save-button">Save and restart</button>
</div> </div>
</div> </div>

View file

@ -107,7 +107,10 @@ var NEAR_GRAB_PICK_RADIUS = 0.25; // radius used for search ray vs object for ne
var PICK_BACKOFF_DISTANCE = 0.2; // helps when hand is intersecting the grabble object var PICK_BACKOFF_DISTANCE = 0.2; // helps when hand is intersecting the grabble object
var NEAR_GRABBING_KINEMATIC = true; // force objects to be kinematic when near-grabbed var NEAR_GRABBING_KINEMATIC = true; // force objects to be kinematic when near-grabbed
var CHECK_TOO_FAR_UNEQUIP_TIME = 1.0; // seconds
// if an equipped item is "adjusted" to be too far from the hand it's in, it will be unequipped.
var CHECK_TOO_FAR_UNEQUIP_TIME = 0.3; // seconds, duration between checks
var AUTO_UNEQUIP_DISTANCE_FACTOR = 1.2; // multiplied by maximum dimension of held item, > this means drop
// //
// other constants // other constants
@ -1818,7 +1821,8 @@ function MyController(hand) {
this.heartBeat(this.grabbedEntity); this.heartBeat(this.grabbedEntity);
var props = Entities.getEntityProperties(this.grabbedEntity, ["localPosition", "parentID", "position", "rotation"]); var props = Entities.getEntityProperties(this.grabbedEntity, ["localPosition", "parentID",
"position", "rotation", "dimensions"]);
if (!props.position) { if (!props.position) {
// server may have reset, taking our equipped entity with it. move back to "off" stte // server may have reset, taking our equipped entity with it. move back to "off" stte
this.callEntityMethodOnGrabbed("releaseGrab"); this.callEntityMethodOnGrabbed("releaseGrab");
@ -1830,10 +1834,9 @@ function MyController(hand) {
if (now - this.lastUnequipCheckTime > MSECS_PER_SEC * CHECK_TOO_FAR_UNEQUIP_TIME) { if (now - this.lastUnequipCheckTime > MSECS_PER_SEC * CHECK_TOO_FAR_UNEQUIP_TIME) {
this.lastUnequipCheckTime = now; this.lastUnequipCheckTime = now;
if (props.parentID == MyAvatar.sessionUUID && if (props.parentID == MyAvatar.sessionUUID) {
Vec3.length(props.localPosition) > NEAR_GRAB_MAX_DISTANCE) {
var handPosition = this.getHandPosition(); var handPosition = this.getHandPosition();
// the center of the equipped object being far from the hand isn't enough to autoequip -- we also // the center of the equipped object being far from the hand isn't enough to auto-unequip -- we also
// need to fail the findEntities test. // need to fail the findEntities test.
var nearPickedCandidateEntities = Entities.findEntities(handPosition, NEAR_GRAB_RADIUS); var nearPickedCandidateEntities = Entities.findEntities(handPosition, NEAR_GRAB_RADIUS);
if (nearPickedCandidateEntities.indexOf(this.grabbedEntity) == -1) { if (nearPickedCandidateEntities.indexOf(this.grabbedEntity) == -1) {
@ -2416,4 +2419,4 @@ function cleanup() {
} }
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);
Script.update.connect(update); Script.update.connect(update);