Hello,
I'd like to set the position of my static and dynamic objects after they have been created and added to physics world (for example, teleporting an object from one position to another).
Should I use : btCollisionObject::setWorldTransform or setCenterOfMassTransform?
Could someone explain the difference please, they sound very similar.
Also if I'd like (for example) a box to have it's centre of mass at one corner, how to I specify this?
Sorry for all the questions, I'm trying to write wrappers for a cross platform (PC/360/PSP) physics engine and these are the basic things that come up. I've looked through the demos and most of them just seem to have an initial xform.
Many thanks.
Steve.
Setting position transform correctly.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Setting position transform correctly.
They are similar, and you can use either. Bullet has a collision detection system, which can be used independently too, in that case just use the btCollisionObject version. Note that you are not supposed to move static objects around, you should use 'kinematic' objects for that. See the CcdPhysicsDemo, there is a #define at the top of the file to show how to animate/move the ground.steveh wrote:Hello,
I'd like to set the position of my static and dynamic objects after they have been created and added to physics world (for example, teleporting an object from one position to another).
Should I use : btCollisionObject::setWorldTransform or setCenterOfMassTransform?
Could someone explain the difference please, they sound very similar.
The local rigid body center is always the center of mass. This means that if you want your cube corner to be at the center of mass, you just shift the cube, using a btCompoundShape. The childshape (cube) can be re-positioned with a child transform, so that the corner is at the local rigid body center.Also if I'd like (for example) a box to have it's centre of mass at one corner, how to I specify this?
It would be nice if the Bullet project moved forward quicker, with more demos and documentation, but there are only limited resources, so patience (or contributions) are needed for this. My current work on Bullet focusses on Playstation 3 SPU optimizations/parallelization. From time to time, I bring back improvements to the public (open source) version.Sorry for all the questions, I'm trying to write wrappers for a cross platform (PC/360/PSP) physics engine and these are the basic things that come up. I've looked through the demos and most of them just seem to have an initial xform.
Many thanks.
Thanks for the feedback,
Erwin
-
- Posts: 22
- Joined: Mon Dec 19, 2005 3:15 pm