-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathPhysics.cs
135 lines (118 loc) · 4.16 KB
/
Physics.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace AssettoCorsaSharedMemory
{
public class PhysicsEventArgs : EventArgs
{
public PhysicsEventArgs (Physics physics)
{
this.Physics = physics;
}
public Physics Physics { get; private set; }
}
[StructLayout (LayoutKind.Sequential)]
public struct Coordinates
{
public float X;
public float Y;
public float Z;
}
[StructLayout (LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
[Serializable]
public struct Physics
{
public int PacketId;
public float Gas;
public float Brake;
public float Fuel;
public int Gear;
public int Rpms;
public float SteerAngle;
public float SpeedKmh;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 3)]
public float[] Velocity;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 3)]
public float[] AccG;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] WheelSlip;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] WheelLoad;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] WheelsPressure;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] WheelAngularSpeed;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] TyreWear;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] TyreDirtyLevel;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] TyreCoreTemperature;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] CamberRad;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] SuspensionTravel;
public float Drs;
public float TC;
public float Heading;
public float Pitch;
public float Roll;
public float CgHeight;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 5)]
public float[] CarDamage;
public int NumberOfTyresOut;
public int PitLimiterOn;
public float Abs;
public float KersCharge;
public float KersInput;
public int AutoShifterOn;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 2)]
public float[] RideHeight;
// since 1.5
public float TurboBoost;
public float Ballast;
public float AirDensity;
// since 1.6
public float AirTemp;
public float RoadTemp;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 3)]
public float[] LocalAngularVelocity;
public float FinalFF;
// since 1.7
public float PerformanceMeter;
public int EngineBrake;
public int ErsRecoveryLevel;
public int ErsPowerLevel;
public int ErsHeatCharging;
public int ErsisCharging;
public float KersCurrentKJ;
public int DrsAvailable;
public int DrsEnabled;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] BrakeTemp;
// since 1.10
public float Clutch;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] TyreTempI;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] TyreTempM;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public float[] TyreTempO;
// since 1.10.2
public int IsAIControlled;
// since 1.11
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public Coordinates[] TyreContactPoint;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public Coordinates[] TyreContactNormal;
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 4)]
public Coordinates[] TyreContactHeading;
public float BrakeBias;
// since 1.12
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 3)]
public float[] LocalVelocity;
}
}