Cannot add this kind of object to the physics space

Hi!

Following the tutorial found here:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_collision

I tried to adapt my old scripts to the newest jme3 and I stumbled unto a problem.

I tried to create a character just like in the tutorial by doing the following:

[java]@Override

public void simpleInitApp() {

bulletAppState = new BulletAppState();

stateManager.attach(bulletAppState);



viewPort.setBackgroundColor(new ColorRGBA(0.7f,0.8f,1f,1f));

flyCam.setMoveSpeed(100);



CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);

CharacterControl player = new CharacterControl(capsuleShape, 0.05f);

bulletAppState.getPhysicsSpace().add(player);[/java]



It only makes it to the last line where it gives the error:

java.lang.UnsupportedOperationException: Cannot add this kind of object to the physics space.


One other weard thing is that the tutorial says you must add player to the rootNode, tho in the source code it does not do it anywhere. And if you were to try to add it to the rootnode it will give you an error that its not acceptable.

I'v probebly done something commonly wrong, but if I could get help with this then I think I should have no more problems for a big while :D

Did you compile this version of jme3 yourself?

I havn’t compiled anything :stuck_out_tongue:

Took the one NOT being sdk, at the bottom at:

http://jmonkeyengine.com/nightly/

Then I unzipped it. And in eclipse I clicked my project.

Removed earlier jar monkey file.

Added an external jar from the newly created folder into the libary part.



Then many compile errors fixed themself and tutorials started to work.

But still I have no idea why this did not work. Its almoste the same as in the example except

I do not add the scene.zip mesh before adding the character…

Found some weard project that had been added to the compile list with the current project I am working on.

Removed it and now it works :slight_smile: