From 22dde7f718ed9da787f94d6cfc46557bb6d1615b Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Sun, 13 Sep 2015 22:08:17 -0400 Subject: [PATCH] point light: more accurate sphere vs box filter --- jme3-core/src/main/java/com/jme3/light/PointLight.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/light/PointLight.java b/jme3-core/src/main/java/com/jme3/light/PointLight.java index ff3b3295f..1f515e71c 100644 --- a/jme3-core/src/main/java/com/jme3/light/PointLight.java +++ b/jme3-core/src/main/java/com/jme3/light/PointLight.java @@ -33,12 +33,12 @@ package com.jme3.light; import com.jme3.bounding.BoundingBox; import com.jme3.bounding.BoundingVolume; +import com.jme3.bounding.Intersection; import com.jme3.export.InputCapsule; import com.jme3.export.JmeExporter; import com.jme3.export.JmeImporter; import com.jme3.export.OutputCapsule; import com.jme3.math.ColorRGBA; -import com.jme3.math.FastMath; import com.jme3.math.Vector3f; import com.jme3.renderer.Camera; import com.jme3.scene.Spatial; @@ -191,9 +191,7 @@ public class PointLight extends Light { return true; } else { // Sphere v. box collision - return FastMath.abs(box.getCenter().x - position.x) < radius + box.getXExtent() - && FastMath.abs(box.getCenter().y - position.y) < radius + box.getYExtent() - && FastMath.abs(box.getCenter().z - position.z) < radius + box.getZExtent(); + return Intersection.intersect(box, position, radius); } }