# Custom CollisionShape/RigidBody

Is there a way to create a custom CollisionShape in order to create a “culbuto” item (I don’t know if culbuto is the correct term in english but I found no other translation so…).

What I’d like is an item that always stand straight so one with a very low (near the floor) gravity center.

Any idea of how I could do that ?

I don’t know the translation of culbuto in English neither, but it makes sense since it’s how it’s called in French

you can use HullCollisionShape. It approximate a simplified shape based on a mesh.

However, i don’t know if bullet will handle it correctly, i guess you’ll have to tweak mass, friction and so on a lot

To move the center of mass you will have to use a compound collision shape. Its all documented really.

Well, I took a look into documentation and I found this:

setGravity(new Vector3f(0f,-1f,0f)) -> You can change the gravity of a physics object after it was added to the physics space.

Is this method moving the gravity center of the physics ? I made some tests and I can't really find it out, it has weird consequences...

No, setGravity sets the force that is sticking objects to the ground, not the center of mass.

And is there a way to move the center of mass ? Cause I looked into physics methods and found none…

normen said:
To move the center of mass you will have to use a compound collision shape. Its all documented really.

I am using CompoundCollisionShape. I have a SphereCollisionShape added to my CompoundCollisionShape the whole thing with a RigidBodyControl. But in none of these I have access to such a method. Only methods I found relative to the mass center are setGravity() and calculateLocalInertia(). The first one appears not to be what I’m looking for and the second one doesn’t work as it return the following error:

The method calculateLocalInertia(float, Vector3f) in the type CollisionShape is not applicable for the arguments (float, Vector3f)

Which btw is pretty weird... and I looked several times into the documentation and found nothing more.

I think what Normen was getting at is that if you want to move the center of gravity then you have to create one shape with large mass and another shape with less mass and then combine them into your shape with off center mass.

I gather bullet does not let you set the center of mass… but I never used it.

Also, calculateLocalIntertia has a different vec3 than the one you are thinking:

public void calculateLocalInertia(float mass, javax.vecmath.Vector3f vector)

Oh I didn’t get it that way… but the thing then is that the mass is set up in the RigidBodyControl, not in the CollisionShape so I can only set up the whole body mass. Unless there is some tip… I’m gonna try to use 2 RigidBodyControl but I don’t think it’s gonna work.

You shift the location with it: