A query on RigidBodyControl

Hi all…

I made an observation…I made a geometry(a box)and attachede to it RigidBodyControl. if I set some mass to it then it falls under gravity, as expected. but if I import a blender model and do same for it then model doesn’t have any gravity effect on it.

What can be the reason?Are impoted models treated differently?



Manish

No, its two separate things, you probably do something else wrong. Whats your code?

for blender model its as:



maze = (Node) assetManager.loadModel("/assets/models/maze_1.blend");

maze.move(0,0,0);

Material mat1 = new Material(assetManager,“Common/MatDefs/Terrain/TerrainLighting.j3md”);

maze.setMaterial(mat1);

maze.scale(.3f);

rootNode.attachChild(maze);

maze_phy = new RigidBodyControl(0.0f);

maze.addControl(maze_phy);

if(maze.getControl(RigidBodyControl.class)!=null){

((RigidBodyControl)maze.getControl(RigidBodyControl.class)).setKinematic(true);

}

bulletAppState.getPhysicsSpace().add(maze_phy);



for geometry made in jme itself:



floor = new Box(Vector3f.ZERO,2f,0.1f,2f);

floor_geo = new Geometry(“Floor”,floor);

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

floor_mat.setColor(“Color”, ColorRGBA.Green);

floor_geo.setMaterial(floor_mat);

rootNode.attachChild(floor_geo);

floor_phy = new RigidBodyControl(0.0f);

floor_geo.addControl(floor_phy);

if(floor_geo.getControl(RigidBodyControl.class)!=null){

((RigidBodyControl)floor_geo.getControl(RigidBodyControl.class)).setKinematic(true);

}



bulletAppState.getPhysicsSpace().add(floor_phy);

Uh, in both cases you posted gravity should not affect the objects as their mass is zero and you set them to kinematic mode. Note that you cannot move mesh collision shapes, also they do not collide with other mesh geometry. Check the tutorials on physics.

yeah,sorry to mention that i set the mass to non-zero values in both cases…in second case floor just falls down while for model it doesn’t…