Fast moving kinematic objects

nokto
Posts: 8
Joined: Fri Apr 17, 2009 12:04 am

Fast moving kinematic objects

Post by nokto »

Hi everyone,

I'm having problems programming a fast moving character in my game. It penetrates walls, sometimes going through them, as it increases speed. I have read other topics such like this one that talk about bullets or similar fast moving objects, those being always Rigid Bodies (if i understood correctly). I tried to apply the same method for my character, the result being unnoticeable if there is any.

Just for reference, almost every object in my world is a btBoxShape, static, rigid or kinematic. The collision world is initialized this way:

Code: Select all

	btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();

	btCollisionDispatcher* dispatcher = new	btCollisionDispatcher(collisionConfiguration);
	m_overlappingPairCache = new btDbvtBroadphase();
	m_constraintSolver = new btSequentialImpulseConstraintSolver;

	colWorld = new btDiscreteDynamicsWorld(dispatcher,m_overlappingPairCache,m_constraintSolver,collisionConfiguration);


The character is a capsule, and I initialized it this way:

Code: Select all

	btTransform startTransform;
	startTransform.setIdentity ();
	D3DXVECTOR3 plPos = player.getLocation().getPosition();
	startTransform.setOrigin (btVector3(plPos.x, plPos.y, plPos.z));

	m_ghostObject = new btPairCachingGhostObject();
	m_ghostObject->setWorldTransform(startTransform);
	m_overlappingPairCache->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
	btScalar characterHeight = 0.7f;
	btScalar characterWidth = 0.5f;
	btConvexShape* capsule = new btCapsuleShape(characterWidth,characterHeight);
	m_ghostObject->setCollisionShape (capsule);
	m_ghostObject->setCollisionFlags (btCollisionObject::CF_CHARACTER_OBJECT);
	m_ghostObject->setActivationState(DISABLE_DEACTIVATION);
	m_ghostObject->setCcdMotionThreshold(0.09f);
	m_ghostObject->setCcdSweptSphereRadius(0.9f);

	btScalar stepHeight = btScalar(0.005);
	m_character = new btKinematicCharacterController (m_ghostObject,capsule,stepHeight);
	colWorld->addCollisionObject(m_ghostObject,COL_ENTITIES, COL_WALLS|COL_ENTITIES|COL_POW_UPS);

	colWorld->addAction(m_character);
The maximum speed of my character is near 40m/s, which I understand is not too much. Any tips on what's going on, and what should I do?

Thank you in advance,
nokto.-
nokto
Posts: 8
Joined: Fri Apr 17, 2009 12:04 am

Re: Fast moving kinematic objects

Post by nokto »

Hi again,

My problem is still not solved. Please help me.

nokto.-