mirror of
https://github.com/JulianGro/overte.git
synced 2025-05-08 08:29:27 +02:00
Merge pull request #8327 from PhilipRosedale/autoReverb
Tuned haptic pulses for grab, release, equip, de-quip
This commit is contained in:
commit
2f80c5b68c
1 changed files with 28 additions and 9 deletions
|
@ -38,6 +38,15 @@ var BUMPER_ON_VALUE = 0.5;
|
||||||
|
|
||||||
var THUMB_ON_VALUE = 0.5;
|
var THUMB_ON_VALUE = 0.5;
|
||||||
|
|
||||||
|
var HAPTIC_PULSE_STRENGTH = 1.0;
|
||||||
|
var HAPTIC_PULSE_DURATION = 13.0;
|
||||||
|
var HAPTIC_TEXTURE_STRENGTH = 0.1;
|
||||||
|
var HAPTIC_TEXTURE_DURATION = 3.0;
|
||||||
|
var HAPTIC_TEXTURE_DISTANCE = 0.002;
|
||||||
|
var HAPTIC_DEQUIP_STRENGTH = 0.75;
|
||||||
|
var HAPTIC_DEQUIP_DURATION = 50.0;
|
||||||
|
|
||||||
|
|
||||||
var HAND_HEAD_MIX_RATIO = 0.0; // 0 = only use hands for search/move. 1 = only use head for search/move.
|
var HAND_HEAD_MIX_RATIO = 0.0; // 0 = only use hands for search/move. 1 = only use head for search/move.
|
||||||
|
|
||||||
var PICK_WITH_HAND_RAY = true;
|
var PICK_WITH_HAND_RAY = true;
|
||||||
|
@ -934,7 +943,7 @@ function MyController(hand) {
|
||||||
entityPropertiesCache.addEntities(candidateEntities);
|
entityPropertiesCache.addEntities(candidateEntities);
|
||||||
var potentialEquipHotspot = this.chooseBestEquipHotspot(candidateEntities);
|
var potentialEquipHotspot = this.chooseBestEquipHotspot(candidateEntities);
|
||||||
if (!this.waitForTriggerRelease) {
|
if (!this.waitForTriggerRelease) {
|
||||||
this.updateEquipHaptics(potentialEquipHotspot);
|
this.updateEquipHaptics(potentialEquipHotspot, this.getHandPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
var nearEquipHotspots = this.chooseNearEquipHotspots(candidateEntities, EQUIP_HOTSPOT_RENDER_RADIUS);
|
var nearEquipHotspots = this.chooseNearEquipHotspots(candidateEntities, EQUIP_HOTSPOT_RENDER_RADIUS);
|
||||||
|
@ -948,10 +957,14 @@ function MyController(hand) {
|
||||||
this.prevPotentialEquipHotspot = null;
|
this.prevPotentialEquipHotspot = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.updateEquipHaptics = function(potentialEquipHotspot) {
|
this.updateEquipHaptics = function(potentialEquipHotspot, currentLocation) {
|
||||||
if (potentialEquipHotspot && !this.prevPotentialEquipHotspot ||
|
if (potentialEquipHotspot && !this.prevPotentialEquipHotspot ||
|
||||||
!potentialEquipHotspot && this.prevPotentialEquipHotspot) {
|
!potentialEquipHotspot && this.prevPotentialEquipHotspot) {
|
||||||
Controller.triggerShortHapticPulse(0.5, this.hand);
|
Controller.triggerHapticPulse(HAPTIC_TEXTURE_STRENGTH, HAPTIC_TEXTURE_DURATION, this.hand);
|
||||||
|
this.lastHapticPulseLocation = currentLocation;
|
||||||
|
} else if (potentialEquipHotspot && Vec3.distance(this.lastHapticPulseLocation, currentLocation) > HAPTIC_TEXTURE_DISTANCE) {
|
||||||
|
Controller.triggerHapticPulse(HAPTIC_TEXTURE_STRENGTH, HAPTIC_TEXTURE_DURATION, this.hand);
|
||||||
|
this.lastHapticPulseLocation = currentLocation;
|
||||||
}
|
}
|
||||||
this.prevPotentialEquipHotspot = potentialEquipHotspot;
|
this.prevPotentialEquipHotspot = potentialEquipHotspot;
|
||||||
};
|
};
|
||||||
|
@ -1337,7 +1350,7 @@ function MyController(hand) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateEquipHaptics(potentialEquipHotspot);
|
this.updateEquipHaptics(potentialEquipHotspot, handPosition);
|
||||||
|
|
||||||
var nearEquipHotspots = this.chooseNearEquipHotspots(candidateEntities, EQUIP_HOTSPOT_RENDER_RADIUS);
|
var nearEquipHotspots = this.chooseNearEquipHotspots(candidateEntities, EQUIP_HOTSPOT_RENDER_RADIUS);
|
||||||
equipHotspotBuddy.updateHotspots(nearEquipHotspots, timestamp);
|
equipHotspotBuddy.updateHotspots(nearEquipHotspots, timestamp);
|
||||||
|
@ -1422,13 +1435,16 @@ function MyController(hand) {
|
||||||
this.callEntityMethodOnGrabbed("startDistanceGrab");
|
this.callEntityMethodOnGrabbed("startDistanceGrab");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);
|
||||||
|
|
||||||
this.turnOffVisualizations();
|
this.turnOffVisualizations();
|
||||||
|
|
||||||
this.previousRoomControllerPosition = roomControllerPosition;
|
this.previousRoomControllerPosition = roomControllerPosition;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.distanceHolding = function(deltaTime, timestamp) {
|
this.distanceHolding = function(deltaTime, timestamp) {
|
||||||
if (this.triggerSmoothedReleased()) {
|
|
||||||
|
if (!this.triggerClicked) {
|
||||||
this.callEntityMethodOnGrabbed("releaseGrab");
|
this.callEntityMethodOnGrabbed("releaseGrab");
|
||||||
this.setState(STATE_OFF, "trigger released");
|
this.setState(STATE_OFF, "trigger released");
|
||||||
return;
|
return;
|
||||||
|
@ -1611,7 +1627,7 @@ function MyController(hand) {
|
||||||
|
|
||||||
if (handIsUpsideDown != this.prevHandIsUpsideDown) {
|
if (handIsUpsideDown != this.prevHandIsUpsideDown) {
|
||||||
this.prevHandIsUpsideDown = handIsUpsideDown;
|
this.prevHandIsUpsideDown = handIsUpsideDown;
|
||||||
Controller.triggerShortHapticPulse(0.5, this.hand);
|
Controller.triggerHapticPulse(HAPTIC_DEQUIP_STRENGTH, HAPTIC_DEQUIP_DURATION, this.hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
return handIsUpsideDown;
|
return handIsUpsideDown;
|
||||||
|
@ -1625,7 +1641,7 @@ function MyController(hand) {
|
||||||
this.dropGestureReset();
|
this.dropGestureReset();
|
||||||
this.clearEquipHaptics();
|
this.clearEquipHaptics();
|
||||||
|
|
||||||
Controller.triggerShortHapticPulse(1.0, this.hand);
|
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);
|
||||||
|
|
||||||
if (this.entityActivated) {
|
if (this.entityActivated) {
|
||||||
var saveGrabbedID = this.grabbedEntity;
|
var saveGrabbedID = this.grabbedEntity;
|
||||||
|
@ -1746,7 +1762,7 @@ function MyController(hand) {
|
||||||
|
|
||||||
this.nearGrabbing = function(deltaTime, timestamp) {
|
this.nearGrabbing = function(deltaTime, timestamp) {
|
||||||
|
|
||||||
if (this.state == STATE_NEAR_GRABBING && this.triggerSmoothedReleased()) {
|
if (this.state == STATE_NEAR_GRABBING && !this.triggerClicked) {
|
||||||
this.callEntityMethodOnGrabbed("releaseGrab");
|
this.callEntityMethodOnGrabbed("releaseGrab");
|
||||||
this.setState(STATE_OFF, "trigger released");
|
this.setState(STATE_OFF, "trigger released");
|
||||||
return;
|
return;
|
||||||
|
@ -1950,6 +1966,9 @@ function MyController(hand) {
|
||||||
var noVelocity = false;
|
var noVelocity = false;
|
||||||
if (this.grabbedEntity !== null) {
|
if (this.grabbedEntity !== null) {
|
||||||
|
|
||||||
|
// Make a small release haptic pulse if we really were holding something
|
||||||
|
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);
|
||||||
|
|
||||||
// If this looks like the release after adjusting something still held in the other hand, print the position
|
// If this looks like the release after adjusting something still held in the other hand, print the position
|
||||||
// and rotation of the held thing to help content creators set the userData.
|
// and rotation of the held thing to help content creators set the userData.
|
||||||
var grabData = getEntityCustomData(GRAB_USER_DATA_KEY, this.grabbedEntity, {});
|
var grabData = getEntityCustomData(GRAB_USER_DATA_KEY, this.grabbedEntity, {});
|
||||||
|
|
Loading…
Reference in a new issue