mirror of
https://github.com/JulianGro/overte.git
synced 2025-05-01 02:03:40 +02:00
disable near grabbing on sliders
This commit is contained in:
parent
c266a093e0
commit
2ec712a5db
2 changed files with 29 additions and 9 deletions
|
@ -788,14 +788,19 @@ function MyController(hand) {
|
||||||
} else {
|
} else {
|
||||||
intersection = Entities.findRayIntersection(pickRayBacked, true);
|
intersection = Entities.findRayIntersection(pickRayBacked, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (intersection.intersects) {
|
if (intersection.intersects) {
|
||||||
|
|
||||||
// the ray is intersecting something we can move.
|
// the ray is intersecting something we can move.
|
||||||
var intersectionDistance = Vec3.distance(pickRay.origin, intersection.intersection);
|
var intersectionDistance = Vec3.distance(pickRay.origin, intersection.intersection);
|
||||||
|
|
||||||
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, intersection.entityID, DEFAULT_GRABBABLE_DATA);
|
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, intersection.entityID, DEFAULT_GRABBABLE_DATA);
|
||||||
|
var defaultDisableNearGrabData = {
|
||||||
|
disableNearGrab: false
|
||||||
|
};
|
||||||
|
//sometimes we want things to stay right where they are when we let go.
|
||||||
|
var disableNearGrabData = getEntityCustomData('handControllerKey', intersection.entityID, defaultDisableNearGrabData);
|
||||||
|
|
||||||
if (intersection.properties.name == "Grab Debug Entity") {
|
if (intersection.properties.name == "Grab Debug Entity") {
|
||||||
continue;
|
continue;
|
||||||
|
@ -817,7 +822,11 @@ function MyController(hand) {
|
||||||
} else if (!intersection.properties.locked) {
|
} else if (!intersection.properties.locked) {
|
||||||
this.grabbedEntity = intersection.entityID;
|
this.grabbedEntity = intersection.entityID;
|
||||||
if (this.state == STATE_SEARCHING) {
|
if (this.state == STATE_SEARCHING) {
|
||||||
this.setState(STATE_NEAR_GRABBING);
|
if (disableNearGrabData.disableNearGrab !== true) {
|
||||||
|
this.setState(STATE_NEAR_GRABBING);
|
||||||
|
} else {
|
||||||
|
//disable near grab on this thing
|
||||||
|
}
|
||||||
} else { // equipping
|
} else { // equipping
|
||||||
if (typeof grabbableData.spatialKey !== 'undefined') {
|
if (typeof grabbableData.spatialKey !== 'undefined') {
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -940,7 +949,18 @@ function MyController(hand) {
|
||||||
this.setState(STATE_NEAR_TRIGGER);
|
this.setState(STATE_NEAR_TRIGGER);
|
||||||
return;
|
return;
|
||||||
} else if (!props.locked && props.collisionsWillMove) {
|
} else if (!props.locked && props.collisionsWillMove) {
|
||||||
this.setState(this.state == STATE_SEARCHING ? STATE_NEAR_GRABBING : STATE_EQUIP)
|
var defaultDisableNearGrabData = {
|
||||||
|
disableNearGrab: false
|
||||||
|
};
|
||||||
|
//sometimes we want things to stay right where they are when we let go.
|
||||||
|
var disableNearGrabData = getEntityCustomData('handControllerKey', this.grabbedEntity, defaultDisableNearGrabData);
|
||||||
|
if (disableNearGrabData.disableNearGrab === true) {
|
||||||
|
//do nothing because near grab is disabled for this object
|
||||||
|
} else {
|
||||||
|
this.setState(this.state == STATE_SEARCHING ? STATE_NEAR_GRABBING : STATE_EQUIP)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1753,15 +1773,14 @@ handleHandMessages = function(channel, message, sender) {
|
||||||
|
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
}
|
} else if (channel === 'Hifi-Hand-RayPick-Blacklist') {
|
||||||
else if (channel === 'Hifi-Hand-RayPick-Blacklist') {
|
|
||||||
try {
|
try {
|
||||||
var data = JSON.parse(message);
|
var data = JSON.parse(message);
|
||||||
var action = data.action;
|
var action = data.action;
|
||||||
var id = data.id;
|
var id = data.id;
|
||||||
var index = blacklist.indexOf(id);
|
var index = blacklist.indexOf(id);
|
||||||
|
|
||||||
if (action === 'add' && index ===-1) {
|
if (action === 'add' && index === -1) {
|
||||||
blacklist.push(id);
|
blacklist.push(id);
|
||||||
}
|
}
|
||||||
if (action === 'remove') {
|
if (action === 'remove') {
|
||||||
|
|
|
@ -374,7 +374,8 @@ entitySlider.prototype = {
|
||||||
},
|
},
|
||||||
handControllerKey: {
|
handControllerKey: {
|
||||||
disableReleaseVelocity: true,
|
disableReleaseVelocity: true,
|
||||||
disableMoveWithHead: true
|
disableMoveWithHead: true,
|
||||||
|
disableNearGrab:true
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue