Skip to content

Commit

Permalink
Corrected issue with JointCollisionEvents behavior firing events on i…
Browse files Browse the repository at this point in the history
…nvisible objects.
  • Loading branch information
David Cormack committed Dec 2, 2016
1 parent 2142952 commit 0253f5e
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/utilities/behaviors/JointCollisionEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,23 @@ altspace.utilities.behaviors.JointCollisionEvents = function(_config) {
var collidedJoints = [];
var hasPrevCollided = hasCollided;
hasCollided = false;
for(var i = 0; i < config.joints.length; i++) {
var joint = joints[i];
if(joint && joint.confidence !== 0) {
var jointBB = new THREE.Box3().setFromCenterAndSize(joint.position, jointCube);
var collision = objectBB.intersectsBox(jointBB);
if(collision) {
var intersectBB = objectBB.intersect(jointBB);
if(jointIntersectUnion) {
jointIntersectUnion.union(intersectBB);
} else {
jointIntersectUnion = intersectBB;
if(object3d.visible && object3d.scale.x > Number.EPSILON && object3d.scale.y > Number.EPSILON && object3d.scale.z > Number.EPSILON) {
for(var i = 0; i < config.joints.length; i++) {
var joint = joints[i];
if(joint && joint.confidence !== 0) {
var jointBB = new THREE.Box3().setFromCenterAndSize(joint.position, jointCube);
var collision = objectBB.intersectsBox(jointBB);
if(collision) {
var intersectBB = objectBB.intersect(jointBB);
if(jointIntersectUnion) {
jointIntersectUnion.union(intersectBB);
} else {
jointIntersectUnion = intersectBB;
}

hasCollided = true;
collidedJoints.push(joint);
}

hasCollided = true;
collidedJoints.push(joint);
}
}
}
Expand Down

0 comments on commit 0253f5e

Please sign in to comment.