some small bug fixes

This commit is contained in:
druiz17 2017-09-08 11:50:19 -07:00
parent ef050a09f9
commit f0c12e50dd
4 changed files with 11 additions and 6 deletions

View file

@ -167,7 +167,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.isReady = function (controllerData) {
this.targetEntityID = null;
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE) {
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE && controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) {
return makeRunningValues(false, [], []);
}
@ -186,7 +186,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.run = function (controllerData) {
if (this.actionID) {
if (controllerData.triggerClicks[this.hand] === 0) {
if (controllerData.triggerClicks[this.hand] === 0 && controllerData.secondaryValues[this.hand] === 0) {
this.endNearGrabAction();
return makeRunningValues(false, [], []);
}
@ -204,7 +204,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
var targetProps = this.getTargetProps(controllerData);
if (targetProps) {
if (controllerData.triggerClicks[this.hand] === 1) {
if (controllerData.triggerClicks[this.hand] === 1 || controllerData.secondaryValues[this.hand] === 1) {
// switch to grabbing
var targetCloneable = entityIsCloneable(targetProps);
if (targetCloneable) {

View file

@ -128,7 +128,8 @@ var GRAB_RADIUS = 0.35;
};
this.endNearParentingGrabOverlay = function () {
if (this.previousParentID[this.grabbedThingID] === NULL_UUID) {
var previousParentID = this.previousParentID[this.grabbedThingID];
if (previousParentID === NULL_UUID || previousParentID === null || previousParentID === undefined) {
Overlays.editOverlay(this.grabbedThingID, {
parentID: NULL_UUID,
parentJointIndex: -1

View file

@ -429,8 +429,11 @@ Script.include("/~/system/libraries/controllers.js");
this.shouldExit = function(controllerData) {
var intersection = controllerData.rayPicks[this.hand];
var nearGrabName = this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay";
var nearGrabModule = getEnabledModuleByName(nearGrabName);
var status = nearGrabModule ? nearGrabModule.isReady(controllerData) : makeRunningValues(false, [], []);
var offOverlay = (intersection.type !== RayPick.INTERSECTED_OVERLAY);
return offOverlay;
return offOverlay || status.active;
};
this.exitModule = function() {

View file

@ -72,6 +72,7 @@ cloneEntity = function(props, worldEntityProps) {
cloneableProps.name = cloneableProps.name + '-clone-' + cloneableProps.id;
var lifetime = grabInfo.cloneLifetime ? grabInfo.cloneLifetime : 300;
var dynamic = grabInfo.cloneDynamic ? grabInfo.cloneDynamic : false;
var triggerable = grabInfo.triggerable ? grabInfo.triggerable : false;
var cUserData = Object.assign({}, JSON.parse(cloneableProps.userData));
var cProperties = Object.assign({}, cloneableProps);
@ -85,7 +86,7 @@ cloneEntity = function(props, worldEntityProps) {
cProperties.dynamic = dynamic;
cProperties.locked = false;
cUserData.grabbableKey.triggerable = true;
cUserData.grabbableKey.triggerable = triggerable;
cUserData.grabbableKey.grabbable = true;
cProperties.lifetime = lifetime;
cProperties.userData = JSON.stringify(cUserData);