How do I make a ray visible?

Hello I need to make a ray to be visible for debugging. I have try it like this

[java]debugLines=new ArrayList<Geometry>();

for(int i=0;i<rays.size();i++)


debugLines.add(new Geometry("line"+i, new Line(rays.get(i).getOrigin(),


Material mat=MaterialsBank.UNSHAEDED.clone();

mat.setColor("ColorMap", ColorRGBA.Blue);




[java]public interface MaterialsBank


Material UNSHAEDED=new Material(MyGame.assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

Material LIGHTING=new Material(MyGame.assetManager, "Common/MatDefs/Light/Lighting.j3md");

Material PARTICLE=new Material(MyGame.assetManager, "Common/MatDefs/Misc/Particle.j3md");

// Material SOLID=new Material(MyGame.assetManager, "Common/MatDefs/Misc/SolidColor.j3md");


but i get this exception…

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.IllegalStateException: No material is set for Geometry: line0

at com.jme3.renderer.RenderManager.renderScene(

at com.jme3.renderer.RenderManager.renderScene(

at com.jme3.renderer.RenderManager.renderScene(

at com.jme3.renderer.RenderManager.renderViewPort(

at com.jme3.renderer.RenderManager.render(


at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(


at Source)

I think there is something wrong with my material

Thank you.

You’re better off managing the geometry and setting it’s material followed by adding it to the list…

sorry for the topic. problem solved. i must use ShowNormals.j3md insted of Unshaded.j3md

1 Like

The problem didn’t go away, only if you changed the loop. The stack-trace says that no material is set for the specific geometry.