I can successfully create the object, but it can't be attached to the rootNode. What can I do to make the line appear?

I'll also would like to know how to reverse the effect(making it disappear) shortly after if any special steps are involved.


The solution is actually quite easy.

The .attachChild() method of the rootNode object only accepts Nodes as it's argument. Therfore, a Geometry object must be created with the line object as its second arguement.

In addition, you can also set its material afterwards.

An example:

Line line = new Line(new Vector3f(0, 0, 0), new Vector3f(0, 100, 0));
Geometry geometry = new Geometry("Bullet", line);
Material orange = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
orange.setColor("Color", ColorRGBA.Blue);
| improve this answer | |
  • \$\begingroup\$ to be able to see it all the time, I had to add both of these: mat.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off); and geometry.setCullHint(Spatial.CullHint.Never); \$\endgroup\$ – Aquarius Power Jan 11 '15 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.