Using Extrusions

Hi all,

I'm a relative n00b to jme, but I'm trying to figure out how to use the Extrusion class. All I want to do is extrude a triangle. Building the triangle is easy, but the Extrusion class crashes out with a null pointer when calling the constructor…  :cry:

// create a simple triangle --- seems to work OK
Vector3f[] points = new Vector3f[3];
points[0] = new Vector3f(0.0f, 0.0f, 0.0f);
points[1] = new Vector3f(0.0f, 1.0f, 0.0f);
points[2] = new Vector3f(0.0f, 0.0f, 1.0f);
Line triLine = new Line("triLine", points, null, null, null);

// extrude the triangle to make a thin sliver
// first create extrusion path
List<Vector3f> extrusionList = new ArrayList<Vector3f>();
extrusionList.add(new Vector3f(0.0f, 0.0f, 0.0f));
extrusionList.add(new Vector3f(0.1f, 0.0f, 0.0f));

// crash here
Extrusion extrusion = new Extrusion("ext", triLine, extrusionList, new Vector3f(0.0f, 1.0f, 0.0f));

NullPointerException when the Extrusion code calls updateGeometry as it tries to use the shapeNormalBuffer for the line (which is null).. Does this need to be initialised somehow??

Yes, you need to specify the normal for each point of the line. You can do that the same way like you specify the actual points and pass that to the ctor of Line.