Big changes to bullet source(@ bullet developers)

Post Reply
he3117
Posts: 2
Joined: Sun Sep 21, 2014 8:03 am

Big changes to bullet source(@ bullet developers)

Post by he3117 »

Hi
I'm new to bullet physic but I'm working on video games in past few years and I have experience by other physic engines like havok and physx.
For my new project (a racing game)I want to use bullet physic.I tried to port my other project that used physx to use bullet but I found some missing futures in bullet and I want to ask them here before trying to implement them my self.
future I like to see in bullet:

1-contact modification
2-better way for filtering
3-a more general way for callbacks and customizations

this can be a long post so the bottom line is I think these futures are useful for every one and I think its an easy task for experience bullet developers.Is there any plan or interest to implement these options or I should try them my self and use them as heavily modified version of bullet instead of general open source?


1-It seems there is no way to alter the inverse Mass of a pair of objects in collision response.
For example I don't want the little debris in the road effect on my vehicle in any way but I need collision response for them. I need contact modification callback like physx engine.
I checked the source and it is possible by using btSolverBody.in this class we have a member named m_invMass but in more functions like btSequentialImpulseConstraintSolver.cpp they used original object invMass instead of btSolverBody invMass so we need changes here.also in function initSolverBody it should takes 2 other parameters like float invMass and float InteriaScale and use them for initializing btSolverBody so we can pass customized value instead of original

2-for collision filtering I found there is only 2 mask to use in most parts,m_collisionFilterGroup and m_collisionFilterMask.
I think its very limited for game programming and we need more space for filtering for example in physx we have 4 DWORD for filtering instead of 2 short.
I want to suggest an alternative for it.we can warp m_collisionFilterGroup and m_collisionFilterMask in a structure and use that structure.I actually wrote a prototype here:

Code: Select all

struct btGenericFilter
{
    #define NUM_ELEMENTS 2  //number of filter elements

	typedef short filterByte;//type of filter element.you can change this if you need more bits

	//array of filter value
	filterByte m_filter[NUM_ELEMENTS];

	//default constructor
	btGenericFilter()
	{
		for(int i=0;i<NUM_ELEMENTS;i++)
		{
			m_filter[i]=1;
		}
	};

	//constructor for backward compatibility
	btGenericFilter(int collisionGroup,int collisionMask)
	{
		m_filter[0]=collisionGroup;
		m_filter[1]=collisionMask;
	};

	//default behavior for filtering.use this function instead of writing it manually so any 
        //one can change it in future instead of modifying all the source codes
	//this function works like:btCollisionWorld.h line:233
	//bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
	//collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
	//return collides;
	bool DoDefaultFiltering(const btGenericFilter &otherFilter)
	{
		bool b=( m_filter[0] & otherFilter.m_filter[1]);

		b=b && (m_filter[1] & otherFilter.m_filter[0]);

		return b;
	};

};
but the problem is these masks spreads all over the place and we need a bullet developer to change them.I can do this but it takes more time since I'm not familiar with bullet source code.


3-callbacks and customizations:again like physx its a good idea to change the callbacks to return more value instead of a single bool.We can also use them to improve performance.


thanks for reading this long post :D
Post Reply