|
|
@ -1013,17 +1013,27 @@ public class BoundingSphere extends BoundingVolume { |
|
|
|
} else if (other instanceof Triangle){ |
|
|
|
} else if (other instanceof Triangle){ |
|
|
|
Triangle t = (Triangle) other; |
|
|
|
Triangle t = (Triangle) other; |
|
|
|
return collideWithTri(t, results); |
|
|
|
return collideWithTri(t, results); |
|
|
|
|
|
|
|
} else if (other instanceof BoundingVolume) { |
|
|
|
|
|
|
|
if (intersects((BoundingVolume)other)) { |
|
|
|
|
|
|
|
CollisionResult result = new CollisionResult(); |
|
|
|
|
|
|
|
results.addCollision(result); |
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return 0; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new UnsupportedCollisionException(); |
|
|
|
throw new UnsupportedCollisionException(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override public int collideWith(Collidable other) { |
|
|
|
@Override |
|
|
|
|
|
|
|
public int collideWith(Collidable other) { |
|
|
|
if (other instanceof Ray) { |
|
|
|
if (other instanceof Ray) { |
|
|
|
Ray ray = (Ray) other; |
|
|
|
Ray ray = (Ray) other; |
|
|
|
return collideWithRay(ray); |
|
|
|
return collideWithRay(ray); |
|
|
|
} else if (other instanceof Triangle){ |
|
|
|
} else if (other instanceof Triangle){ |
|
|
|
return super.collideWith(other); |
|
|
|
return super.collideWith(other); |
|
|
|
|
|
|
|
} else if (other instanceof BoundingVolume) { |
|
|
|
|
|
|
|
return intersects((BoundingVolume)other) ? 1 : 0; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new UnsupportedCollisionException(); |
|
|
|
throw new UnsupportedCollisionException(); |
|
|
|
} |
|
|
|
} |
|
|
|