# Physics Simulation Forum

 All times are UTC

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Center of mass World Transform for compound shapesPosted: Sat May 05, 2012 9:59 am

Joined: Tue May 01, 2012 10:42 am
Posts: 97
Hi there, I have (beginners) question about the world transform of compound shapes.
It sais in the manual that "The world transform of a rigid body is in Bullet always equal to its center of mass"

What exactly does mean in practice? In my situation I would create a compoundshape, and add some child shapes. Chances are big, my center of the compound shape, is not the same as the center of mass of the object.

When I create the object I have to pass a motionstate, with a worldtransform. Is the center of my compoundshape positioned at that point, or is the objects center of mass positioned at that point?

And if this isn't the case, what happens after that? Does bullet immediatly change the the world transform to match the center of gravity? And does it then also update the child's motion state to match this new worldtransform of their parent, or .. ?

What I do now:

I create a motion state for the compoundshape
I create a compound shape
#For each child shape:
I create a motionstate for the child object (I feel like I wouldn't have to do this, cause the local position/rotation of the child shape should never change right?)
I remember how much mass the child shapes add (totalmass+=childmass)
I create a collisionshape for the child
I add it to the compound shape
#endfor
I call calculateLocalInertia on the compound shape, using totalmass
I make a ConstructionInfo
I make the body

So what exactly happens to the worldtransforms in the motionstates of the compound, and of the children? Or does nothing happen and do I have a problem cause my worldtransform of the compound is not at the center of mass of the object?

Thanks a lot for any help!

Top

 Posted: Sun May 06, 2012 8:16 am

Joined: Tue Dec 25, 2007 1:06 pm
Posts: 347
STTrife wrote:
my center of the compound shape, is not the same as the center of mass of the object.
AFAIK, Bullet does not know and does not try to calculate the center of mass of the compound shape you pass to it: it just takes the point (0,0,0) in that shape and makes it the center of mass of your shape.
If you need to move it from there, you can shift all the child shapes inside the compound shape, or you can just create a new compound shape and add as a child shape the old compound shape shifted by an offset.
STTrife wrote:
When I create the object I have to pass a motionstate, with a worldtransform. Is the center of my compoundshape positioned at that point, or is the objects center of mass positioned at that point?
The object center of mass [(0,0,0) inside the compound shape] is positioned at that point.
STTrife wrote:
I create a motionstate for the child object (I feel like I wouldn't have to do this, cause the local position/rotation of the child shape should never change right?)
Maybe I'm missing something here... Motion states can be applied to btCollisionObjects (or more frequently to btRigidBodies): the children of a compound shape are btCollisionShapes (unless you extend the btCompoundShape class...); I suppose you're trying to inglobe existing rigid bodies into an existing btCompoundShape.
STTrife wrote:
Or does nothing happen and do I have a problem cause my worldtransform of the compound is not at the center of mass of the object?
The latter as far as I know. But you can shift the center of mass inside the btCompoundShape manually and then update the local inertia.
There's a demo posted by Erwin you can download from here that can be useful: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=3303&hilit=shift+demo

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 2 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: Bing [Bot] and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities