How enable ccd ?

sonic
Posts: 2
Joined: Tue Sep 01, 2009 1:55 pm

How enable ccd ?

Post by sonic »

I create small rigid body object with cylinder collision shape and big box static object with box collision shape. I apply impulse to my small object:

Code: Select all

//direciton - unit vector
//power - value between 60 and 80
obj->applyImpulse(direction*power, btVector3(0,0,0));
With 90% probability it collision with big box and bounce.
With 10% probability my small object move through big box.

My physic render code:

Code: Select all

btSoftRigidDynamicsWorld->stepSimulation( 1.0f / 60.0f, 0 )
I think that i do not enable ccd and call that function for my small object:

Code: Select all

obj->setCcdMotionThreshold( 0.5f );
obj->setCcdSweptSphereRadius( 0.2*0.5f );
but that not help me.

What code i must edit or paste for 100% chance to collision and bounce?
sonic
Posts: 2
Joined: Tue Sep 01, 2009 1:55 pm

Re: How enable ccd ?

Post by sonic »

i use bullet in sio2 game engine:

Code: Select all

void sio2PhysicRender( SIO2physic *_SIO2physic,
		float	   _timestep,
		int		   _pass )
{
	unsigned int i = 0;
	
	if( _SIO2physic->state == SIO2_PHYSIC_PLAY )
	{
		float sub = _timestep / ( float )_pass;

		while( i != _pass )
		{
			_SIO2physic->_btSoftRigidDynamicsWorld->stepSimulation( sub, 0 );
			++i;
		}
	}
}
I set _timestep = 1.0/60.0 _pass = 4 in sio2PhysicRender.
But sometimes this decision miss collision check cylinder shape with triangle shape. I bound my static triangle mesh with ghost static boxes in blender and now i check collision only with bound boxes. That give me good collision detect and bounce.