fix hat stand fail

This commit is contained in:
luiscuenca 2018-09-13 18:21:22 -07:00
parent c5669ef1f5
commit fb37e13aae

View file

@ -166,7 +166,7 @@ Script.include("/~/system/libraries/controllers.js");
joint: (_this.hand === RIGHT_HAND) ? "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND", joint: (_this.hand === RIGHT_HAND) ? "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND",
dirOffset: { x: 0, y: 1, z: 0.1 }, dirOffset: { x: 0, y: 1, z: 0.1 },
posOffset: { x: (_this.hand === RIGHT_HAND) ? 0.03 : -0.03, y: 0.2, z: 0.02 }, posOffset: { x: (_this.hand === RIGHT_HAND) ? 0.03 : -0.03, y: 0.2, z: 0.02 },
filter: Picks.PICK_ENTITIES + Picks.PICK_INCLUDE_INVISIBLE, filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE,
faceAvatar: true, faceAvatar: true,
scaleWithAvatar: true, scaleWithAvatar: true,
centerEndY: false, centerEndY: false,
@ -195,7 +195,7 @@ Script.include("/~/system/libraries/controllers.js");
_this.teleportParabolaHeadVisuals = Pointers.createPointer(PickType.Parabola, { _this.teleportParabolaHeadVisuals = Pointers.createPointer(PickType.Parabola, {
joint: "Avatar", joint: "Avatar",
filter: Picks.PICK_ENTITIES + Picks.PICK_INCLUDE_INVISIBLE, filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE,
faceAvatar: true, faceAvatar: true,
scaleWithAvatar: true, scaleWithAvatar: true,
centerEndY: false, centerEndY: false,
@ -485,14 +485,16 @@ Script.include("/~/system/libraries/controllers.js");
function checkForMeshDiscrepancy(result, collisionResult) { function checkForMeshDiscrepancy(result, collisionResult) {
var intersectingObjects = collisionResult.intersectingObjects; var intersectingObjects = collisionResult.intersectingObjects;
if (intersectingObjects.length > 0) { if (intersectingObjects.length > 0 && intersectingObjects.length < 3) {
var intersectingObject = collisionResult.intersectingObjects[0]; for (var j = 0; j < collisionResult.intersectingObjects.length; j++) {
for (var i = 0; i < intersectingObject.collisionContacts.length; i++) { var intersectingObject = collisionResult.intersectingObjects[j];
var normal = intersectingObject.collisionContacts[i].normalOnPick; for (var i = 0; i < intersectingObject.collisionContacts.length; i++) {
var distanceToPick = Vec3.distance(intersectingObject.collisionContacts[i].pointOnPick, result.intersection); var normal = intersectingObject.collisionContacts[i].normalOnPick;
var normalSign = Vec3.dot(normal, Quat.getUp(MyAvatar.orientation)); var distanceToPick = Vec3.distance(intersectingObject.collisionContacts[i].pointOnPick, result.intersection);
if ((distanceToPick > MAX_DISCREPANCY_DISTANCE) || (normalSign > MAX_DOT_SIGN)) { var normalSign = Vec3.dot(normal, Quat.getUp(MyAvatar.orientation));
return false; if ((distanceToPick > MAX_DISCREPANCY_DISTANCE) || (normalSign > MAX_DOT_SIGN)) {
return false;
}
} }
} }
return true; return true;