To add something new algorithm into bullet, how can I do?

bunengzaicai
Posts: 15
Joined: Sun Feb 15, 2009 3:42 am

To add something new algorithm into bullet, how can I do?

Post by bunengzaicai »

I have been tracing bullet codes for several days.
First, I should say, I am quite new to Bullet. By now, I still can not understand Bullet structure totally. I should say thanks to Erwin, since his answers help a lot.
I have some mechanics background, and want to try some new algorithm on bullet. I can write some codes like: copy SoftBody directory and replace some codes with mine. But, I don't think this is a good way.
What I want to ask is:
1. Which classes or files should I pay more attention to if I develop some algorithms? and Is there a picture or figure to describe the algorithm-inserting process?
I do want to do some contribution to Bullet and I want to contribute my codes in a professional way.
Thanks
bunengzaicai
Posts: 15
Joined: Sun Feb 15, 2009 3:42 am

Re: To add something new algorithm into bullet, how can I do?

Post by bunengzaicai »

No suggestions?
I found a function when following debug,

btDiscreteDynamicsWorld::internalSingleStepSimulation( timeStep );

///solve soft bodies constraints
solveSoftBodiesConstraints();

///update soft bodies
updateSoftBodies();
this function is for each step calculation, right?
I think the worst thing is to write a new solveSoftBodiesConstraints and updateSoftBodies myself, but it is not a formal way to do that.
Could anyone present your suggestions?
:P
bunengzaicai
Posts: 15
Joined: Sun Feb 15, 2009 3:42 am

Re: To add something new algorithm into bullet, how can I do?

Post by bunengzaicai »

NO REPLY??????
I think I have to modify sourcecodes of softbody demos. Actually, I changed the project file and replaced algorithm files with my own now.
It will work soon. But I think it is not a proper way to add new algorithms, right? And I can not find any docs about adding algorithms.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: To add something new algorithm into bullet, how can I do?

Post by Erwin Coumans »

You were posting in the wrong section. Please don't use the general discussion section, but the Bullet Physics SDK discussion section next time: http://www.bulletphysics.com/Bullet/php ... um.php?f=9

If you want to replace a collision algorithm between two specific types of collision shapes, just register your custom collision algorithm to the collision dispatcher, using btCollisionDispatche::registerCollisionCreateFunc.

Tuere is a sample that replaces the sphere-sphere collision algorithm, see Bullet/Demos/UserCollisionAlgorithm. If you want to replace the soft body versus rigid body algorithms, just write your replacement for btSoftRigidCollisionAlgorithm. This is quite complicated, so it requires a lot of time and insight into Bullet.

Hope this helps,
Erwin
bunengzaicai
Posts: 15
Joined: Sun Feb 15, 2009 3:42 am

Re: To add something new algorithm into bullet, how can I do?

Post by bunengzaicai »

Thank you very much.
I thought this topic belong to general one, so...
What I want to do is to insert my algorithm to alleviate skin-effection of triangle mesh, i.e. to modify btSoftRigidCollisionAlgorithm.
Actually, I have tracked at least 52 functions which start from setSolver to defaultCollisionHandler. The day before yesterday, I saw a function "CProfileManager::dumpAll()" you posted on other topic. It is very helpful for understanding.
Thanks.