generating normals for raycast vehicle

dakffyd
Posts: 13
Joined: Wed Jan 20, 2010 1:35 am

generating normals for raycast vehicle

Post by dakffyd »

I'm integrating bullet into a game engine, and I want to be able to drive a raycast vehicle over my engine's native geometry.

I've overidden btVehicleRaycaster::castRay(...) to do this, simply using my engine's methods to cast rays and check for collision, then setting the raycast results manually and returning a non-null value if there is.

Collision basically works, but I'm having trouble setting the btVehicleRaycasterResult::m_hitNormalInWorld. Specifically, If I normalize my normals, my vehicle plunges through the ground almost unhindered. If I make the normals longer(around 5 seems to work), then my vehicle bounces around and usually ends up bouncing higher and higher and out of the world.

Currently I'm dealing with flat ground and a hard coded normal pointing straight up, so that is not where the problem lies. My next step is going to be creating a rigid body on-the-fly to simulate the ground, and return that....but looking through the vehicle code, it doesn't look like such an object will ever be used.

Any suggestions?
thanks!