Merge pull request #8758 from hyperlogic/bug-fix/allow-ignoreik-false

allow equipped object to follow hand and not controller
This commit is contained in:
Seth Alves 2016-10-12 09:52:57 -07:00 committed by GitHub
commit 16af14d1f6
2 changed files with 7 additions and 6 deletions

View file

@ -26,7 +26,7 @@ var WANT_DEBUG = false;
var WANT_DEBUG_STATE = false;
var WANT_DEBUG_SEARCH_NAME = null;
var FORCE_IGNORE_IK = true;
var FORCE_IGNORE_IK = false;
var SHOW_GRAB_POINT_SPHERE = true;
//
@ -1382,10 +1382,11 @@ function MyController(hand) {
this.chooseBestEquipHotspot = function(candidateEntities) {
var DISTANCE = 0;
var equippableHotspots = this.chooseNearEquipHotspots(candidateEntities, DISTANCE);
var _this = this;
if (equippableHotspots.length > 0) {
// sort by distance
equippableHotspots.sort(function(a, b) {
var handControllerLocation = getControllerWorldLocation(this.handToController(), true);
var handControllerLocation = getControllerWorldLocation(_this.handToController(), true);
var aDistance = Vec3.distance(a.worldPosition, handControllerLocation.position);
var bDistance = Vec3.distance(b.worldPosition, handControllerLocation.position);
return aDistance - bDistance;
@ -1896,7 +1897,7 @@ function MyController(hand) {
if (FORCE_IGNORE_IK) {
this.ignoreIK = true;
} else {
this.ignoreIK = grabbableData.ignoreIK ? grabbableData.ignoreIK : false;
this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true;
}
var handRotation;

View file

@ -830,7 +830,7 @@ function loaded() {
elGrabbable.checked = properties.dynamic;
elWantsTrigger.checked = false;
elIgnoreIK.checked = false;
elIgnoreIK.checked = true;
var parsedUserData = {}
try {
parsedUserData = JSON.parse(properties.userData);
@ -1143,7 +1143,7 @@ function loaded() {
userDataChanger("grabbableKey", "wantsTrigger", elWantsTrigger, elUserData, false);
});
elIgnoreIK.addEventListener('change', function() {
userDataChanger("grabbableKey", "ignoreIK", elIgnoreIK, elUserData, false);
userDataChanger("grabbableKey", "ignoreIK", elIgnoreIK, elUserData, true);
});
elCollisionSoundURL.addEventListener('change', createEmitTextPropertyUpdateFunction('collisionSoundURL'));
@ -1596,4 +1596,4 @@ function loaded() {
document.addEventListener("contextmenu", function(event) {
event.preventDefault();
}, false);
}
}