3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-26 07:15:37 +02:00

Merge pull request from AndrewMeadows/zero-vel-neargrab-nondynamic

Case 19495: zero velocities of non-dynamic entities on nearGrab release
This commit is contained in:
Jeff Clinton 2018-11-09 10:10:49 -08:00 committed by GitHub
commit 3d01949e43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 15 deletions
scripts/system/controllers/controllerModules

View file

@ -262,7 +262,9 @@ Script.include("/~/system/libraries/controllers.js");
if (this.thisFarGrabJointIsParent(endProps)) {
Entities.editEntity(this.targetEntityID, {
parentID: this.previousParentID[this.targetEntityID],
parentJointIndex: this.previousParentJointIndex[this.targetEntityID]
parentJointIndex: this.previousParentJointIndex[this.targetEntityID],
localVelocity: {x: 0, y: 0, z: 0},
localAngularVelocity: {x: 0, y: 0, z: 0}
});
}

View file

@ -149,20 +149,12 @@ Script.include("/~/system/libraries/controllers.js");
this.hapticTargetID = null;
var props = controllerData.nearbyEntityPropertiesByID[this.targetEntityID];
if (this.thisHandIsParent(props) && !this.robbed) {
if (this.previousParentID[this.targetEntityID] === Uuid.NULL || this.previousParentID === undefined) {
Entities.editEntity(this.targetEntityID, {
parentID: this.previousParentID[this.targetEntityID],
parentJointIndex: this.previousParentJointIndex[this.targetEntityID]
});
} else {
// we're putting this back as a child of some other parent, so zero its velocity
Entities.editEntity(this.targetEntityID, {
parentID: this.previousParentID[this.targetEntityID],
parentJointIndex: this.previousParentJointIndex[this.targetEntityID],
localVelocity: {x: 0, y: 0, z: 0},
localAngularVelocity: {x: 0, y: 0, z: 0}
});
}
Entities.editEntity(this.targetEntityID, {
parentID: this.previousParentID[this.targetEntityID],
parentJointIndex: this.previousParentJointIndex[this.targetEntityID],
localVelocity: {x: 0, y: 0, z: 0},
localAngularVelocity: {x: 0, y: 0, z: 0}
});
}
var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];