mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 19:56:44 +02:00
De-equip goes into a near grab instead of dropping the object.
This commit is contained in:
parent
4b2fb546eb
commit
c7c8046231
1 changed files with 21 additions and 14 deletions
|
@ -228,7 +228,7 @@ function colorPow(color, power) {
|
||||||
return {
|
return {
|
||||||
red: Math.pow(color.red / 255.0, power) * 255,
|
red: Math.pow(color.red / 255.0, power) * 255,
|
||||||
green: Math.pow(color.green / 255.0, power) * 255,
|
green: Math.pow(color.green / 255.0, power) * 255,
|
||||||
blue: Math.pow(color.blue / 255.0, power) * 255,
|
blue: Math.pow(color.blue / 255.0, power) * 255
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,9 +764,8 @@ function MyController(hand) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var SEARCH_SPHERE_ALPHA = 0.5;
|
|
||||||
this.searchSphereOn = function (location, size, color) {
|
this.searchSphereOn = function (location, size, color) {
|
||||||
|
|
||||||
var rotation = Quat.lookAt(location, Camera.getPosition(), Vec3.UP);
|
var rotation = Quat.lookAt(location, Camera.getPosition(), Vec3.UP);
|
||||||
var brightColor = colorPow(color, 0.06);
|
var brightColor = colorPow(color, 0.06);
|
||||||
if (this.searchSphere === null) {
|
if (this.searchSphere === null) {
|
||||||
|
@ -789,7 +788,7 @@ function MyController(hand) {
|
||||||
position: location,
|
position: location,
|
||||||
rotation: rotation,
|
rotation: rotation,
|
||||||
innerColor: brightColor,
|
innerColor: brightColor,
|
||||||
outerColor: color,
|
outerColor: color,
|
||||||
innerAlpha: 1.0,
|
innerAlpha: 1.0,
|
||||||
outerAlpha: 0.0,
|
outerAlpha: 0.0,
|
||||||
outerRadius: size * 1.2,
|
outerRadius: size * 1.2,
|
||||||
|
@ -1960,12 +1959,12 @@ function MyController(hand) {
|
||||||
this.currentObjectRotation = grabbedProperties.rotation;
|
this.currentObjectRotation = grabbedProperties.rotation;
|
||||||
this.currentVelocity = ZERO_VEC;
|
this.currentVelocity = ZERO_VEC;
|
||||||
this.currentAngularVelocity = ZERO_VEC;
|
this.currentAngularVelocity = ZERO_VEC;
|
||||||
|
|
||||||
|
this.prevDropDetected = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.nearGrabbing = function (deltaTime, timestamp) {
|
this.nearGrabbing = function (deltaTime, timestamp) {
|
||||||
|
|
||||||
var dropDetected = this.dropGestureProcess(deltaTime);
|
|
||||||
|
|
||||||
if (this.state == STATE_NEAR_GRABBING && this.triggerSmoothedReleased()) {
|
if (this.state == STATE_NEAR_GRABBING && this.triggerSmoothedReleased()) {
|
||||||
this.callEntityMethodOnGrabbed("releaseGrab");
|
this.callEntityMethodOnGrabbed("releaseGrab");
|
||||||
this.setState(STATE_OFF, "trigger released");
|
this.setState(STATE_OFF, "trigger released");
|
||||||
|
@ -1974,6 +1973,16 @@ function MyController(hand) {
|
||||||
|
|
||||||
if (this.state == STATE_HOLD) {
|
if (this.state == STATE_HOLD) {
|
||||||
|
|
||||||
|
var dropDetected = this.dropGestureProcess(deltaTime);
|
||||||
|
|
||||||
|
if (this.triggerSmoothedReleased()) {
|
||||||
|
this.waitForTriggerRelease = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dropDetected && this.prevDropDetected != dropDetected) {
|
||||||
|
this.waitForTriggerRelease = true;
|
||||||
|
}
|
||||||
|
|
||||||
// highlight the grabbed hotspot when the dropGesture is detected.
|
// highlight the grabbed hotspot when the dropGesture is detected.
|
||||||
if (dropDetected) {
|
if (dropDetected) {
|
||||||
entityPropertiesCache.addEntity(this.grabbedHotspot.entityID);
|
entityPropertiesCache.addEntity(this.grabbedHotspot.entityID);
|
||||||
|
@ -1981,17 +1990,15 @@ function MyController(hand) {
|
||||||
equipHotspotBuddy.highlightHotspot(this.grabbedHotspot);
|
equipHotspotBuddy.highlightHotspot(this.grabbedHotspot);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropDetected && this.triggerSmoothedGrab()) {
|
if (dropDetected && !this.waitForTriggerRelease && this.triggerSmoothedGrab()) {
|
||||||
this.callEntityMethodOnGrabbed("releaseEquip");
|
this.callEntityMethodOnGrabbed("releaseEquip");
|
||||||
this.setState(STATE_OFF, "drop gesture detected");
|
var grabbedEntity = this.grabbedEntity;
|
||||||
return;
|
this.release();
|
||||||
}
|
this.grabbedEntity = grabbedEntity;
|
||||||
|
this.setState(STATE_NEAR_GRABBING, "drop gesture detected");
|
||||||
if (this.thumbPressed()) {
|
|
||||||
this.callEntityMethodOnGrabbed("releaseEquip");
|
|
||||||
this.setState(STATE_OFF, "drop via thumb press");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.prevDropDetected = dropDetected;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.heartBeat(this.grabbedEntity);
|
this.heartBeat(this.grabbedEntity);
|
||||||
|
|
Loading…
Reference in a new issue