Page 1 of 1

Vehicle wheels bouncing (not btRaycastVehicle)

Posted: Sat Apr 16, 2011 10:49 am
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..

Re: Vehicle wheels bouncing (not btRaycastVehicle)

Posted: Sat Jul 30, 2011 5:23 pm
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.

Re: Vehicle wheels bouncing (not btRaycastVehicle)

Posted: Mon Aug 29, 2011 11:47 am
by julieth11
Hi,
thank you, exactly what I'm looking for!

Re: Vehicle wheels bouncing (not btRaycastVehicle)

Posted: Tue Jul 02, 2013 1:21 pm
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

Re: Vehicle wheels bouncing (not btRaycastVehicle)

Posted: Tue Jul 02, 2013 1:48 pm
by Gickl
ok, i think i solved the problem! i just had a look in the internaledgedemo