CollisionShapes, need advice


I’m having a little bit of an issue creating proper collision shapes and if possible would like some advice on the issue.

When ever i try to attach a simple HullCollisionShape with a cylinder mesh, the orientation of the shape is always different from an imported cylinder model. For example if the imported cylinder model was sitting flat on a plane the collision shape would be on its side.

–Creating custom dynamic shapes from the spatial using the the CollisionShapeFactory class <-- Seem to phase through other objects
–Rotating the shapes/imported object in blender/program/sdk
–Tried this configuration : Node --> 1. imported object 2.RigidBodyControl and then orienting them, no luck

Would like to know if im just going about it wrong, or im missing something from the tutorials or book.

Experience : less than two weeks.

Thank you in advance.

Did you apply location rotation and scale to your model before you exported it?

Originally the cylinder object was sitting on the plane on it’s bottom side. Then i tried rotating it in blender and exported it again, which did not fix the issue.

Look at Apply Transformations here:

@constantine said: Look at Apply Transformations here:

Thank you that did the trick.

Since I was looking for this, maybe others are also looking for this. Here is how I have it setup now.
*Note the plane does not have the fix that constantine speaks of, and that is why the imported model and the collision shape are not aligned properly.

Blender Image of the imported simple models:

Program image of the models with RigidBodyControls attached:

*Cylinder is correctly configured in blender
**Plane is not correctly configured in blender

And program code:
public class PhysicsTest extends SimpleApplication {

@Override public void simpleInitApp(){
	//App state
	SimpleAppState appState = new SimpleAppState();

@Override public void simpleUpdate(float tpf){

public static void main(String[] args){
	PhysicsTest app = new PhysicsTest();

class SimpleAppState extends AbstractAppState {
	AmbientLight ambient;
	DirectionalLight directional;
	BulletAppState bulletState;
	Node scene;
	public SimpleAppState(){
		bulletState = new BulletAppState(new Vector3f(-20, -20, -20), new Vector3f(20, 20, 20));
		directional = LightingGenerator.getSimpleDirectionalLight();
		ambient = LightingGenerator.getSimpleAmbientLight();
	@Override public void initialize(AppStateManager stateManager, Application app){
		super.initialize(stateManager, app);
		//Load model
		scene = (Node) assetManager.loadModel("prototype-game/test/test.scene");

	@Override public void update(float tpf){
	private void initPhysics(){
		for(Spatial e : scene.getChildren()){
				Cylinder mesh = new Cylinder(10, 10, 1, 1, true);
				e.setLocalTranslation(e.getLocalTranslation().add(new Vector3f(0, 2, 0)));
				e.addControl(new RigidBodyControl(new HullCollisionShape(mesh), 0f));
			}else if(e.getName().equals("plane")){
				Quad mesh = new Quad(1, 1);
				e.addControl(new RigidBodyControl(new HullCollisionShape(mesh), 0f));


1 Like