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