mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
near-trigger works? equip calls its entity methods now
This commit is contained in:
parent
ddca25672f
commit
3b61e8518f
3 changed files with 18 additions and 12 deletions
|
@ -148,8 +148,8 @@ getGrabbableData = function (props) {
|
|||
} catch (err) {
|
||||
userDataParsed = {};
|
||||
}
|
||||
if (userDataParsed.grabbable) {
|
||||
grabbableData = userDataParsed.grabbable;
|
||||
if (userDataParsed.grabbableKey) {
|
||||
grabbableData = userDataParsed.grabbableKey;
|
||||
}
|
||||
if (!grabbableData.hasOwnProperty("grabbable")) {
|
||||
grabbableData.grabbable = true;
|
||||
|
@ -163,6 +163,9 @@ getGrabbableData = function (props) {
|
|||
if (!grabbableData.hasOwnProperty("wantsTrigger")) {
|
||||
grabbableData.wantsTrigger = false;
|
||||
}
|
||||
if (!grabbableData.hasOwnProperty("triggerable")) {
|
||||
grabbableData.triggerable = false;
|
||||
}
|
||||
|
||||
return grabbableData;
|
||||
};
|
||||
|
|
|
@ -461,13 +461,16 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
|||
var reparentProps = {
|
||||
parentID: AVATAR_SELF_ID,
|
||||
parentJointIndex: handJointIndex,
|
||||
velocity: {x: 0, y: 0, z: 0},
|
||||
angularVelocity: {x: 0, y: 0, z: 0},
|
||||
localVelocity: {x: 0, y: 0, z: 0},
|
||||
localAngularVelocity: {x: 0, y: 0, z: 0},
|
||||
localPosition: this.offsetPosition,
|
||||
localRotation: this.offsetRotation
|
||||
};
|
||||
Entities.editEntity(this.targetEntityID, reparentProps);
|
||||
|
||||
var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
|
||||
Entities.callEntityMethod(this.targetEntityID, "startEquip", args);
|
||||
|
||||
Messages.sendMessage('Hifi-Object-Manipulation', JSON.stringify({
|
||||
action: 'equip',
|
||||
grabbedEntity: this.targetEntityID,
|
||||
|
@ -594,6 +597,9 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
|||
|
||||
equipHotspotBuddy.update(deltaTime, timestamp, controllerData);
|
||||
|
||||
var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
|
||||
Entities.callEntityMethod(this.targetEntityID, "continueEquip", args);
|
||||
|
||||
return makeRunningValues(true, [this.targetEntityID], []);
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
|||
(function() {
|
||||
|
||||
function entityWantsNearTrigger(props) {
|
||||
return getGrabbableData(props).triggerable;
|
||||
var grabbableData = getGrabbableData(props);
|
||||
return grabbableData.triggerable || grabbableData.wantsTrigger;
|
||||
}
|
||||
|
||||
function NearTriggerEntity(hand) {
|
||||
|
@ -40,21 +41,17 @@ Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
|||
var props = nearbyEntityProperties[i];
|
||||
var handPosition = controllerData.controllerLocations[this.hand].position;
|
||||
var distance = Vec3.distance(props.position, handPosition);
|
||||
// if (distance > NEAR_GRAB_RADIUS) {
|
||||
// print("QQQ nop 0");
|
||||
// break;
|
||||
// }
|
||||
if (distance > NEAR_GRAB_RADIUS) {
|
||||
break;
|
||||
}
|
||||
if (entityWantsNearTrigger(props)) {
|
||||
return props;
|
||||
} else {
|
||||
print("QQQ nop 1");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this.startNearTrigger = function (controllerData) {
|
||||
Controller.triggerShortHapticPulse(1.0, this.hand);
|
||||
var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
|
||||
Entities.callEntityMethod(this.targetEntityID, "startNearTrigger", args);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue