Geometry for "line" error

sorry for this silly question but I’m going nuts on this error. Here is my code segment:

public void simpleInitApp() {   
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

Line line = new Line(Vector3f.ZERO, new Vector3f(4, 5, 6));
Geometry geom = new Geometry("line", line);
geom.setMaterial(mat);

rootNode.attachChild(geom);

}

I’ve been trying to figure out why, googling everything I could, watching tutorials and no matter where I look the code seems to be 100% correct. The Geometry even works when I use it on a Box! For some reason it doesn’t like “line”. I’m so confused… please help. Thanks :slight_smile:

Error: “No suitable constructor found for Geometry(String, Line)”

You are importing the wrong Line class. One of the downsides of letting the IDE match them up for you.

You are importing this:
http://javadoc.jmonkeyengine.org/com/jme3/math/Line.html

When you mean to import this:
http://javadoc.jmonkeyengine.org/com/jme3/scene/shape/Line.html

2 Likes

Ty so much!!! That’s so silly lol :smiley: