I cant see them because i use Andorra 2D, and basically i programmed my vehicle class in blind.
Now i set the position of my tiers like this
- Code: Select all
TireMatrix:=AdMatrix_Translate(20, 10, 0);
AddTire(TireMatrix, 10, 10);
the function AdMatrix_Translate is:
- Code: Select all
AdMatrix_Identity : TAdMatrix = ((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1));
function AdMatrix_Translate(const tx,ty,tz:single):TAdMatrix;
begin
result := AdMatrix_Identity;
result[3,0] := tx;
result[3,1] := ty;
result[3,2] := tz;
end;
The procedure AddTire calls this:
- Code: Select all
constructor TNewtonTire.Create(pVehicle : TVehicle; pMatrix : TAdMatrix; pWidth, pRadius : Single);
var
tireMass : Single;
tireSuspensionShock : Single;
tireSuspensionSpring : Single;
tireSuspensionLength : Single;
tirePin : TAdVector3;
begin
tireMass := pVehicle.Mass/20;
tireSuspensionLength := 0.3;
tireSuspensionSpring := (200 * 9.8) / 0.3;
tireSuspensionShock := 2 * Sqrt(tireSuspensionSpring);
TirePin := AdVector3(0, 0, 1);
ID:=Integer(NewtonVehicleAddTire(pVehicle.VehicleJoint, @PMatrix[0,0], @TirePin.X, tireMass, pWidth, pRadius,tireSuspensionShock, tireSuspensionSpring, tireSuspensionLength, self, 0));
NewtonVehicleSetTireMaxLongitudinalSlideSpeed(pVehicle.VehicleJoint, Pointer(ID), 500);
end;
Could you explain me how the matrix for tiers works. How to set them in their appropriate place. and what size to give them for my Car box with size 200 width and 100 height and 100 Z tall.