Vehicle simmulating improvement

Towelie
Posts: 9
Joined: Mon Sep 20, 2010 10:07 am

Vehicle simmulating improvement

Post by Towelie »

Hi, I'm doing a simple racing game. I found an article and trying to apply the code in my program.
In the part of "Interpolate Normals" smoothing the corners of the object is used, as I understood I had to used them in the function
btDefaultVehicleRaycaster:: castRay (const btVector3 & from, const btVector3 & to, btVehicleRaycasterResult & result) namely:

Code: Select all

void* btDefaultVehicleRaycaster::castRay(const btVector3& from,const btVector3& to, btVehicleRaycasterResult& result)
{
//	RayResultCallback& resultCallback;

	btCollisionWorld::ClosestRayResultCallback rayCallback(from,to);

	m_dynamicsWorld->rayTest(from, to, rayCallback);

	if (rayCallback.hasHit())
	{
		
		btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject);
        if (body && body->hasContactResponse())
		{
			result.m_hitPointInWorld = InterpolateMeshNormal(
				rayCallback.m_collisionObject->getWorldTransform(), // transform is the mesh shape's world transform
				rayCallback.m_collisionObject->getCollisionShape(), 
				,					//subpart
				,					//triangle
				rayCallback.m_hitPointWorld); // position is the world space hit point of the ray

			//result.m_hitPointInWorld = rayCallback.m_hitPointWorld;
			result.m_hitNormalInWorld = rayCallback.m_hitNormalWorld;
			result.m_hitNormalInWorld.normalize();
			result.m_distFraction = rayCallback.m_closestHitFraction;
			return body;
		}
	}
	return 0;
}
... But how can i learn the subpart and the triangle of rayCallback?
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm

Re: Vehicle simmulating improvement

Post by dphil »