mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
fixing some small issues
This commit is contained in:
parent
684aef23dc
commit
b634292261
6 changed files with 30 additions and 8 deletions
|
@ -137,7 +137,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
var dim = {x: radius, y: radius, z: radius};
|
||||
var mode = "hold";
|
||||
if (!this.distanceHolding && !this.distanceRotating) {
|
||||
if (controllerData.triggerValues[this.hand] === 1) {
|
||||
if (controllerData.triggerClicks[this.hand]) {
|
||||
mode = "full";
|
||||
} else {
|
||||
mode = "half";
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
getControllerJointIndex, getGrabbableData, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
|
||||
propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, entityIsGrabbable,
|
||||
Quat, Vec3, MSECS_PER_SEC, getControllerWorldLocation, makeDispatcherModuleParameters, makeRunningValues,
|
||||
TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS, findGroupParent, entityIsCloneable, propsAreCloneDynamic, cloneEntity
|
||||
TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS, findGroupParent, entityIsCloneable, propsAreCloneDynamic, cloneEntity,
|
||||
HAPTIC_PULSE_STRENGTH, HAPTIC_STYLUS_DURATION
|
||||
*/
|
||||
|
||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
|
@ -22,6 +23,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
this.hand = hand;
|
||||
this.targetEntityID = null;
|
||||
this.actionID = null; // action this script created...
|
||||
this.hapticTargetID = null;
|
||||
|
||||
this.parameters = makeDispatcherModuleParameters(
|
||||
500,
|
||||
|
@ -152,6 +154,10 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
break;
|
||||
}
|
||||
if (entityIsGrabbable(props) || entityIsCloneable(props)) {
|
||||
if (props.id !== this.hapticTargetID) {
|
||||
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);
|
||||
this.hapticTargetID = props.id;
|
||||
}
|
||||
// if we've attempted to grab a child, roll up to the root of the tree
|
||||
var groupRootProps = findGroupParent(controllerData, props);
|
||||
if (entityIsGrabbable(groupRootProps)) {
|
||||
|
@ -166,11 +172,11 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
this.isReady = function (controllerData) {
|
||||
this.targetEntityID = null;
|
||||
|
||||
var targetProps = this.getTargetProps(controllerData);
|
||||
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE && controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) {
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
||||
var targetProps = this.getTargetProps(controllerData);
|
||||
if (targetProps) {
|
||||
if (!propsArePhysical(targetProps) && !propsAreCloneDynamic(targetProps)) {
|
||||
return makeRunningValues(false, [], []); // let nearParentGrabEntity handle it
|
||||
|
@ -179,6 +185,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
return makeRunningValues(true, [this.targetEntityID], []);
|
||||
}
|
||||
} else {
|
||||
this.hapticTargetID = null;
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
};
|
||||
|
@ -187,6 +194,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
if (this.actionID) {
|
||||
if (controllerData.triggerClicks[this.hand] === 0 && controllerData.secondaryValues[this.hand] === 0) {
|
||||
this.endNearGrabAction();
|
||||
this.hapticTargetID = null;
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
getControllerJointIndex, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
|
||||
propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE,
|
||||
makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS,
|
||||
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic
|
||||
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH, HAPTIC_STYLUS_DURATION
|
||||
*/
|
||||
|
||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
|
@ -28,6 +28,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
this.previousParentID = {};
|
||||
this.previousParentJointIndex = {};
|
||||
this.previouslyUnhooked = {};
|
||||
this.hapticTargetID = null;
|
||||
|
||||
this.parameters = makeDispatcherModuleParameters(
|
||||
500,
|
||||
|
@ -154,6 +155,11 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
continue;
|
||||
}
|
||||
if (entityIsGrabbable(props)) {
|
||||
// give haptic feedback
|
||||
if (props.id !== this.hapticTargetID) {
|
||||
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);
|
||||
this.hapticTargetID = props.id;
|
||||
}
|
||||
// if we've attempted to grab a child, roll up to the root of the tree
|
||||
var groupRootProps = findGroupParent(controllerData, props);
|
||||
if (entityIsGrabbable(groupRootProps)) {
|
||||
|
@ -169,11 +175,11 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
this.targetEntityID = null;
|
||||
this.grabbing = false;
|
||||
|
||||
var targetProps = this.getTargetProps(controllerData);
|
||||
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE && controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) {
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
||||
var targetProps = this.getTargetProps(controllerData);
|
||||
if (targetProps) {
|
||||
if (propsArePhysical(targetProps) || propsAreCloneDynamic(targetProps)) {
|
||||
return makeRunningValues(false, [], []); // let nearActionGrabEntity handle it
|
||||
|
@ -182,6 +188,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
return makeRunningValues(true, [this.targetEntityID], []);
|
||||
}
|
||||
} else {
|
||||
this.hapticTargetID = null;
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
};
|
||||
|
@ -190,6 +197,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
if (this.grabbing) {
|
||||
if (controllerData.triggerClicks[this.hand] === 0 && controllerData.secondaryValues[this.hand] === 0) {
|
||||
this.endNearParentingGrabEntity();
|
||||
this.hapticTargetID = null;
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
||||
|
@ -197,6 +205,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
if (!this.thisHandIsParent(props)) {
|
||||
this.grabbing = false;
|
||||
this.targetEntityID = null;
|
||||
this.hapticTargetID = null;
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
||||
|
|
|
@ -433,7 +433,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
var nearGrabModule = getEnabledModuleByName(nearGrabName);
|
||||
var status = nearGrabModule ? nearGrabModule.isReady(controllerData) : makeRunningValues(false, [], []);
|
||||
var offOverlay = (intersection.type !== RayPick.INTERSECTED_OVERLAY);
|
||||
var triggerOff = (controllerData.triggerValues[this.hand] === 0);
|
||||
var triggerOff = (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE);
|
||||
return offOverlay || status.active || triggerOff;
|
||||
};
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
//Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
(function () {
|
||||
var dispatcherUtils = Script.require("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
|
||||
var BUMPER_ON_VALUE = 0.5;
|
||||
function ScaleAvatar(hand) {
|
||||
this.hand = hand;
|
||||
this.scalingStartAvatarScale = 0;
|
||||
|
@ -38,7 +38,7 @@
|
|||
};
|
||||
|
||||
this.triggersPressed = function(controllerData) {
|
||||
if (controllerData.triggerValues[this.hand] === 1 && controllerData.secondaryValues[this.hand] === 1) {
|
||||
if (controllerData.triggerClicks[this.hand] && controllerData.secondaryValues[this.hand] > BUMPER_ON_VALUE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
COLORS_GRAB_DISTANCE_HOLD:true,
|
||||
NEAR_GRAB_RADIUS:true,
|
||||
DISPATCHER_PROPERTIES:true,
|
||||
HAPTIC_PULSE_STRENGTH:true,
|
||||
HAPTIC_PULSE_DURATION:true,
|
||||
Entities,
|
||||
makeDispatcherModuleParameters:true,
|
||||
makeRunningValues:true,
|
||||
|
@ -42,6 +44,9 @@
|
|||
MSECS_PER_SEC = 1000.0;
|
||||
INCHES_TO_METERS = 1.0 / 39.3701;
|
||||
|
||||
HAPTIC_PULSE_STRENGTH = 1.0;
|
||||
HAPTIC_PULSE_DURATION = 13.0;
|
||||
|
||||
ZERO_VEC = { x: 0, y: 0, z: 0 };
|
||||
ONE_VEC = { x: 1, y: 1, z: 1 };
|
||||
|
||||
|
|
Loading…
Reference in a new issue