mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:25:52 +02:00
fixing grabbing and tablet bugs
This commit is contained in:
parent
287f4f1d71
commit
3b05317db6
3 changed files with 31 additions and 6 deletions
|
@ -255,6 +255,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
this.messageGrabEntity = false;
|
this.messageGrabEntity = false;
|
||||||
this.grabEntityProps = null;
|
this.grabEntityProps = null;
|
||||||
this.shouldSendStart = false;
|
this.shouldSendStart = false;
|
||||||
|
this.equipedWithSecondary = false;
|
||||||
|
|
||||||
this.parameters = makeDispatcherModuleParameters(
|
this.parameters = makeDispatcherModuleParameters(
|
||||||
300,
|
300,
|
||||||
|
@ -370,6 +371,10 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
return this.rawSecondaryValue < BUMPER_ON_VALUE;
|
return this.rawSecondaryValue < BUMPER_ON_VALUE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.secondarySmoothedSqueezed = function() {
|
||||||
|
return this.rawSecondaryValue > BUMPER_ON_VALUE;
|
||||||
|
};
|
||||||
|
|
||||||
this.chooseNearEquipHotspots = function(candidateEntityProps, controllerData) {
|
this.chooseNearEquipHotspots = function(candidateEntityProps, controllerData) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
var collectedHotspots = flatten(candidateEntityProps.map(function(props) {
|
var collectedHotspots = flatten(candidateEntityProps.map(function(props) {
|
||||||
|
@ -592,11 +597,13 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
// if the potentialHotspot os not cloneable and locked return null
|
// if the potentialHotspot os not cloneable and locked return null
|
||||||
|
|
||||||
if (potentialEquipHotspot &&
|
if (potentialEquipHotspot &&
|
||||||
((this.triggerSmoothedSqueezed() && !this.waitForTriggerRelease) || this.messageGrabEntity)) {
|
(((this.triggerSmoothedSqueezed() || this.secondarySmoothedSqueezed()) && !this.waitForTriggerRelease) ||
|
||||||
|
this.messageGrabEntity)) {
|
||||||
this.grabbedHotspot = potentialEquipHotspot;
|
this.grabbedHotspot = potentialEquipHotspot;
|
||||||
this.targetEntityID = this.grabbedHotspot.entityID;
|
this.targetEntityID = this.grabbedHotspot.entityID;
|
||||||
this.startEquipEntity(controllerData);
|
this.startEquipEntity(controllerData);
|
||||||
this.messageGrabEnity = false;
|
this.messageGrabEnity = false;
|
||||||
|
this.equipedWithSecondary = this.secondarySmoothedSqueezed();
|
||||||
return makeRunningValues(true, [potentialEquipHotspot.entityID], []);
|
return makeRunningValues(true, [potentialEquipHotspot.entityID], []);
|
||||||
} else {
|
} else {
|
||||||
return makeRunningValues(false, [], []);
|
return makeRunningValues(false, [], []);
|
||||||
|
@ -627,7 +634,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
return this.checkNearbyHotspots(controllerData, deltaTime, timestamp);
|
return this.checkNearbyHotspots(controllerData, deltaTime, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controllerData.secondaryValues[this.hand]) {
|
if (controllerData.secondaryValues[this.hand] && !this.equipedWithSecondary) {
|
||||||
// this.secondaryReleased() will always be true when not depressed
|
// this.secondaryReleased() will always be true when not depressed
|
||||||
// so we cannot simply rely on that for release - ensure that the
|
// so we cannot simply rely on that for release - ensure that the
|
||||||
// trigger was first "prepared" by being pushed in before the release
|
// trigger was first "prepared" by being pushed in before the release
|
||||||
|
@ -644,7 +651,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
|
|
||||||
var dropDetected = this.dropGestureProcess(deltaTime);
|
var dropDetected = this.dropGestureProcess(deltaTime);
|
||||||
|
|
||||||
if (this.triggerSmoothedReleased()) {
|
if (this.triggerSmoothedReleased() || this.secondaryReleased()) {
|
||||||
if (this.shouldSendStart) {
|
if (this.shouldSendStart) {
|
||||||
// we don't want to send startEquip message until the trigger is released. otherwise,
|
// we don't want to send startEquip message until the trigger is released. otherwise,
|
||||||
// guns etc will fire right as they are equipped.
|
// guns etc will fire right as they are equipped.
|
||||||
|
@ -653,6 +660,9 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
this.shouldSendStart = false;
|
this.shouldSendStart = false;
|
||||||
}
|
}
|
||||||
this.waitForTriggerRelease = false;
|
this.waitForTriggerRelease = false;
|
||||||
|
if (this.secondaryReleased() && this.equipedWithSecondary) {
|
||||||
|
this.equipedWithSecondary = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropDetected && this.prevDropDetected !== dropDetected) {
|
if (dropDetected && this.prevDropDetected !== dropDetected) {
|
||||||
|
|
|
@ -132,7 +132,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
this.updateLaserPointer = function(controllerData) {
|
this.updateLaserPointer = function(controllerData) {
|
||||||
var SEARCH_SPHERE_SIZE = 0.011;
|
var SEARCH_SPHERE_SIZE = 0.011;
|
||||||
var MIN_SPHERE_SIZE = 0.0005;
|
var MIN_SPHERE_SIZE = 0.0005;
|
||||||
var radius = Math.max(1.2 * SEARCH_SPHERE_SIZE * this.intersectionDistance, MIN_SPHERE_SIZE);
|
var radius = Math.max(1.2 * SEARCH_SPHERE_SIZE * this.intersectionDistance, MIN_SPHERE_SIZE) * MyAvatar.sensorToWorldScale;
|
||||||
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) {
|
||||||
|
@ -424,7 +424,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
this.laserPointerOff();
|
this.laserPointerOff();
|
||||||
return makeRunningValues(false, [], []);
|
return makeRunningValues(false, [], []);
|
||||||
}
|
}
|
||||||
|
this.intersectionDistance = controllerData.rayPicks[this.hand].distance;
|
||||||
this.updateLaserPointer(controllerData);
|
this.updateLaserPointer(controllerData);
|
||||||
|
|
||||||
var otherModuleName =this.hand === RIGHT_HAND ? "LeftFarActionGrabEntity" : "RightFarActionGrabEntity";
|
var otherModuleName =this.hand === RIGHT_HAND ? "LeftFarActionGrabEntity" : "RightFarActionGrabEntity";
|
||||||
|
|
|
@ -152,6 +152,20 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.updateStylus = function() {
|
||||||
|
if (this.stylus) {
|
||||||
|
var X_ROT_NEG_90 = { x: -0.70710678, y: 0, z: 0, w: 0.70710678 };
|
||||||
|
var modelOrientation = Quat.multiply(this.stylusTip.orientation, X_ROT_NEG_90);
|
||||||
|
var modelPositionOffset = Vec3.multiplyQbyV(modelOrientation, { x: 0, y: 0, z: MyAvatar.sensorToWorldScale * -WEB_STYLUS_LENGTH / 2 });
|
||||||
|
|
||||||
|
var stylusProps = {
|
||||||
|
position: Vec3.sum(this.stylusTip.position, modelPositionOffset),
|
||||||
|
rotation: modelOrientation
|
||||||
|
};
|
||||||
|
Overlays.editOverlay(this.stylus, stylusProps);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.showStylus = function() {
|
this.showStylus = function() {
|
||||||
if (this.stylus) {
|
if (this.stylus) {
|
||||||
return;
|
return;
|
||||||
|
@ -320,6 +334,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
if (this.isNearStylusTarget) {
|
if (this.isNearStylusTarget) {
|
||||||
if (!this.useFingerInsteadOfStylus) {
|
if (!this.useFingerInsteadOfStylus) {
|
||||||
this.showStylus();
|
this.showStylus();
|
||||||
|
this.updateStylus();
|
||||||
} else {
|
} else {
|
||||||
this.pointFinger(true);
|
this.pointFinger(true);
|
||||||
}
|
}
|
||||||
|
@ -335,7 +350,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
var SCALED_TABLET_MAX_HOVER_DISTANCE = TABLET_MAX_HOVER_DISTANCE * sensorScaleFactor;
|
var SCALED_TABLET_MAX_HOVER_DISTANCE = TABLET_MAX_HOVER_DISTANCE * sensorScaleFactor;
|
||||||
|
|
||||||
if (nearestStylusTarget && nearestStylusTarget.distance > SCALED_TABLET_MIN_TOUCH_DISTANCE &&
|
if (nearestStylusTarget && nearestStylusTarget.distance > SCALED_TABLET_MIN_TOUCH_DISTANCE &&
|
||||||
nearestStylusTarget.distance < SCALED_TABLET_MAX_HOVER_DISTANCE) {
|
nearestStylusTarget.distance < SCALED_TABLET_MAX_HOVER_DISTANCE && !this.getOtherHandController().stylusTouchingTarget) {
|
||||||
|
|
||||||
this.requestTouchFocus(nearestStylusTarget);
|
this.requestTouchFocus(nearestStylusTarget);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue