You are on page 1of 3

/*

models[1].Rotation += new Vector3(-speed * 10 + models[1].Rotation.


X, models[0].Rotation.Y + MathHelper.Pi + WheelTurn, -Angle34) -new Vector3(mo
dels[1].Rotation.X, models[1].Rotation.Y, models[1].Rotation.Z);
models[2].Rotation += new Vector3( speed * 10 + models[2].Rotation.
X, models[0].Rotation.Y + WheelTurn , Angle34) -new Vector3(mo
dels[2].Rotation.X, models[2].Rotation.Y, models[2].Rotation.Z);
models[3].Rotation += new Vector3( speed * 10 + models[3].Rotation.X
, models[0].Rotation.Y, Angle34) -new Vector3(mode
ls[3].Rotation.X, models[3].Rotation.Y, models[3].Rotation.Z);
models[4].Rotation += new Vector3(-speed * 10 + models[4].Rotation.X
, models[0].Rotation.Y + MathHelper.Pi, -Angle34) -new Vector3(mod
els[4].Rotation.X, models[4].Rotation.Y, models[4].Rotation.Z);

models[1].Rotation = new Vector3(Angle12, models[1].Rotation.Y, -A
ngle34);
models[2].Rotation = new Vector3(Angle12, models[2].Rotation.Y, An
gle34);
models[3].Rotation = new Vector3(Angle12, models[3].Rotation.Y, An
gle34);
models[4].Rotation = new Vector3(Angle12, models[4].Rotation.Y, -A
ngle34);
models[1].Rotation = new Vector3(models[1].Rotation.X * (float)Mat
h.Cos(Angle34), models[1].Rotation.Y * (float)Math.Sin(Angle34), models[0].Rotat
ion.Z);
models[2].Rotation = new Vector3(models[2].Rotation.X * (float)Mat
h.Cos(Angle34), models[2].Rotation.Y * (float)Math.Sin(Angle34), models[0].Rotat
ion.Z);
models[3].Rotation = new Vector3(models[3].Rotation.X * (float)Mat
h.Cos(Angle34), models[3].Rotation.Y * (float)Math.Sin(Angle34), models[0].Rotat
ion.Z);
models[4].Rotation = new Vector3(models[4].Rotation.X * (float)Mat
h.Cos(Angle34), models[4].Rotation.Y * (float)Math.Sin(Angle34), models[0].Rotat
ion.Z);
*/
/*
//Calculate some lenghts
L1 = (float)Math.Sqrt((float)Math.Pow(models[1].Position.X - models[
3].Position.X, 2) + (float)Math.Pow(models[1].Position.Z - models[3].Position.Z,
2));
L2 = (float)Math.Sqrt((float)Math.Pow(models[2].Position.X - models[
4].Position.X, 2) + (float)Math.Pow(models[2].Position.Z - models[4].Position.Z,
2));
L3 = (float)Math.Sqrt((float)Math.Pow(models[1].Position.X - models[
2].Position.X, 2) + (float)Math.Pow(models[1].Position.Z - models[2].Position.Z,
2));
L4 = (float)Math.Sqrt((float)Math.Pow(models[3].Position.X - models[
4].Position.X, 2) + (float)Math.Pow(models[3].Position.Z - models[4].Position.Z,
2));
*/
/*
Point_Right = new Vector3((float)Math.Cos(models[0].Rotation.Y) * -S
emiRadiusL34 * (float)Math.Cos(Angle34), -(float)Math.Sin(Angle34) * SemiRadiusL
34, (float)Math.Sin(models[0].Rotation.Y) * SemiRadiusL34 * (float)Math.Cos(Angl
e34));
Point_Left = new Vector3((float)Math.Cos(models[0].Rotation.Y) * Sem
iRadiusL34 * (float)Math.Cos(Angle34), (float)Math.Sin(Angle34) * SemiRadiusL34,
(float)Math.Sin(models[0].Rotation.Y) * -SemiRadiusL34 * (float)Math.Cos(Angle3
4));
Point_Up = new Vector3((float)Math.Cos(models[0].Rotation.Y + MathHe
lper.PiOver2) * -SemiRadiusL12 * (float)Math.Cos(Angle12), (float)Math.Sin(Angle
12) * SemiRadiusL12, (float)Math.Sin(models[0].Rotation.Y + MathHelper.PiOver2)
* SemiRadiusL12 * (float)Math.Cos(Angle12));
Point_Down = new Vector3((float)Math.Cos(models[0].Rotation.Y + Math
Helper.PiOver2) * -SemiRadiusL12 * (float)Math.Cos(Angle12), (float)Math.Sin(Ang
le12) * SemiRadiusL12, (float)Math.Sin(models[0].Rotation.Y + MathHelper.PiOver2
) * SemiRadiusL12 * (float)Math.Cos(Angle12));
*/
//Wheels
models[1].Position += Vector3.Transform(NewCarPosition, Matrix.Creat
eFromYawPitchRoll(models[1].Rotation.Y, models[1].Rotation.X, models[1].Rotation
.Z));
models[2].Position += Vector3.Transform(NewCarPosition, Matrix.Creat
eFromYawPitchRoll(models[2].Rotation.Y, models[2].Rotation.X, models[2].Rotation
.Z));
models[3].Position += Vector3.Transform(NewCarPosition, Matrix.Creat
eFromYawPitchRoll(models[3].Rotation.Y, models[3].Rotation.X, models[3].Rotation
.Z));
models[4].Position += Vector3.Transform(NewCarPosition, Matrix.Creat
eFromYawPitchRoll(models[4].Rotation.Y, models[4].Rotation.X, models[4].Rotation
.Z));

Point_Right = new Vector3((float)Math.Cos(models[0].Rotation.Y) * -S
emiRadiusL34 * (float)Math.Cos(Angle34), -(float)Math.Sin(Angle34) * SemiRadiusL
34, (float)Math.Sin(models[0].Rotation.Y) * SemiRadiusL34 * (float)Math.Cos(Angl
e34));
Point_Left = new Vector3((float)Math.Cos(models[0].Rotation.Y) * Sem
iRadiusL34 * (float)Math.Cos(Angle34), (float)Math.Sin(Angle34) * SemiRadiusL34,
(float)Math.Sin(models[0].Rotation.Y) * -SemiRadiusL34 * (float)Math.Cos(Angle3
4));

float InitialAngleW = (float)Math.Asin(0.860f);
float RadiusWDR = (float)Math.Sqrt(0.152f * 0.152f + -0.245f * -0.24
5f);
float RadiusWUR = (float)Math.Sqrt(0.152f * 0.152f + 0.245f * 0.245f
);
float RadiusWDL = (float)Math.Sqrt(-0.152f * -0.152f + -0.245f * -0.
245f);
float RadiusWUL = (float)Math.Sqrt(-0.152f * -0.152f + 0.245f * 0.24
5f);

//Change rotation points (not the center of the car)
Vector3 WURPlane = new Vector3((float)Math.Cos(models[0].Rotation.Y
- InitialAngleW) * (float)Math.Cos(Angle34) * (float)Math.Cos(Angle12) * RadiusW
UR, (float)Math.Cos(Angle34) * (float)Math.Sin(Angle12) * -RadiusWUR + 0.065f, (
float)Math.Sin(-models[0].Rotation.Y + InitialAngleW) * (float)Math.Cos(Angle34)
* (float)Math.Cos(Angle12) * RadiusWUR);//0.065f
Vector3 WULPlane = new Vector3((float)Math.Cos(models[0].Rotation.Y
+ InitialAngleW) * (float)Math.Cos(Angle34) * (float)Math.Cos(Angle12) * -Radius
WUL, (float)Math.Cos(Angle34) * (float)Math.Sin(Angle12) * -RadiusWUL + 0.065f,
(float)Math.Sin(-models[0].Rotation.Y - InitialAngleW) * (float)Math.Cos(Angle34
) * (float)Math.Cos(Angle12) * -RadiusWUL);
Vector3 WDLPlane = new Vector3((float)Math.Cos(models[0].Rotation.Y
+ InitialAngleW) * (float)Math.Cos(Angle34) * (float)Math.Cos(Angle12) * RadiusW
DL, (float)Math.Cos(Angle34) * (float)Math.Sin(Angle12) * RadiusWDL + 0.065f, (f
loat)Math.Sin(-models[0].Rotation.Y - InitialAngleW) * (float)Math.Cos(Angle34)
* (float)Math.Cos(Angle12) * RadiusWDL);
Vector3 WDRPlane = new Vector3((float)Math.Cos(models[0].Rotation.Y
- InitialAngleW) * (float)Math.Cos(Angle34) * (float)Math.Cos(Angle12) * -Radius
WDR, (float)Math.Cos(Angle34) * (float)Math.Sin(Angle12) * RadiusWDR + 0.065f, (
float)Math.Sin(-models[0].Rotation.Y + InitialAngleW) * (float)Math.Cos(Angle34)
* (float)Math.Cos(Angle12) * -RadiusWDR);
models[1].Position = models[0].Position + Point_Right + new Vector3(
(float)Math.Cos(models[0].Rotation.Y - MathHelper.PiOver2) * SemiRadiusL12, 0.06
4f, (float)Math.Sin(models[0].Rotation.Y + MathHelper.PiOver2) * SemiRadiusL12 *
(float)Math.Cos(Angle12)) + new Vector3(0, -(float)Math.Sin(Angle12) * SemiRadi
usL12, 0);
models[2].Position = models[0].Position + Point_Left + new Vector3((
float)Math.Cos(models[0].Rotation.Y + MathHelper.PiOver2) * -SemiRadiusL12, 0.06
4f, (float)Math.Sin(models[0].Rotation.Y - MathHelper.PiOver2) * -SemiRadiusL12)
* (float)Math.Cos(Angle12) + new Vector3(0, -(float)Math.Sin(Angle12) * SemiRad
iusL12, 0);
models[3].Position = models[0].Position + Point_Left + new Vector3((
float)Math.Cos(models[0].Rotation.Y + MathHelper.PiOver2) * SemiRadiusL12, 0.064
f, (float)Math.Sin(models[0].Rotation.Y - MathHelper.PiOver2) * SemiRadiusL12) *
(float)Math.Cos(Angle12) + new Vector3(0, (float)Math.Sin(Angle12) * SemiRadius
L12, 0);
models[4].Position = models[0].Position + Point_Right + new Vector3(
(float)Math.Cos(models[0].Rotation.Y - MathHelper.PiOver2) * -SemiRadiusL12, 0.0
64f, (float)Math.Sin(models[0].Rotation.Y - MathHelper.PiOver2) * SemiRadiusL12)
* (float)Math.Cos(Angle12) + new Vector3(0, (float)Math.Sin(Angle12) * SemiRadi
usL12, 0);

You might also like