Requested in http://www.jmonkeyengine.com/jmeforum/index.php?topic=10855.0 this patch removes the findPick(…) overrides which makes the Line that represents the Curve pickable.
Index: src/com/jme/curve/BezierCurve.java
===================================================================
--- src/com/jme/curve/BezierCurve.java (revision 4259)
+++ src/com/jme/curve/BezierCurve.java (working copy)
@@ -224,14 +224,6 @@
public boolean hasCollision(Spatial scene, boolean checkTriangles) {
return false;
}
-
- /* (non-Javadoc)
- * @see com.jme.scene.Spatial#doPick(com.jme.math.Ray, com.jme.intersection.PickResults)
- */
- public void findPick(Ray toTest, PickResults results) {
- // TODO Auto-generated method stub
-
- }
-
+
}
Index: src/com/jme/curve/CatmullRomCurve.java
===================================================================
--- src/com/jme/curve/CatmullRomCurve.java (revision 4259)
+++ src/com/jme/curve/CatmullRomCurve.java (working copy)
@@ -275,16 +275,5 @@
public boolean hasCollision(Spatial scene, boolean checkTriangles) {
return false;
}
-
-
- /*
- * (non-Javadoc)
- *
- * @see com.jme.scene.Spatial#doPick(com.jme.math.Ray,
- * com.jme.intersection.PickResults)
- */
- @Override
- public void findPick(Ray toTest, PickResults results) {
-
- } // findPick
+
} // CatmullRomCurve
EDIT:
Heres a patch for TestPick that tests the new behavior:
Index: src/jmetest/intersection/TestPick.java
===================================================================
--- src/jmetest/intersection/TestPick.java (revision 4259)
+++ src/jmetest/intersection/TestPick.java (working copy)
@@ -43,6 +43,7 @@
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingCapsule;
+import com.jme.curve.BezierCurve;
import com.jme.math.FastMath;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
@@ -52,6 +53,7 @@
import com.jme.scene.Text;
import com.jme.scene.Spatial.TextureCombineMode;
import com.jme.util.export.binary.BinaryImporter;
+import com.jme.util.geom.BufferUtils;
import com.jme.util.resource.ResourceLocatorTool;
import com.jme.util.resource.SimpleResourceLocator;
import com.jmex.model.animation.JointController;
@@ -154,7 +156,25 @@
l.setModelBound(new BoundingBox());
l.updateModelBound();
l.setLightCombineMode(Spatial.LightCombineMode.Off);
+
+ //create control Points
+ Vector3f[] points = new Vector3f[4];
+ points[0] = new Vector3f( -400, 0, 0);
+ points[1] = new Vector3f( -200, 300, -200);
+ points[2] = new Vector3f(200, -300, -300);
+ points[3] = new Vector3f(400, 0, 0);
+ BezierCurve curve = new BezierCurve("Curve", points);
+ ColorRGBA[] colors = new ColorRGBA[4];
+ colors[0] = new ColorRGBA(0, 1, 0, 1);
+ colors[1] = new ColorRGBA(1, 0, 0, 1);
+ colors[2] = new ColorRGBA(1, 1, 0, 1);
+ colors[3] = new ColorRGBA(0, 0, 1, 1);
+ curve.setColorBuffer(BufferUtils.createFloatBuffer(colors));
+ curve.setModelBound(new BoundingBox());
+ curve.updateModelBound();
+
+ rootNode.attachChild(curve);
rootNode.attachChild(l);
rootNode.attachChild(model);