mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 03:58:15 +02:00
try to keep far grab from getting stuck if the entity is brought very near to the grab-point
This commit is contained in:
parent
0f98c51d89
commit
ecb0669972
1 changed files with 7 additions and 1 deletions
|
@ -1756,7 +1756,13 @@ function MyController(hand) {
|
||||||
var RADIAL_GRAB_AMPLIFIER = 10.0;
|
var RADIAL_GRAB_AMPLIFIER = 10.0;
|
||||||
if (Math.abs(this.grabRadialVelocity) > 0.0) {
|
if (Math.abs(this.grabRadialVelocity) > 0.0) {
|
||||||
this.grabRadius = this.grabRadius + (this.grabRadialVelocity * deltaObjectTime *
|
this.grabRadius = this.grabRadius + (this.grabRadialVelocity * deltaObjectTime *
|
||||||
this.grabRadius * RADIAL_GRAB_AMPLIFIER);
|
this.grabRadius * RADIAL_GRAB_AMPLIFIER);
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't let grabRadius go all the way to zero, because it can't come back from that
|
||||||
|
var MINIMUM_GRAB_RADIUS = 0.1;
|
||||||
|
if (this.grabRadius < MINIMUM_GRAB_RADIUS) {
|
||||||
|
this.grabRadius = MINIMUM_GRAB_RADIUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newTargetPosition = Vec3.multiply(this.grabRadius, Quat.getUp(worldControllerRotation));
|
var newTargetPosition = Vec3.multiply(this.grabRadius, Quat.getUp(worldControllerRotation));
|
||||||
|
|
Loading…
Reference in a new issue