1)When the car has been just added this is true
Code: Select all
wInfo.m_raycastInfo.m_groundObject != NULL && wInfo.m_skidInfo < 1.
2)When the car touches the surface, m_contactPointWS y axis == 4.xxe-8 and sometimes -4.xxe-8, why? How can i correct it?
3)I realy cant understand how i can build a rectangle around the contactpoint that will be perpendicular to m_contactNormalWS and the 2 sides will be parallel to the wheel forward vector, now i'm doing it this way
Code: Select all
btWheelInfo& wInfo = vehicle->getWheelInfo(i);
btVector3 wCP = wInfo.m_raycastInfo.m_contactPointWS;
if(wInfo.m_raycastInfo.m_groundObject != NULL && wInfo.m_skidInfo < 1. && wInfo.m_skidInfo > 0.0)
{
//if(oldChains[i].back()->getChainElement(0, oldChains[i].back()->getMaxChainElements() - 1).position.distance(pos) >= 0.1 && !haveInterupt[i])
//{
btVector3 orig = vehicle->getForwardVector().rotate(wInfo.m_raycastInfo.m_contactNormalWS, wInfo.m_steering);
orig.setY(wInfo.m_raycastInfo.m_contactPointWS.getY());
orig.normalize();
btVector3 perp = wInfo.m_raycastInfo.m_contactNormalWS.cross(wCP).normalize();
ManualObject* newObj = new ManualObject("TierTracksChains_" + StringConverter::toString(i) + "_" + StringConverter::toString(++totalCount[i]));
newObj->begin("CarTierStrip", RenderOperation::OT_TRIANGLE_STRIP);
newObj->setCastShadows(false);
newObj->position(cvt(wCP + orig - perp));
newObj->position(cvt(wCP - orig - perp));
newObj->position(cvt(wCP - orig + perp));
newObj->position(cvt(wCP + orig + perp));
newObj->index(0);
newObj->index(1);
newObj->index(2);
newObj->index(3);
newObj->index(0);
newObj->end();
//newObj->colour(1., 1., 1., 1. - wInfo.m_frictionSlip * wInfo.m_frictionSlip);
mSceneManager->getRootSceneNode()->attachObject(newObj);
}