mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 17:49:27 +02:00
turn-off nearEntityGrab when scaleEntity is active
This commit is contained in:
parent
fc128b49de
commit
6f25c59a0c
2 changed files with 14 additions and 21 deletions
|
@ -6,13 +6,12 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
|
||||||
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, getControllerJointIndex,
|
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, getControllerJointIndex, enableDispatcherModule,
|
||||||
enableDispatcherModule, disableDispatcherModule, propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
|
disableDispatcherModule, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE,
|
||||||
TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS,
|
makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS, findGroupParent, Vec3,
|
||||||
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH,
|
cloneEntity, entityIsCloneable, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, TEAR_AWAY_DISTANCE,
|
||||||
HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, findHandChildEntities, TEAR_AWAY_DISTANCE, MSECS_PER_SEC, TEAR_AWAY_CHECK_TIME,
|
distanceBetweenPointAndEntityBoundingBox, highlightTargetEntity, unhighlightTargetEntity, getGrabbableData,
|
||||||
TEAR_AWAY_COUNT, distanceBetweenPointAndEntityBoundingBox, Uuid, highlightTargetEntity, unhighlightTargetEntity,
|
DISPATCHER_PROPERTIES, HMD
|
||||||
distanceBetweenEntityLocalPositionAndBoundingBox, getGrabbableData, getGrabPointSphereOffset, DISPATCHER_PROPERTIES
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
|
@ -21,18 +20,6 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
// XXX this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true;
|
|
||||||
// XXX this.kinematicGrab = (grabbableData.kinematic !== undefined) ? grabbableData.kinematic : NEAR_GRABBING_KINEMATIC;
|
|
||||||
|
|
||||||
// this offset needs to match the one in libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp:378
|
|
||||||
var GRAB_POINT_SPHERE_OFFSET = { x: 0.04, y: 0.13, z: 0.039 }; // x = upward, y = forward, z = lateral
|
|
||||||
|
|
||||||
function getGrabOffset(handController) {
|
|
||||||
var offset = getGrabPointSphereOffset(handController, true);
|
|
||||||
offset.y = -offset.y;
|
|
||||||
return Vec3.multiply(MyAvatar.sensorToWorldScale, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
function NearGrabEntity(hand) {
|
function NearGrabEntity(hand) {
|
||||||
this.hand = hand;
|
this.hand = hand;
|
||||||
this.targetEntityID = null;
|
this.targetEntityID = null;
|
||||||
|
@ -95,7 +82,6 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hapticTargetID = null;
|
this.hapticTargetID = null;
|
||||||
var props = controllerData.nearbyEntityPropertiesByID[this.targetEntityID];
|
|
||||||
|
|
||||||
var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
|
var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
|
||||||
Entities.callEntityMethod(this.targetEntityID, "releaseGrab", args);
|
Entities.callEntityMethod(this.targetEntityID, "releaseGrab", args);
|
||||||
|
@ -176,6 +162,13 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
return makeRunningValues(false, [], []);
|
return makeRunningValues(false, [], []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (controllerData.secondaryValues[LEFT_HAND] >= TRIGGER_ON_VALUE &&
|
||||||
|
controllerData.secondaryValues[RIGHT_HAND] >= TRIGGER_ON_VALUE) {
|
||||||
|
// let scaleEntity module take over
|
||||||
|
this.endNearGrabEntity(controllerData);
|
||||||
|
return makeRunningValues(false, [], []);
|
||||||
|
}
|
||||||
|
|
||||||
var props = controllerData.nearbyEntityPropertiesByID[this.targetEntityID];
|
var props = controllerData.nearbyEntityPropertiesByID[this.targetEntityID];
|
||||||
if (!props) {
|
if (!props) {
|
||||||
props = Entities.getEntityProperties(this.targetEntityID, DISPATCHER_PROPERTIES);
|
props = Entities.getEntityProperties(this.targetEntityID, DISPATCHER_PROPERTIES);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
this.parameters = dispatcherUtils.makeDispatcherModuleParameters(
|
this.parameters = dispatcherUtils.makeDispatcherModuleParameters(
|
||||||
120,
|
120,
|
||||||
this.hand === RIGHT_HAND ? ["rightHandTrigger"] : ["leftHandTrigger"],
|
this.hand === RIGHT_HAND ? ["rightHandTrigger", "rightHand"] : ["leftHandTrigger", "leftHand"],
|
||||||
[],
|
[],
|
||||||
100
|
100
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue