Vehicle wheels bouncing (not btRaycastVehicle)

Post Reply
firo
Posts: 4
Joined: Thu Sep 30, 2010 2:55 pm

Vehicle wheels bouncing (not btRaycastVehicle)

Post by firo »

Hi,
I am doing truck simulation in my engine, not with btRaycastVehicle. Wheels are connected to vehicle skeleton with constraints.

On faster movement the wheels bouncing.

Each wheel is connected to vehicle in order:
btRigidBody (vehicle skeleton) -> btGeneric6DofSpringConstraint (as spring) -> btRigidBody (axle) -> btGeneric6DofConstraint (engine + steering) -> btRigidBody (wheel)

Drawed with btIDebugDraw: https://docs.google.com/leaf?id=0B8G7oN ... ist&num=50

Video: https://docs.google.com/leaf?id=0B8G7oN ... ist&num=50 (terrain is btBvhTriangleMeshShape)

Whose constraints parameters i should set (ERP, CFM, ...) to disable bouncing ?

Thanks in Advance..
argez
Posts: 6
Joined: Wed Jul 27, 2011 5:18 pm

Re: Vehicle wheels bouncing (not btRaycastVehicle)

Post by argez »

this looks like a case of internal edge collision. Are you using a btBvhTriangleMeshShape for the terrain?

if you are using btHeightfieldTerrainShape, change it for a btBvhTriangleMeshShape and look into the InternalEdgeDemo source code for details on how to use the internal edge utility to adjust the edge normals.

In a nutshell:

1. Add this callback

Code: Select all

static bool CustomMaterialCombinerCallback(btManifoldPoint& cp,	const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1)
{
	btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1);
	return true;
}

extern ContactAddedCallback		gContactAddedCallback;
2. After building the btBvhTriangleMeshShape add this code where pGroundBody is your btBvhTriangleMeshShape instance

Code: Select all

// Enable custom material callback
pGroundBody->setCollisionFlags(pGroundBody->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);

btTriangleInfoMap* triangleInfoMap = new btTriangleInfoMap();
btGenerateInternalEdgeInfo(pGroundShape, triangleInfoMap);
That worked perfectly for me when i had exactly the same issue as you.
julieth11
Posts: 1
Joined: Mon Aug 29, 2011 11:45 am

Re: Vehicle wheels bouncing (not btRaycastVehicle)

Post by julieth11 »

Hi,
thank you, exactly what I'm looking for!
Gickl
Posts: 33
Joined: Tue Jun 05, 2012 8:43 am

Re: Vehicle wheels bouncing (not btRaycastVehicle)

Post by Gickl »

Hey,

now i know that i have to add the callback to the rigid bodies. but where can i put the implementation?

i have several classes where i construct the rigid bodies and add them to a global dynamic world. all the classes have a header- and src-file...

Best regards
Gickl
Gickl
Posts: 33
Joined: Tue Jun 05, 2012 8:43 am

Re: Vehicle wheels bouncing (not btRaycastVehicle)

Post by Gickl »

ok, i think i solved the problem! i just had a look in the internaledgedemo
Post Reply