procedure TNewtonTire.SetTirePhysics(const Vehicle : PNewtonJoint; TireID : Integer);
var
Accel : Single;
Omega : Single;
speed : Single;
begin
// Get tire's angular velocity (angular velocity = omega)
Omega := NewtonVehicleGetTireOmega(Vehicle, TireID);
// Add some viscuos damp to the tire torque (this prevents out of control spin)
NewtonVehicleSetTireTorque(Vehicle, TireId, Torque-0.1*Omega);
speed := 1*MultiSize * Omega;
//speed := NewtonVehicleGetTireLateralSpeed(Vehicle, TireID);
NewtonVehicleSetTireMaxSideSleepSpeed (Vehicle, TireID, speed * 0.1);
// The side slip is usually propostinal to the tire longitudilnal speed, and tire load
NewtonVehicleSetTireSideSleepCoeficient (Vehicle, TireID, speed * 0.05);
// Braking
if Brake > 0 then
begin
// Get acceleration that's needed to stop the wheel
Accel := NewtonVehicleTireCalculateMaxBrakeAcceleration(Vehicle, TireID);
// Brake the wheel
NewtonVehicleTireSetBrakeAcceleration(Vehicle, TireID, Accel, BreakTorq);
// set some side slipe as funtion of the linear speed
speed := NewtonVehicleGetTireLongitudinalSpeed (Vehicle, TireID);
NewtonVehicleSetTireMaxSideSleepSpeed (Vehicle, TireID, speed * 0.1);
end;
// Reset brake
Brake := 0;
Self.speed := speed;
// Update graphics body
NewtonVehicleGetTireMatrix(Vehicle, ID, @GraphBody.Matrix[0,0]);
end;