VehiclePhysics Class
Jump to navigation
Jump to search
VehiclePhysics Class
The `VehiclePhysics` class handles the physical properties and behaviors of a vehicle within the game. It manages various aspects such as velocity, acceleration, collision detection, and state changes like landing, splashing, and flying. This class integrates with other components to ensure realistic vehicle dynamics and interactions.
Public Fields
- `public float splashOutMinTime = 0.5f;` - Minimum time required for the vehicle to be considered out of splash.
- `public Action<bool> onLandedStateChanged;` - Event triggered when the vehicle's landed state changes.
- `public Action<bool> onSplashStateChanged;` - Event triggered when the vehicle's splash state changes.
- `public Action<bool> onFlyingStateChanged;` - Event triggered when the vehicle's flying state changes.
- `public Action<bool> onGrabbedStateChanged;` - Event triggered when the vehicle's grabbed state changes.
- `public Action<bool> onFullStopStateChanged;` - Event triggered when the vehicle's full stop state changes.
Public Properties
- `public Vector3 Velocity { get; }` - Gets the current velocity of the vehicle.
- `public Vector3 Acceleration { get; }` - Gets the current acceleration of the vehicle.
- `public Vector3 GLoad { get; }` - Gets the current G-load experienced by the vehicle.
- `public Vector3 Vnorm { get; protected set; }` - Gets or sets the normalized velocity vector of the vehicle.
- `public float Speed { get; protected set; }` - Gets or sets the current speed of the vehicle.
- `public float VerticalSpeed { get; protected set; }` - Gets or sets the vertical speed of the vehicle.
- `public float FwdSpeed { get; protected set; }` - Gets or sets the forward speed of the vehicle.
- `public float LateralSpeed { get; private set; }` - Gets the lateral speed of the vehicle.
- `public float Altitude { get; }` - Gets the current altitude of the vehicle.
Useful Links
- [Vehicle Physics Documentation](https://example.com/vehicle-physics-docs) - Detailed documentation on vehicle physics.
- [Unity Rigidbody Component](https://docs.unity3d.com/ScriptReference/Rigidbody.html) - Information on Unity's Rigidbody component.
- [Vector3 Struct](https://docs.unity3d.com/ScriptReference/Vector3.html) - Unity's Vector3 struct documentation.