mirror of
https://github.com/overte-org/overte.git
synced 2025-06-18 23:40:54 +02:00
Add minimum distance that you need to pull bow arrow back to shoot
This commit is contained in:
parent
9e39d0a0bb
commit
ae4879afeb
1 changed files with 8 additions and 10 deletions
|
@ -110,10 +110,6 @@ function getControllerLocation(controllerHand) {
|
||||||
z: 0.93
|
z: 0.93
|
||||||
};
|
};
|
||||||
|
|
||||||
const MIN_ARROW_DISTANCE_FROM_BOW_REST = 0.2;
|
|
||||||
const MAX_ARROW_DISTANCE_FROM_BOW_REST = ARROW_DIMENSIONS.z - 0.2;
|
|
||||||
const MIN_ARROW_DISTANCE_FROM_BOW_REST_TO_SHOOT = 0.2;
|
|
||||||
|
|
||||||
const MIN_ARROW_SPEED = 3;
|
const MIN_ARROW_SPEED = 3;
|
||||||
const MAX_ARROW_SPEED = 30;
|
const MAX_ARROW_SPEED = 30;
|
||||||
|
|
||||||
|
@ -140,8 +136,12 @@ function getControllerLocation(controllerHand) {
|
||||||
const DRAW_STRING_THRESHOLD = 0.80;
|
const DRAW_STRING_THRESHOLD = 0.80;
|
||||||
const DRAW_STRING_PULL_DELTA_HAPTIC_PULSE = 0.09;
|
const DRAW_STRING_PULL_DELTA_HAPTIC_PULSE = 0.09;
|
||||||
const DRAW_STRING_MAX_DRAW = 0.7;
|
const DRAW_STRING_MAX_DRAW = 0.7;
|
||||||
const NEAR_TO_RELAXED_KNOCK_DISTANCE = 0.5; // if the hand is this close, rez the arrow
|
|
||||||
const NEAR_TO_RELAXED_SCHMITT = 0.05;
|
|
||||||
|
const MIN_ARROW_DISTANCE_FROM_BOW_REST = 0.2;
|
||||||
|
const MAX_ARROW_DISTANCE_FROM_BOW_REST = ARROW_DIMENSIONS.z - 0.2;
|
||||||
|
const MIN_HAND_DISTANCE_FROM_BOW_TO_KNOCK_ARROW = 0.25;
|
||||||
|
const MIN_ARROW_DISTANCE_FROM_BOW_REST_TO_SHOOT = 0.30;
|
||||||
|
|
||||||
const NOTCH_OFFSET_FORWARD = 0.08;
|
const NOTCH_OFFSET_FORWARD = 0.08;
|
||||||
const NOTCH_OFFSET_UP = 0.035;
|
const NOTCH_OFFSET_UP = 0.035;
|
||||||
|
@ -287,8 +287,7 @@ function getControllerLocation(controllerHand) {
|
||||||
this.pullBackDistance = 0;
|
this.pullBackDistance = 0;
|
||||||
|
|
||||||
this.resetStringToIdlePosition();
|
this.resetStringToIdlePosition();
|
||||||
//this.deleteStrings();
|
if (this.triggerValue >= DRAW_STRING_THRESHOLD && pullBackDistance < MIN_HAND_DISTANCE_FROM_BOW_TO_KNOCK_ARROW && !this.backHandBusy) {
|
||||||
if (this.triggerValue >= DRAW_STRING_THRESHOLD && pullBackDistance < (NEAR_TO_RELAXED_KNOCK_DISTANCE - NEAR_TO_RELAXED_SCHMITT) && !this.backHandBusy) {
|
|
||||||
//the first time aiming the arrow
|
//the first time aiming the arrow
|
||||||
var handToDisable = (this.hand === 'right' ? 'left' : 'right');
|
var handToDisable = (this.hand === 'right' ? 'left' : 'right');
|
||||||
this.state = STATE_ARROW_GRABBED;
|
this.state = STATE_ARROW_GRABBED;
|
||||||
|
@ -305,8 +304,7 @@ function getControllerLocation(controllerHand) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.triggerValue < DRAW_STRING_THRESHOLD) {
|
if (this.triggerValue < DRAW_STRING_THRESHOLD) {
|
||||||
// they let go without pulling
|
if (pullBackDistance >= (MIN_ARROW_DISTANCE_FROM_BOW_REST_TO_SHOOT)) {
|
||||||
if (pullBackDistance >= (MIN_ARROW_DISTANCE_FROM_BOW_REST_TO_SHOOT + NEAR_TO_RELAXED_SCHMITT)) {
|
|
||||||
// The arrow has been pulled far enough back that we can release it
|
// The arrow has been pulled far enough back that we can release it
|
||||||
Messages.sendLocalMessage('Hifi-Hand-Disabler', "none");
|
Messages.sendLocalMessage('Hifi-Hand-Disabler', "none");
|
||||||
this.updateArrowPositionInNotch(true, true);
|
this.updateArrowPositionInNotch(true, true);
|
||||||
|
|
Loading…
Reference in a new issue