mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 16:55:07 +02:00
Add interface to disable hand controller grab functionality
This commit is contained in:
parent
a170436c8c
commit
14323a06b3
1 changed files with 17 additions and 6 deletions
|
@ -184,6 +184,10 @@ var STATE_FAR_TRIGGER = 5;
|
|||
var STATE_HOLD = 6;
|
||||
var STATE_ENTITY_TOUCHING = 7;
|
||||
|
||||
var holdEnabled = true;
|
||||
var nearGrabEnabled = true;
|
||||
var farGrabEnabled = true;
|
||||
|
||||
// "collidesWith" is specified by comma-separated list of group names
|
||||
// the possible group names are: static, dynamic, kinematic, myAvatar, otherAvatar
|
||||
var COLLIDES_WITH_WHILE_GRABBED = "dynamic,otherAvatar";
|
||||
|
@ -1440,7 +1444,7 @@ function MyController(hand) {
|
|||
|
||||
var potentialEquipHotspot = this.chooseBestEquipHotspot(candidateHotSpotEntities);
|
||||
if (potentialEquipHotspot) {
|
||||
if (this.triggerSmoothedGrab()) {
|
||||
if (this.triggerSmoothedGrab() && holdEnabled) {
|
||||
this.grabbedHotspot = potentialEquipHotspot;
|
||||
this.grabbedEntity = potentialEquipHotspot.entityID;
|
||||
this.setState(STATE_HOLD, "equipping '" + entityPropertiesCache.getProps(this.grabbedEntity).name + "'");
|
||||
|
@ -1483,7 +1487,7 @@ function MyController(hand) {
|
|||
// potentialNearTriggerEntity = entity;
|
||||
}
|
||||
} else {
|
||||
if (this.triggerSmoothedGrab()) {
|
||||
if (this.triggerSmoothedGrab() && nearGrabEnabled) {
|
||||
var props = entityPropertiesCache.getProps(entity);
|
||||
var grabProps = entityPropertiesCache.getGrabProps(entity);
|
||||
var refCount = grabProps.refCount ? grabProps.refCount : 0;
|
||||
|
@ -1571,7 +1575,7 @@ function MyController(hand) {
|
|||
// potentialFarTriggerEntity = entity;
|
||||
}
|
||||
} else if (this.entityIsDistanceGrabbable(rayPickInfo.entityID, handPosition)) {
|
||||
if (this.triggerSmoothedGrab() && !isEditing()) {
|
||||
if (this.triggerSmoothedGrab() && !isEditing() && farGrabEnabled) {
|
||||
this.grabbedEntity = entity;
|
||||
this.setState(STATE_DISTANCE_HOLDING, "distance hold '" + name + "'");
|
||||
return;
|
||||
|
@ -1589,7 +1593,9 @@ function MyController(hand) {
|
|||
equipHotspotBuddy.highlightHotspot(potentialEquipHotspot);
|
||||
}
|
||||
|
||||
this.searchIndicatorOn(rayPickInfo.searchRay);
|
||||
if (farGrabEnabled) {
|
||||
this.searchIndicatorOn(rayPickInfo.searchRay);
|
||||
}
|
||||
Reticle.setVisible(false);
|
||||
};
|
||||
|
||||
|
@ -2219,7 +2225,9 @@ function MyController(hand) {
|
|||
if (intersection.intersects) {
|
||||
this.intersectionDistance = Vec3.distance(pickRay.origin, intersection.intersection);
|
||||
}
|
||||
this.searchIndicatorOn(pickRay);
|
||||
if (farGrabEnabled) {
|
||||
this.searchIndicatorOn(pickRay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2327,7 +2335,9 @@ function MyController(hand) {
|
|||
}
|
||||
|
||||
this.intersectionDistance = intersectInfo.distance;
|
||||
this.searchIndicatorOn(intersectInfo.searchRay);
|
||||
if (farGrabEnabled) {
|
||||
this.searchIndicatorOn(intersectInfo.searchRay);
|
||||
}
|
||||
Reticle.setVisible(false);
|
||||
} else {
|
||||
this.setState(STATE_OFF, "grabbed entity was destroyed");
|
||||
|
@ -2681,6 +2691,7 @@ function update(deltaTime) {
|
|||
entityPropertiesCache.update();
|
||||
}
|
||||
|
||||
Messages.subscribe('Hifi-Grab-Disable');
|
||||
Messages.subscribe('Hifi-Hand-Disabler');
|
||||
Messages.subscribe('Hifi-Hand-Grab');
|
||||
Messages.subscribe('Hifi-Hand-RayPick-Blacklist');
|
||||
|
|
Loading…
Reference in a new issue