void RaycastVehicle::ResetWheels() { ResetSuspension(); for (int i = 0; i < GetNumWheels(); i++) { UpdateWheelTransform(i, true); Vector3 origin = GetWheelPosition(i); Node* wheelNode = GetWheelNode(i); wheelNode->SetWorldPosition(origin); } }
//find the precise starting position for the car (trim out the extra space) void CARDYNAMICS::AlignWithGround() { UpdateWheelTransform(); UpdateWheelContacts(); /*Dbl min_height = 0; bool no_min_height = true; for (int i = 0; i < WHEEL_POSITION_SIZE; i++) { Dbl height = wheel_contact[i].GetDepth() - 2 * tire[i].GetRadius(); if (height < min_height || no_min_height) { min_height = height; no_min_height = false; } }/**/ //-- //MATHVECTOR<Dbl,3> trimmed_position = Position() + GetDownVector() * min_height; //SetPosition(Position()/*trimmed_position*/); }