mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:03:53 +02:00
avoid unequipping things during a HMD snap-turn
This commit is contained in:
parent
afeb98059b
commit
737b583745
1 changed files with 16 additions and 2 deletions
|
@ -10,7 +10,7 @@
|
|||
/* global Script, Entities, Overlays, Controller, Vec3, Quat, getControllerWorldLocation, RayPick,
|
||||
controllerDispatcherPlugins:true, controllerDispatcherPluginsNeedSort:true,
|
||||
LEFT_HAND, RIGHT_HAND, NEAR_GRAB_PICK_RADIUS, DEFAULT_SEARCH_SPHERE_DISTANCE, DISPATCHER_PROPERTIES,
|
||||
getGrabPointSphereOffset, HMD, MyAvatar, Messages
|
||||
getGrabPointSphereOffset, HMD, MyAvatar, Messages, findHandChildEntities
|
||||
*/
|
||||
|
||||
controllerDispatcherPlugins = {};
|
||||
|
@ -27,7 +27,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ;
|
||||
|
||||
var PROFILE = false;
|
||||
var DEBUG = false;
|
||||
var DEBUG = true;
|
||||
|
||||
if (typeof Test !== "undefined") {
|
||||
PROFILE = true;
|
||||
|
@ -266,6 +266,20 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
});
|
||||
}
|
||||
|
||||
// sometimes, during a HMD snap-turn, an equipped or held item wont be near
|
||||
// the hand when the findEntities is done. Gather up any hand-children here.
|
||||
for (h = LEFT_HAND; h <= RIGHT_HAND; h++) {
|
||||
var handChildrenIDs = findHandChildEntities(h);
|
||||
handChildrenIDs.forEach(function (handChildID) {
|
||||
if (handChildID in nearbyEntityPropertiesByID) {
|
||||
return;
|
||||
}
|
||||
var props = Entities.getEntityProperties(handChildID, DISPATCHER_PROPERTIES);
|
||||
props.id = handChildID;
|
||||
nearbyEntityPropertiesByID[handChildID] = props;
|
||||
});
|
||||
}
|
||||
|
||||
// bundle up all the data about the current situation
|
||||
var controllerData = {
|
||||
triggerValues: [_this.leftTriggerValue, _this.rightTriggerValue],
|
||||
|
|
Loading…
Reference in a new issue