mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 16:36:54 +02:00
kill gravity in near-held objects
This commit is contained in:
parent
6a770a870b
commit
26310d8ce4
1 changed files with 5 additions and 1 deletions
|
@ -431,7 +431,7 @@ function MyController(hand, triggerAction) {
|
||||||
|
|
||||||
this.activateEntity(this.grabbedEntity);
|
this.activateEntity(this.grabbedEntity);
|
||||||
|
|
||||||
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, ["position", "rotation"]);
|
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, ["position", "rotation", "gravity"]);
|
||||||
|
|
||||||
var handRotation = this.getHandRotation();
|
var handRotation = this.getHandRotation();
|
||||||
var handPosition = this.getHandPosition();
|
var handPosition = this.getHandPosition();
|
||||||
|
@ -443,6 +443,9 @@ function MyController(hand, triggerAction) {
|
||||||
var offset = Vec3.subtract(currentObjectPosition, handPosition);
|
var offset = Vec3.subtract(currentObjectPosition, handPosition);
|
||||||
var offsetPosition = Vec3.multiplyQbyV(Quat.inverse(Quat.multiply(handRotation, offsetRotation)), offset);
|
var offsetPosition = Vec3.multiplyQbyV(Quat.inverse(Quat.multiply(handRotation, offsetRotation)), offset);
|
||||||
|
|
||||||
|
this.saveGravity = grabbedProperties.gravity;
|
||||||
|
Entities.editEntity(this.grabbedEntity, {gravity: {x:0, y:0, z:0}});
|
||||||
|
|
||||||
this.actionID = NULL_ACTION_ID;
|
this.actionID = NULL_ACTION_ID;
|
||||||
this.actionID = Entities.addAction("kinematic-hold", this.grabbedEntity, {
|
this.actionID = Entities.addAction("kinematic-hold", this.grabbedEntity, {
|
||||||
hand: this.hand === RIGHT_HAND ? "right" : "left",
|
hand: this.hand === RIGHT_HAND ? "right" : "left",
|
||||||
|
@ -472,6 +475,7 @@ function MyController(hand, triggerAction) {
|
||||||
this.continueNearGrabbing = function() {
|
this.continueNearGrabbing = function() {
|
||||||
if (this.triggerSmoothedReleased()) {
|
if (this.triggerSmoothedReleased()) {
|
||||||
this.state = STATE_RELEASE;
|
this.state = STATE_RELEASE;
|
||||||
|
Entities.editEntity(this.grabbedEntity, {gravity: this.saveGravity});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue