[SOLVED] Problem trying to scale the texture for a .j3o mesh

Hi guys,
I have a problem trying to scale the texture for a .j3o mesh. Here’s the snippet:

Spatial myModel;
myModel = assetManager.loadModel("Models/MyModel/Generic.j3o");
((Geometry)myModel).getMesh().scaleTextureCoordinates(new Vector2f(2.5f, 2.5f));

I think the code above should be correct (I am new to Java and JMonkey), but the compiler says:
“… ClassCastException: com.jme3.scene.Node cannot be cast to com.jme3.sceneGeometry”

  1. I can’t undestand why, because I have seen some JMonkey examples where this is a normal operation es.: http://hub.jmonkeyengine.org/t/how-to-properly-scale-uv-texture-coordinates-dynamically-loaded-j3o-meshes/30123

  2. and I can’t understand why the compiler says “…Node cannot be cast…” because myModel variable is Spatial, not Node.

Thank you very much for you attention

Node is a Spatial, Geometry is a Spatial, but Geometry is not a Node.
The root of your Generic.j3o is a Node, and you have an exception because you try to cast it into Geometry.

Take a look at the javadoc.
Print the class of myModel, I guess you will see com.jme3.scene.Node.
Try to open your j3o in the SDK.

Ok David, I have understood my mistake.
Thank you very much!