Changing model color at runtime

So this is a pretty simple question I know…but for some reason my implementation isn’t working. I’m only trying to change the color of my model’s geometries at runtime. Here’s the code

CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1f, 5f);
enemy = new CharacterControl(capsuleShape, 0.05f);
model = (Node)TISingletons.getAssetManager().loadModel(“Models/fighter/fighter…mesh.j3o”);
model.setMaterial(new Material(TISingletons.getAssetManager(), “Common/MatDefs/Misc/Unshaded.j3md”));
//model.getMaterial().setColor(“Color”, ColorRGBA.randomColor());

    model.depthFirstTraversal(new SceneGraphVisitorAdapter(){
    public void visit(Geometry g){
      g.getMaterial().setTexture("ColorMap", TISingletons.getAssetManager().loadTexture("Textures/fighter_yellowfighter_yellow.jpg"));

   //model = (Node) assetManager.loadModel("Models/hexagon.obj");
    Quaternion PITCH090 = new Quaternion().fromAngleAxis(FastMath.PI/2,   new Vector3f(1,0,0));

Change color method
[java]model.depthFirstTraversal(new SceneGraphVisitorAdapter(){
public void visit(Geometry g){
g.getMaterial().setColor(“Color”, new ColorRGBA(0f,1f,0f, 1f));

looks fine to me, have you confirmed that the methods are being called? (breakpoint/system out)

Yes I have. Another strange test, I put the “change color” code in the constructor, and it worked. When I later called the actual method (and it executed fine as far as I can tell with breakpoints), it did nothing.

ok, wierd. What about changing the color variable reference instead of assigning a new one, i.e

[java]((ColorRGBA)g.getMaterial().getParam (“Color”).getValue ()).b = 1.0f[/java]

I figured it out…I had some old code that I forgot about that was creating the model, and I was sending my asynch request to the server and receiving a response BEFORE it was actually rendered! I moved my logic down and it works fine :P. Thanks for the help in confirming I was doing the coloring correctly, I was troubleshooting that when I should have been troubleshooting my logic!