Code: Select all
{
btCompoundShape* compo = new btCompoundShape();
btTransform t;
t.setIdentity();
t.setOrigin({0, -4, 0});
compo->addChildShape(t, shape);
shape = compo;
}
btTransform transform;
transform.setIdentity();
transform.setOrigin({0, 10, 0});
float mass = 20;
btVector3 localInertia{0, 0, 0};
shape->calculateLocalInertia(mass, localInertia);
btDefaultMotionState* motionState = new btDefaultMotionState(transform);
btRigidBody::btRigidBodyConstructionInfo info{mass, motionState, shape, localInertia};
body = new btRigidBody(info);
btRaycastVehicle::btVehicleTuning tuning;
vehicle = new btRaycastVehicle(tuning, body, game->vehicleRaycaster);
vehicle->addWheel({+0.8, -4.5, -1.8}, {0, -1, 0}, {-1, 0, 0}, 0.7, 0.4, tuning, true);
vehicle->addWheel({-0.8, -4.5, -1.8}, {0, -1, 0}, {-1, 0, 0}, 0.7, 0.4, tuning, true);
vehicle->addWheel({+0.8, -4.5, +1.9}, {0, -1, 0}, {-1, 0, 0}, 0.7, 0.4, tuning, false);
vehicle->addWheel({-0.8, -4.5, +1.9}, {0, -1, 0}, {-1, 0, 0}, 0.7, 0.4, tuning, false);
I know I definitely forgot something.