mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 13:24:02 +02:00
actually fix requested changes
This commit is contained in:
parent
d81420542c
commit
0fa2a71d0f
2 changed files with 25 additions and 7 deletions
|
@ -11,7 +11,8 @@
|
||||||
TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS,
|
TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS,
|
||||||
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH,
|
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH,
|
||||||
HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, findHandChildEntities, TEAR_AWAY_DISTANCE, MSECS_PER_SEC, TEAR_AWAY_CHECK_TIME,
|
HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, findHandChildEntities, TEAR_AWAY_DISTANCE, MSECS_PER_SEC, TEAR_AWAY_CHECK_TIME,
|
||||||
TEAR_AWAY_COUNT, distanceBetweenPointAndEntityBoundingBox, print, Uuid, highlightTargetEntity, unhighlightTargetEntity
|
TEAR_AWAY_COUNT, distanceBetweenPointAndEntityBoundingBox, print, Uuid, highlightTargetEntity, unhighlightTargetEntity,
|
||||||
|
distanceBetweenEntityLocalPositionAndBoundingBox
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
|
@ -172,12 +173,9 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
||||||
if (now - this.lastUnequipCheckTime > MSECS_PER_SEC * TEAR_AWAY_CHECK_TIME) {
|
if (now - this.lastUnequipCheckTime > MSECS_PER_SEC * TEAR_AWAY_CHECK_TIME) {
|
||||||
this.lastUnequipCheckTime = now;
|
this.lastUnequipCheckTime = now;
|
||||||
if (props.parentID === MyAvatar.SELF_ID) {
|
if (props.parentID === MyAvatar.SELF_ID) {
|
||||||
var tearAwayDistance = TEAR_AWAY_DISTANCE;
|
var tearAwayDistance = TEAR_AWAY_DISTANCE * MyAvatar.sensorToWorldScale;
|
||||||
var localX = props.localPosition.x;
|
var distance = distanceBetweenEntityLocalPositionAndBoundingBox(props);
|
||||||
var localZ = props.localPosition.z;
|
if (distance > tearAwayDistance) {
|
||||||
var localY = props.localPosition.y;
|
|
||||||
if ((localX > tearAwayDistance) || (localY > tearAwayDistance) ||
|
|
||||||
(localZ > tearAwayDistance)) {
|
|
||||||
this.autoUnequipCounter++;
|
this.autoUnequipCounter++;
|
||||||
} else {
|
} else {
|
||||||
this.autoUnequipCounter = 0;
|
this.autoUnequipCounter = 0;
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
highlightTargetEntity:true,
|
highlightTargetEntity:true,
|
||||||
clearHighlightedEntities:true,
|
clearHighlightedEntities:true,
|
||||||
unhighlightTargetEntity:true
|
unhighlightTargetEntity:true
|
||||||
|
distanceBetweenEntityLocalPositionAndBoundingBox: true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MSECS_PER_SEC = 1000.0;
|
MSECS_PER_SEC = 1000.0;
|
||||||
|
@ -415,6 +416,25 @@ findHandChildEntities = function(hand) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps) {
|
||||||
|
var localPoint = entityProps.localPosition;
|
||||||
|
var entityXform = new Xform(entityProps.rotation, entityProps.position);
|
||||||
|
var minOffset = Vec3.multiplyVbyV(entityProps.registrationPoint, entityProps.dimensions);
|
||||||
|
var maxOffset = Vec3.multiplyVbyV(Vec3.subtract(ONE_VEC, entityProps.registrationPoint), entityProps.dimensions);
|
||||||
|
var localMin = Vec3.subtract(entityXform.trans, minOffset);
|
||||||
|
var localMax = Vec3.sum(entityXform.trans, maxOffset);
|
||||||
|
|
||||||
|
var v = {x: localPoint.x, y: localPoint.y, z: localPoint.z};
|
||||||
|
v.x = Math.max(v.x, localMin.x);
|
||||||
|
v.x = Math.min(v.x, localMax.x);
|
||||||
|
v.y = Math.max(v.y, localMin.y);
|
||||||
|
v.y = Math.min(v.y, localMax.y);
|
||||||
|
v.z = Math.max(v.z, localMin.z);
|
||||||
|
v.z = Math.min(v.z, localMax.z);
|
||||||
|
|
||||||
|
return Vec3.distance(v, localPoint);
|
||||||
|
};
|
||||||
|
|
||||||
distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) {
|
distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) {
|
||||||
var entityXform = new Xform(entityProps.rotation, entityProps.position);
|
var entityXform = new Xform(entityProps.rotation, entityProps.position);
|
||||||
var localPoint = entityXform.inv().xformPoint(point);
|
var localPoint = entityXform.inv().xformPoint(point);
|
||||||
|
|
Loading…
Reference in a new issue