Floor...falling ? xD

Hello there.



Ive followed examples to make a floor and a object above it.



Heres how ive tryed;



[java]

bulletAppState = new BulletAppState();

stateManager.attach(bulletAppState);



// the map

mapNode.addControl(new RigidBodyControl(1));

space.add(mapNode);



// the character

control = new CharacterControl(new BoxCollisionShape(new Vector3f(0.5f, 0.5f, 0.5f)), .1f);

control.setPhysicsLocation(characterNode.getLocalTranslation());

characterNode.addControl(control);

[/java]



I cant see if i missed something it looks ok to me, but when i start the app, everything just falls down to the doom of hell.



Thanx alot for any help !



[]´s

mapNode.addControl(new RigidBodyControl(1)); change this to 0, gravity won’t affect it then, like so:



[java]mapNode.addControl(new RigidBodyControl(0));[/java]

1 Like

oh snap



It worked, thanx alot , sorry for that !!

1 Like

Using the same topic:



Just another silly question, is it not possible to move manually a Node after adding a CharacterControl to it ?



[java]

// this works

node.setLocalTranslation(new Vector3f(0,25f,0));



control = new CharacterControl(new SphereCollisionShape(0.8f), .1f);

control.setPhysicsLocation(node.getLocalTranslation());

control.setFallSpeed(15f);

node.addControl(control);



// this doesnt work

node.setLocalTranslation(new Vector3f(2,25f,2));

[/java]



Why is that ? Will make things harder, i looked thro CharacterControl and couldnt noticed any other way to move a Node.



Thanx again for any help.

nope that wont work, you need to move the Physics Control, or move the node then add the control



https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:physics#kinematic_vs_dynamic_vs_static

1 Like