mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:18:52 +02:00
fixing case when grabbed target is destroyed
This commit is contained in:
parent
13ce6bbabd
commit
7c21db93a3
1 changed files with 10 additions and 2 deletions
|
@ -208,7 +208,7 @@ Script.include("/~/system/libraries/Xform.js");
|
||||||
var worldToSensorMat = Mat4.inverse(MyAvatar.getSensorToWorldMatrix());
|
var worldToSensorMat = Mat4.inverse(MyAvatar.getSensorToWorldMatrix());
|
||||||
var roomControllerPosition = Mat4.transformPoint(worldToSensorMat, worldControllerPosition);
|
var roomControllerPosition = Mat4.transformPoint(worldToSensorMat, worldControllerPosition);
|
||||||
|
|
||||||
var grabbedProperties = Entities.getEntityProperties(this.grabbedThingID, ["position"]);
|
var grabbedProperties = Entities.getEntityProperties(this.grabbedThingID, GRABBABLE_PROPERTIES);
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
var deltaObjectTime = (now - this.currentObjectTime) / MSECS_PER_SEC; // convert to seconds
|
var deltaObjectTime = (now - this.currentObjectTime) / MSECS_PER_SEC; // convert to seconds
|
||||||
this.currentObjectTime = now;
|
this.currentObjectTime = now;
|
||||||
|
@ -369,6 +369,14 @@ Script.include("/~/system/libraries/Xform.js");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.targetIsNull = function() {
|
||||||
|
var properties = Entities.getEntityProperties(this.grabbedThingID);
|
||||||
|
if (Object.keys(properties).length === 0 && this.distanceHolding) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
this.isReady = function (controllerData) {
|
this.isReady = function (controllerData) {
|
||||||
if (HMD.active) {
|
if (HMD.active) {
|
||||||
if (this.notPointingAtEntity(controllerData)) {
|
if (this.notPointingAtEntity(controllerData)) {
|
||||||
|
@ -391,7 +399,7 @@ Script.include("/~/system/libraries/Xform.js");
|
||||||
|
|
||||||
this.run = function (controllerData) {
|
this.run = function (controllerData) {
|
||||||
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE ||
|
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE ||
|
||||||
this.notPointingAtEntity(controllerData)) {
|
this.notPointingAtEntity(controllerData) || this.targetIsNull()) {
|
||||||
this.endNearGrabAction();
|
this.endNearGrabAction();
|
||||||
return makeRunningValues(false, [], []);
|
return makeRunningValues(false, [], []);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue