From 5fe7693095aafd0d9bff2392ea8348018745e4cd Mon Sep 17 00:00:00 2001 From: "thomas.trocha" Date: Tue, 19 Jan 2010 23:25:52 +0000 Subject: [PATCH] fixed collsionMask-issue. added the requiredOnBit to pass to called methods (e.g. .findTrianglePick ) git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@4795 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- src/com/jme/intersection/TrianglePickResults.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/com/jme/intersection/TrianglePickResults.java b/src/com/jme/intersection/TrianglePickResults.java index 09ad3c91e..36fa2ee40 100644 --- a/src/com/jme/intersection/TrianglePickResults.java +++ b/src/com/jme/intersection/TrianglePickResults.java @@ -54,6 +54,17 @@ import com.jme.scene.TriMesh; */ public class TrianglePickResults extends PickResults { + /** + * Convenience wrapper for + * addPick(Ray, Geometry, int) + * collidability (first bit of the collidable bit mask). + * + * @see #addPick(Ray, Geometry, int) + */ + public void addPick(Ray ray, Geometry g) { + addPick(ray,g,1); + } + /** * addPick adds a Geometry object to the pick list. If the * Geometry object is not a TriMesh, the process stops here. However, if the @@ -64,9 +75,12 @@ public class TrianglePickResults extends PickResults { * the ray that is doing the picking. * @param g * the Geometry to add to the pick list. + * @param requiredOnBits TrianglePick will only be considered if 'this' + * has these bits of its collision masks set. + * * @see com.jme.intersection.PickResults#addPick(Ray, Geometry) - */ - public void addPick(Ray ray, Geometry g) { + */ + public void addPick(Ray ray, Geometry g, int requiredOnBits) { //find the triangle that is being hit. //add this node and the triangle to the CollisionResults // list. @@ -75,8 +89,9 @@ public class TrianglePickResults extends PickResults { addPickData(data); } else { ArrayList a = new ArrayList(); - ((TriMesh) g).findTrianglePick(ray, a); + ((TriMesh) g).findTrianglePick(ray, a, requiredOnBits); PickData data = new TrianglePickData(ray, ((TriMesh) g), a, willCheckDistance()); + addPickData(data); } } -- 2.11.0