Making new material vs setColor

Hello, I am just starting and have following issue with 8th step ( I am trying to change color of cube which was hit. Unfortunately, that

results.getCollision(i).getGeometry().getMaterial().setColor(“Color”, ColorRGBA.Gray);

cause “java.lang.IllegalArgumentException: Material parameter is not defined: Color”.

When I make new Material, everything seems to be fine:

Material newmat = new Material(assetManager,


newmat.setColor(“Color”, ColorRGBA.Gray);


Why first option fail? Thanks in advance.

PS. My first post, so welcome everybody!

The problem is that you’v hit an object that does not have the material unshaded.j3md

if it, for instance, uses Lighting.j3md then the color varible name is “color_map” or something like that.

To check what attribute the color is you can find it herE:

find your material in the sub folders, then open the j3md file and see for varibles of the class Color. The name of those variables are the name to use when setting color to that material.

Do not double-post!