New CharacterControl distorting models?

Hi guys,

I started using JME a while back (I wanted to create a game that could be run on most platforms, with as little porting as possible, plus I wanted accessibility), after moving from Irrlicht in C++. 'Nuff history.

Anyway, recently (last night in fact) I updated my jMP to use the nightly SVN builds (in hopes of fixing a previous problem, which still is not fixed), and after said upgrade and converting my code to use the new CharacterControl instead of PhysicsCharacterNode (or something to that effect, i can’t remember offhand), my model starts doing some strange distortion.

Pre-CharacterControl, it all animated and worked fine, but Post-CharacterControl (after switching everything to the new one), the model distorts when any animation is attempted (I deduced this by commenting out the animations on movement and the stand animation, and the model comes up perfect).


The top image is the model without any animation applied, the bottom is what happens when any animation is applied

I can’t find any reason why this happens (I’ve checked the scaling in 3DS max, I’ve checked all the scaling and channels in the code, nothing is anomalous, and it worked before, so i don’t see why it should pop up now).

Additionally, the model is not taking it’s texture. Thats why it’s all black, I’ve tried using a regular material, created in the code, but that textured the image without it’s UV mapping. I read a topic that advised me to create a custom material and manually edit the mesh.xml to use this material, which i did. After doing this, the model appears all black, no matter the settings of the material (Diffusemaps, Glowmaps, ambient colors etc, everything turns up black).

There is a directional light in the scene, and i’m using the PssMShadowRenderer, which additionally, is not casting shadows after the update (though it was before).

Thanks for any help.


Code -

The Character Creation code:

[java]private void createCharacter()


CapsuleCollisionShape capsule = new CapsuleCollisionShape(0.25f,0.25f);

Texture playerSkin = assetManager.loadTexture(“Textures/models/BodyCompleteMap.tga”);

Material TestMat = assetManager.loadMaterial(“Materials/playerMaterial.j3m”);

matPlayer1 = new Material(assetManager, “Common/MatDefs/Misc/ColoredTextured.j3md”);

matPlayer1.setTexture(“ColorMap”, playerSkin);

character = new CharacterControl(capsule,0.1f);

m_char = (Node) assetManager.loadModel(“Models/Body.mesh.xml”);






character.setPhysicsLocation(new Vector3f(0,10,0));

//character.move(new Vector3f(0,140,100));





Light Creation code -

[java]private void createLight()


Vector3f dir = new Vector3f(-0.1f, -0.7f, -1).normalizeLocal();

DirectionalLight dl = new DirectionalLight();


dl.setColor(new ColorRGBA(-1f, -1f, -1f, 1f));



Init Code -


public void simpleInitApp()


niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);

nifty = niftyDisplay.getNifty();

nifty.fromXml(“Interface/inventory.xml”, “start”);

// guiViewPort.addProcessor(niftyDisplay);

bulletAppState = new BulletAppState();




invChild = new Node(“invchild”);

c_health = 100;

c_power = 100;

inventory = new int[25];

items = new String[25];


bsr = new PssmShadowRenderer(assetManager,1024,4,PssmShadowRenderer.EDGE_FILTERING_DITHER);

bsr.setDirection(new Vector3f(-1,-1,-1).normalizeLocal());












Quad mousetrack = new Quad(10,10);

mouseLoc = new Geometry(“mousetracker”,mousetrack);

Material tempMat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

tempMat.setColor(“m_Color”,new ColorRGBA(0,0,0, (float) 0.75));




Anim controller -

[java]private void setupAnimationController()


animationControl = m_char.getControl(AnimControl.class);


animationChannel = animationControl.createChannel();


Anims in SimpleUpdate -

[java]if(walkDirection.length() == 0)










if(airTime > .6f)







else if(!“walk”.equals(animationChannel.getAnimationName()))






Can no one solve this even after three days?

How about providing the crucial code parts?

I use CharacterControl with models without any problems…

Dodikles said:
How about providing the crucial code parts?
I use CharacterControl with models without any problems...

Touché, thought i forgot something :P, I'll add them now.

Ok, strike that, I tried to start my jMP and it wasn’t opening, so i uninstalled it and downloaded/installed the latest version and now the animations work fine, though the black material problem still stands.



tempMat.setColor(“m_Color”,new ColorRGBA(0,0,0, (float) 0.75));




tempMat.setColor(“Color”,new ColorRGBA(0,0,0, (float) 0.75));


The “m_”-prefix is deprecated :slight_smile:

But I guess this hasn’t anything to do with that problem…

Dodikles said:

tempMat.setColor("m_Color",new ColorRGBA(0,0,0, (float) 0.75));
tempMat.setColor("Color",new ColorRGBA(0,0,0, (float) 0.75));

The "m_"-prefix is deprecated :)
But I guess this hasn't anything to do with that problem...

Still all black, as in the picture.
Additionally, as i mentioned before, shadows do not appear anymore, has the realtime shadow renderer changed (PSSM) to anything else? My jMP is telling me the edge filtering method is deprecated, and upon inspection both methods are deprecated..

Where ma shadows at?! :(

mhh didn’t see that issue before, it may have nothing to do with the character control but more with the fact that now bona animation system supports bone scaling and wasn’t before.

Are you sure there is no scale in your animation?

could you provide the skeleton.xml file please?

ho…I’m slow :stuck_out_tongue:

Add a light to your scene, that’s why your model is black

nehon said:
ho....I'm slow :p

try to add a light to your scene

There is already a directional light, and from what i read thats was all i need..

But i'll try add a regular light and see what happens

Navi the fairy anyone? :P

As far as I can see you don’t add the texture to the right material!

The material



which is

[java]Material TestMat = assetManager.loadMaterial(“Materials/playerMaterial.j3m”);


doesn’t get the texture! But another does:

[java]matPlayer1 = new Material(assetManager, “Common/MatDefs/Misc/ColoredTextured.j3md”);

matPlayer1.setTexture(“ColorMap”, playerSkin);[/java]

Dodikles said:
As far as I can see you don't add the texture to the right material!

The material
which is

[java]Material TestMat = assetManager.loadMaterial("Materials/playerMaterial.j3m");
doesn't get the texture! But another does:
[java]matPlayer1 = new Material(assetManager, "Common/MatDefs/Misc/ColoredTextured.j3md");
matPlayer1.setTexture("ColorMap", playerSkin);[/java]

The diffusemap/texture is set in playerMaterial.j3m, not in the code, the matPlayer1 is an old part which i haven't commented out :)

Then how about you spare us with old, non-working code and only show the working parts of the code? :stuck_out_tongue:

Make sure that every texture gets loaded properly! Use debugger or whatever.

Dodikles said:
Then how about you spare us with old, non-working code and only show the working parts of the code? :P

Make sure that every texture gets loaded properly! Use debugger or whatever.

Jawohl, next time i'll remember to remove it :P

I'll have a check in the debugger to make sure the texture loads..

Hmm, the light part was right, it now shows the texture, but the UV map isn’t working… now to fix that problem…

Thanks for all your help guys :smiley: