mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 13:07:04 +02:00
bug fix for far-grab pulling the object in the wrong direction
This commit is contained in:
parent
959a2f9915
commit
212175bdaa
1 changed files with 4 additions and 3 deletions
|
@ -1685,8 +1685,9 @@ function MyController(hand) {
|
||||||
radius = 1.0;
|
radius = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var handDelta = Vec3.subtract(roomControllerPosition, this.previousRoomControllerPosition);
|
var roomHandDelta = Vec3.subtract(roomControllerPosition, this.previousRoomControllerPosition);
|
||||||
var handMoved = Vec3.multiply(handDelta, radius);
|
var worldHandDelta = Mat4.transformVector(MyAvatar.getSensorToWorldMatrix(), roomHandDelta);
|
||||||
|
var handMoved = Vec3.multiply(worldHandDelta, radius);
|
||||||
this.currentObjectPosition = Vec3.sum(this.currentObjectPosition, handMoved);
|
this.currentObjectPosition = Vec3.sum(this.currentObjectPosition, handMoved);
|
||||||
|
|
||||||
this.callEntityMethodOnGrabbed("continueDistantGrab");
|
this.callEntityMethodOnGrabbed("continueDistantGrab");
|
||||||
|
@ -1698,7 +1699,7 @@ function MyController(hand) {
|
||||||
var handControllerData = getEntityCustomData('handControllerKey', this.grabbedEntity, defaultMoveWithHeadData);
|
var handControllerData = getEntityCustomData('handControllerKey', this.grabbedEntity, defaultMoveWithHeadData);
|
||||||
|
|
||||||
// Update radialVelocity
|
// Update radialVelocity
|
||||||
var lastVelocity = Vec3.multiply(handDelta, 1.0 / deltaObjectTime);
|
var lastVelocity = Vec3.multiply(worldHandDelta, 1.0 / deltaObjectTime);
|
||||||
var delta = Vec3.normalize(Vec3.subtract(grabbedProperties.position, worldControllerPosition));
|
var delta = Vec3.normalize(Vec3.subtract(grabbedProperties.position, worldControllerPosition));
|
||||||
var newRadialVelocity = Vec3.dot(lastVelocity, delta);
|
var newRadialVelocity = Vec3.dot(lastVelocity, delta);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue