Merge pull request #7094 from sethalves/fix-attachment-manager

fix some things I broke yesterday
This commit is contained in:
Andrew Meadows 2016-02-12 09:40:52 -08:00
commit 31f9da2dcb
2 changed files with 6 additions and 5 deletions

View file

@ -144,9 +144,9 @@ function AttachedEntitiesManager() {
this.handleEntityRelease = function(grabbedEntity, releasedFromJoint) { this.handleEntityRelease = function(grabbedEntity, releasedFromJoint) {
// if this is still equipped, just rewrite the position information. // if this is still equipped, just rewrite the position information.
var grabData = getEntityCustomData('grabKey', entityID, {}); var grabData = getEntityCustomData('grabKey', grabbedEntity, {});
if ("refCount" in grabData && grabData.refCount > 0) { if ("refCount" in grabData && grabData.refCount > 0) {
manager.updateRelativeOffsets(parsedMessage.grabbedEntity); manager.updateRelativeOffsets(grabbedEntity);
return; return;
} }
@ -185,8 +185,8 @@ function AttachedEntitiesManager() {
parentJointIndex: bestJointIndex parentJointIndex: bestJointIndex
}; };
if (bestJointOffset && bestJointOffset.constructor === Array && bestJointOffset.length > 1) { if (bestJointOffset && bestJointOffset.constructor === Array) {
if (this.avatarIsInDressingRoom()) { if (this.avatarIsInDressingRoom() || bestJointOffset.length < 2) {
this.updateRelativeOffsets(grabbedEntity); this.updateRelativeOffsets(grabbedEntity);
} else { } else {
// don't snap the entity to the preferred position if the avatar is in the dressing room. // don't snap the entity to the preferred position if the avatar is in the dressing room.

View file

@ -855,6 +855,7 @@ function MyController(hand) {
getEntityCustomData(GRABBABLE_DATA_KEY, candidateEntities[i], DEFAULT_GRABBABLE_DATA); getEntityCustomData(GRABBABLE_DATA_KEY, candidateEntities[i], DEFAULT_GRABBABLE_DATA);
var grabDataForCandidate = getEntityCustomData(GRAB_USER_DATA_KEY, candidateEntities[i], {}); var grabDataForCandidate = getEntityCustomData(GRAB_USER_DATA_KEY, candidateEntities[i], {});
var propsForCandidate = Entities.getEntityProperties(candidateEntities[i], GRABBABLE_PROPERTIES); var propsForCandidate = Entities.getEntityProperties(candidateEntities[i], GRABBABLE_PROPERTIES);
var near = (nearPickedCandidateEntities.indexOf(candidateEntities[i]) >= 0);
var isPhysical = this.propsArePhysical(propsForCandidate); var isPhysical = this.propsArePhysical(propsForCandidate);
var grabbable; var grabbable;
@ -916,7 +917,7 @@ function MyController(hand) {
continue; continue;
} }
if (this.state == STATE_SEARCHING && !isPhysical && distance > NEAR_PICK_MAX_DISTANCE) { if (this.state == STATE_SEARCHING && !isPhysical && distance > NEAR_PICK_MAX_DISTANCE && !near) {
// we can't distance-grab non-physical // we can't distance-grab non-physical
if (WANT_DEBUG_SEARCH_NAME && propsForCandidate.name == WANT_DEBUG_SEARCH_NAME) { if (WANT_DEBUG_SEARCH_NAME && propsForCandidate.name == WANT_DEBUG_SEARCH_NAME) {
print("grab is skipping '" + WANT_DEBUG_SEARCH_NAME + "': not physical and too far for near-grab"); print("grab is skipping '" + WANT_DEBUG_SEARCH_NAME + "': not physical and too far for near-grab");