btTransform vs custom transform representation
Posted: Mon Oct 26, 2015 3:41 am
Hi,
I've been pretty successful in hacking the bullet Hello World program into the game I'm developing, and I'm beginning to consider how I'll be integrating it into the rest of my engine. At the moment I'm using a custom math library, with all the standard types (Vec2/3/4, Mat4, Quat, etc). I've been successfully using my own Transform type as well so far, and I'm a bit reluctant to stop using it in favor of btTransform. To that end I see three options:
- Maintain separate collections of "btTransform" and "Transform" structs, and just synchronize them pre and post physics simulation. This may be a bit slow, but it allows me to continue using my own API (also abstracts away the implementation of physics, though I'm not convinced in the value of that yet).
- Have my own Transform type be just a wrapper around a 'btTransform' instance. This would allow me to expose the same API, using the Bullet implementation underneath.
- Drop my entire math library in favor of Bullet. This would certainly prove to be more performant, since I won't be copying data around unnecessarily and Bullet's math code is way faster than mine anyway.
However, before I decide on the solution I'd like to know what you guys think, and what you've done in the past. While it seems that using pure Bullet math would be the best solution for integration and performance, I'm still very new and I'd like to continue using my own API if possible as long as it's not too much of a hassle or decreases performance too much.
Thanks
I've been pretty successful in hacking the bullet Hello World program into the game I'm developing, and I'm beginning to consider how I'll be integrating it into the rest of my engine. At the moment I'm using a custom math library, with all the standard types (Vec2/3/4, Mat4, Quat, etc). I've been successfully using my own Transform type as well so far, and I'm a bit reluctant to stop using it in favor of btTransform. To that end I see three options:
- Maintain separate collections of "btTransform" and "Transform" structs, and just synchronize them pre and post physics simulation. This may be a bit slow, but it allows me to continue using my own API (also abstracts away the implementation of physics, though I'm not convinced in the value of that yet).
- Have my own Transform type be just a wrapper around a 'btTransform' instance. This would allow me to expose the same API, using the Bullet implementation underneath.
- Drop my entire math library in favor of Bullet. This would certainly prove to be more performant, since I won't be copying data around unnecessarily and Bullet's math code is way faster than mine anyway.
However, before I decide on the solution I'd like to know what you guys think, and what you've done in the past. While it seems that using pure Bullet math would be the best solution for integration and performance, I'm still very new and I'd like to continue using my own API if possible as long as it's not too much of a hassle or decreases performance too much.
Thanks