mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:03:11 +02:00
use messageEquip flag to fix Hifi-Hand-Grab
This commit is contained in:
parent
b70ffa5bae
commit
048872c79a
1 changed files with 10 additions and 9 deletions
|
@ -274,6 +274,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
this.equipedWithSecondary = false;
|
this.equipedWithSecondary = false;
|
||||||
this.handHasBeenRightsideUp = false;
|
this.handHasBeenRightsideUp = false;
|
||||||
this.mouseEquip = false;
|
this.mouseEquip = false;
|
||||||
|
this.messageEquip = false;
|
||||||
|
|
||||||
this.parameters = makeDispatcherModuleParameters(
|
this.parameters = makeDispatcherModuleParameters(
|
||||||
300,
|
300,
|
||||||
|
@ -283,11 +284,10 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
|
|
||||||
var equipHotspotBuddy = new EquipHotspotBuddy();
|
var equipHotspotBuddy = new EquipHotspotBuddy();
|
||||||
|
|
||||||
this.setMessageGrabData = function(entityProperties, mouseEquip) {
|
this.setMessageGrabData = function(entityProperties) {
|
||||||
if (entityProperties) {
|
if (entityProperties) {
|
||||||
this.messageGrabEntity = true;
|
this.messageGrabEntity = true;
|
||||||
this.grabEntityProps = entityProperties;
|
this.grabEntityProps = entityProperties;
|
||||||
this.mouseEquip = mouseEquip;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -585,6 +585,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
this.messageGrabEntity = false;
|
this.messageGrabEntity = false;
|
||||||
this.grabEntityProps = null;
|
this.grabEntityProps = null;
|
||||||
this.mouseEquip = false;
|
this.mouseEquip = false;
|
||||||
|
this.messageEquip = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.updateInputs = function (controllerData) {
|
this.updateInputs = function (controllerData) {
|
||||||
|
@ -661,7 +662,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
var timestamp = Date.now();
|
var timestamp = Date.now();
|
||||||
this.updateInputs(controllerData);
|
this.updateInputs(controllerData);
|
||||||
|
|
||||||
if (!this.mouseEquip && !this.isTargetIDValid(controllerData)) {
|
if (!this.mouseEquip && !this.messageEquip && !this.isTargetIDValid(controllerData)) {
|
||||||
this.endEquipEntity();
|
this.endEquipEntity();
|
||||||
return makeRunningValues(false, [], []);
|
return makeRunningValues(false, [], []);
|
||||||
}
|
}
|
||||||
|
@ -762,9 +763,8 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
var equipModule = (data.hand === "left") ? leftEquipEntity : rightEquipEntity;
|
var equipModule = (data.hand === "left") ? leftEquipEntity : rightEquipEntity;
|
||||||
var entityProperties = Entities.getEntityProperties(data.entityID, DISPATCHER_PROPERTIES);
|
var entityProperties = Entities.getEntityProperties(data.entityID, DISPATCHER_PROPERTIES);
|
||||||
entityProperties.id = data.entityID;
|
entityProperties.id = data.entityID;
|
||||||
var mouseEquip = false;
|
equipModule.messageEquip = true;
|
||||||
equipModule.setMessageGrabData(entityProperties, mouseEquip);
|
equipModule.setMessageGrabData(entityProperties);
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("WARNING: equipEntity.js -- error parsing Hifi-Hand-Grab message: " + message);
|
print("WARNING: equipEntity.js -- error parsing Hifi-Hand-Grab message: " + message);
|
||||||
}
|
}
|
||||||
|
@ -812,15 +812,16 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
var distanceToLeftHand = Vec3.distance(entityProperties.position, leftHandPosition);
|
var distanceToLeftHand = Vec3.distance(entityProperties.position, leftHandPosition);
|
||||||
var leftHandAvailable = leftEquipEntity.targetEntityID === null;
|
var leftHandAvailable = leftEquipEntity.targetEntityID === null;
|
||||||
var rightHandAvailable = rightEquipEntity.targetEntityID === null;
|
var rightHandAvailable = rightEquipEntity.targetEntityID === null;
|
||||||
var mouseEquip = true;
|
|
||||||
if (rightHandAvailable && (distanceToRightHand < distanceToLeftHand || !leftHandAvailable)) {
|
if (rightHandAvailable && (distanceToRightHand < distanceToLeftHand || !leftHandAvailable)) {
|
||||||
// clear any existing grab actions on the entity now (their later removal could affect bootstrapping flags)
|
// clear any existing grab actions on the entity now (their later removal could affect bootstrapping flags)
|
||||||
clearGrabActions(entityID);
|
clearGrabActions(entityID);
|
||||||
rightEquipEntity.setMessageGrabData(entityProperties, mouseEquip);
|
rightEquipEntity.mouseEquip = true;
|
||||||
|
rightEquipEntity.setMessageGrabData(entityProperties);
|
||||||
} else if (leftHandAvailable && (distanceToLeftHand < distanceToRightHand || !rightHandAvailable)) {
|
} else if (leftHandAvailable && (distanceToLeftHand < distanceToRightHand || !rightHandAvailable)) {
|
||||||
// clear any existing grab actions on the entity now (their later removal could affect bootstrapping flags)
|
// clear any existing grab actions on the entity now (their later removal could affect bootstrapping flags)
|
||||||
clearGrabActions(entityID);
|
clearGrabActions(entityID);
|
||||||
leftEquipEntity.setMessageGrabData(entityProperties, mouseEquip);
|
leftEquipEntity.mouseEquip = true;
|
||||||
|
leftEquipEntity.setMessageGrabData(entityProperties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue