mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-17 00:06:47 +02:00
fixing case when grabbed target is destroyed
This commit is contained in:
parent
a0ec0f10b4
commit
0dac851def
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 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 deltaObjectTime = (now - this.currentObjectTime) / MSECS_PER_SEC; // convert to seconds
|
||||
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) {
|
||||
if (HMD.active) {
|
||||
if (this.notPointingAtEntity(controllerData)) {
|
||||
|
@ -391,7 +399,7 @@ Script.include("/~/system/libraries/Xform.js");
|
|||
|
||||
this.run = function (controllerData) {
|
||||
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE ||
|
||||
this.notPointingAtEntity(controllerData)) {
|
||||
this.notPointingAtEntity(controllerData) || this.targetIsNull()) {
|
||||
this.endNearGrabAction();
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue