//
// Generated by Brutal.Jolt.Generate; do not edit by hand.
#nullable enable
using System.Runtime.CompilerServices;
using Brutal.Interop;
using Brutal.Numerics;
namespace Brutal.JoltApi
{
///
///
/// Runtime controller class
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:89
///
/// class WheeledVehicleController : public VehicleController
///
///
[InteropHandle]
public readonly partial struct WheeledVehicleController : IDisposable
{
///
///
/// Constructor
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:95
///
/// WheeledVehicleController(const WheeledVehicleControllerSettings &inSettings, VehicleConstraint &inConstraint)
///
///
public static WheeledVehicleController Create(
WheeledVehicleControllerSettings settings,
VehicleConstraint constraint
) => Jolt.PInvoke.WheeledVehicleController_Create(settings, constraint);
///
///
/// Set input from driver
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:105
///
/// void SetDriverInput(float inForward, float inRight, float inBrake, float inHandBrake)
///
///
///
///
/// Set input from driver
/// @param inForward Value between -1 and 1 for auto transmission and value between 0 and 1 indicating desired driving direction and amount the gas pedal is pressed
/// @param inRight Value between -1 and 1 indicating desired steering angle (1 = right)
/// @param inBrake Value between 0 and 1 indicating how strong the brake pedal is pressed
/// @param inHandBrake Value between 0 and 1 indicating how strong the hand brake is pulled
///
///
public void SetDriverInput(float forward, float right, float brake, float handBrake) =>
Jolt.PInvoke.WheeledVehicleController_SetDriverInput(this, forward, right, brake, handBrake);
///
///
/// Value between -1 and 1 for auto transmission and value between 0 and 1 indicating desired driving
/// direction and amount the gas pedal is pressed
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:108
///
/// void SetForwardInput(float inForward)
///
///
public void SetForwardInput(float forward) =>
Jolt.PInvoke.WheeledVehicleController_SetForwardInput(this, forward);
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:109
///
/// float GetForwardInput() const
///
///
public float GetForwardInput() => Jolt.PInvoke.WheeledVehicleController_GetForwardInput(this);
///
///
/// Value between -1 and 1 indicating desired steering angle (1 = right)
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:112
///
/// void SetRightInput(float inRight)
///
///
public void SetRightInput(float right) => Jolt.PInvoke.WheeledVehicleController_SetRightInput(this, right);
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:113
///
/// float GetRightInput() const
///
///
public float GetRightInput() => Jolt.PInvoke.WheeledVehicleController_GetRightInput(this);
///
///
/// Value between 0 and 1 indicating how strong the brake pedal is pressed
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:116
///
/// void SetBrakeInput(float inBrake)
///
///
public void SetBrakeInput(float brake) => Jolt.PInvoke.WheeledVehicleController_SetBrakeInput(this, brake);
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:117
///
/// float GetBrakeInput() const
///
///
public float GetBrakeInput() => Jolt.PInvoke.WheeledVehicleController_GetBrakeInput(this);
///
///
/// Value between 0 and 1 indicating how strong the hand brake is pulled
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:120
///
/// void SetHandBrakeInput(float inHandBrake)
///
///
public void SetHandBrakeInput(float handBrake) =>
Jolt.PInvoke.WheeledVehicleController_SetHandBrakeInput(this, handBrake);
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:121
///
/// float GetHandBrakeInput() const
///
///
public float GetHandBrakeInput() => Jolt.PInvoke.WheeledVehicleController_GetHandBrakeInput(this);
///
///
/// Get current engine state
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:124
///
/// const VehicleEngine & GetEngine() const
///
///
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public VehicleEngine GetEngine() => Jolt.PInvoke.WheeledVehicleController_GetEngine(this);
///
///
/// Get current transmission state
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:130
///
/// const VehicleTransmission & GetTransmission() const
///
///
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public VehicleTransmission GetTransmission() => Jolt.PInvoke.WheeledVehicleController_GetTransmission(this);
///
///
/// Get the differentials this vehicle has (writable interface, allows you to make changes to the
/// configuration which will take effect the next time step)
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:139
///
/// Differentials & GetDifferentials()
///
///
///
///
/// The span is a view of the container's own storage, not a copy: edits land in the object that owns it.
/// It's only valid until that container is resized or its owner is destroyed.
///
///
[return: Brutal.Attributes.Fixed]
public unsafe Span GetDifferentials()
{
Jolt.PInvoke.WheeledVehicleController_GetDifferentials(this, out var _outResult);
return new Span((void*)_outResult.Data, checked((int)_outResult.Count));
}
///
///
/// Ratio max / min average wheel speed of each differential (measured at the clutch).
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:142
///
/// float GetDifferentialLimitedSlipRatio() const
///
///
public float GetDifferentialLimitedSlipRatio() =>
Jolt.PInvoke.WheeledVehicleController_GetDifferentialLimitedSlipRatio(this);
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:143
///
/// void SetDifferentialLimitedSlipRatio(float inV)
///
///
public void SetDifferentialLimitedSlipRatio(float v) =>
Jolt.PInvoke.WheeledVehicleController_SetDifferentialLimitedSlipRatio(this, v);
///
///
/// Get the average wheel speed of all driven wheels (measured at the clutch)
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:146
///
/// float GetWheelSpeedAtClutch() const
///
///
public float GetWheelSpeedAtClutch() => Jolt.PInvoke.WheeledVehicleController_GetWheelSpeedAtClutch(this);
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:151
///
/// void SetTireMaxImpulseCallback(const TireMaxImpulseCallback &inTireMaxImpulseCallback)
///
///
///
///
/// tireMaxImpulseCallback: The callback is invoked from native code: it must be a static method marked
/// [UnmanagedCallersOnly(CallConvs = [typeof(CallConvCdecl)])], and userData is passed back to it verbatim.
/// Jolt calls it without a null check, so null is rejected. The callback and userData are retained by the
/// native object until they are replaced or the owner is destroyed - keep whatever userData points at (a
/// GCHandle, an allocation) alive for at least that long, and don't free it at the end of the call.
///
///
public unsafe void SetTireMaxImpulseCallback(
delegate* unmanaged[Cdecl]<
uint,
float*,
float*,
float,
float,
float,
float,
float,
float,
nint,
void> tireMaxImpulseCallback,
nint tireMaxImpulseCallbackUserData
)
{
if (tireMaxImpulseCallback == null)
throw new ArgumentNullException(nameof(tireMaxImpulseCallback));
Jolt.PInvoke.WheeledVehicleController_SetTireMaxImpulseCallback(
this,
tireMaxImpulseCallback,
tireMaxImpulseCallbackUserData
);
}
///
///
/// Debug drawing of RPM meter
///
///
/// C++:
/// Jolt/Physics/Vehicle/WheeledVehicleController.h:155
///
/// void SetRPMMeter(Vec3Arg inPosition, float inSize)
///
///
public void SetRPMMeter(float3 position, float size) =>
Jolt.PInvoke.WheeledVehicleController_SetRPMMeter(this, position, size);
///
public VehicleControllerSettings GetSettings() => ((VehicleController)this).GetSettings();
public static implicit operator VehicleController(WheeledVehicleController value) =>
Unsafe.BitCast(value);
public void Dispose() => Jolt.PInvoke.WheeledVehicleController_Destroy(this);
///
public VehicleConstraint GetConstraint() => ((VehicleController)this).GetConstraint();
}
}