//
// 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
{
///
///
/// Configuration for constraint that simulates a wheeled vehicle.
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:23
///
/// class VehicleConstraintSettings : public ConstraintSettings
///
///
///
///
/// Configuration for constraint that simulates a wheeled vehicle.
///
/// The properties in this constraint are largely based on "Car Physics for Games" by Marco Monster.
/// See: https://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html
///
///
[InteropHandle]
public readonly partial struct VehicleConstraintSettings : IDisposable
{
public static VehicleConstraintSettings Create() => Jolt.PInvoke.VehicleConstraintSettings_Create();
///
public RTTI GetRTTI() => ((ConstraintSettings)this).GetRTTI();
///
public unsafe Ptr CastTo(RTTI rtti) => ((ConstraintSettings)this).CastTo(rtti);
///
public void SaveBinaryState(StreamOut stream) => ((ConstraintSettings)this).SaveBinaryState(stream);
///
///
/// Vector indicating the up direction of the vehicle (in local space to the body)
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:31
///
/// Vec3 mUp { 0, 1, 0 }
///
///
public float3 GetUp() => Jolt.PInvoke.VehicleConstraintSettings_GetUp(this);
///
///
/// Vector indicating the up direction of the vehicle (in local space to the body)
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:31
///
/// Vec3 mUp { 0, 1, 0 }
///
///
public void SetUp(float3 value) => Jolt.PInvoke.VehicleConstraintSettings_SetUp(this, value);
///
///
/// Vector indicating forward direction of the vehicle (in local space to the body)
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:32
///
/// Vec3 mForward { 0, 0, 1 }
///
///
public float3 GetForward() => Jolt.PInvoke.VehicleConstraintSettings_GetForward(this);
///
///
/// Vector indicating forward direction of the vehicle (in local space to the body)
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:32
///
/// Vec3 mForward { 0, 0, 1 }
///
///
public void SetForward(float3 value) => Jolt.PInvoke.VehicleConstraintSettings_SetForward(this, value);
///
///
/// Defines the maximum pitch/roll angle (rad), can be used to avoid the car from getting upside down. The
/// vehicle up direction will stay within a cone centered around the up axis with half top angle
/// mMaxPitchRollAngle, set to pi to turn off.
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:33
///
/// float mMaxPitchRollAngle = JPH_PI
///
///
public float GetMaxPitchRollAngle() => Jolt.PInvoke.VehicleConstraintSettings_GetMaxPitchRollAngle(this);
///
///
/// Defines the maximum pitch/roll angle (rad), can be used to avoid the car from getting upside down. The
/// vehicle up direction will stay within a cone centered around the up axis with half top angle
/// mMaxPitchRollAngle, set to pi to turn off.
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:33
///
/// float mMaxPitchRollAngle = JPH_PI
///
///
public void SetMaxPitchRollAngle(float value) =>
Jolt.PInvoke.VehicleConstraintSettings_SetMaxPitchRollAngle(this, value);
///
///
/// List of wheels and their properties
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:34
///
/// Array<Ref<WheelSettings>> mWheels
///
///
///
///
/// Returns an owned native buffer - read it through AsSpan() and Dispose it when you are done with it. The
/// handles in it are borrowed views into the buffer: they stay valid until Dispose and must not be disposed
/// themselves.
///
///
public NativeArray GetWheels() =>
new NativeArray(Jolt.PInvoke.VehicleConstraintSettings_GetWheels(this));
///
///
/// List of wheels and their properties
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:34
///
/// Array<Ref<WheelSettings>> mWheels
///
///
public unsafe void SetWheels(ReadOnlySpan value)
{
fixed (WheelSettings* value_fixed = value)
{
Jolt.PInvoke.VehicleConstraintSettings_SetWheels(this, value_fixed, (nuint)value.Length);
}
}
///
///
/// List of anti rollbars and their properties
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:35
///
/// VehicleAntiRollBars mAntiRollBars
///
///
///
///
/// 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 GetAntiRollBars()
{
Jolt.PInvoke.VehicleConstraintSettings_GetAntiRollBars(this, out var _outResult);
return new Span((void*)_outResult.Data, checked((int)_outResult.Count));
}
///
///
/// List of anti rollbars and their properties
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:35
///
/// VehicleAntiRollBars mAntiRollBars
///
///
public unsafe void SetAntiRollBars(ReadOnlySpan value)
{
fixed (VehicleAntiRollBar* value_fixed = value)
{
Jolt.PInvoke.VehicleConstraintSettings_SetAntiRollBars(this, value_fixed, (nuint)value.Length);
}
}
///
///
/// Defines how the vehicle can accelerate / decelerate
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:36
///
/// Ref<VehicleControllerSettings> mController
///
///
///
///
/// The returned handle carries its own reference; Dispose it once when you're done.
///
///
public VehicleControllerSettings GetController() => Jolt.PInvoke.VehicleConstraintSettings_GetController(this);
///
///
/// Defines how the vehicle can accelerate / decelerate
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleConstraint.h:36
///
/// Ref<VehicleControllerSettings> mController
///
///
public void SetController(VehicleControllerSettings value) =>
Jolt.PInvoke.VehicleConstraintSettings_SetController(this, value);
public void AddRef() => ((ConstraintSettings)this).AddRef();
public void Release() => ((ConstraintSettings)this).Release();
public uint GetRefCount() => ((ConstraintSettings)this).GetRefCount();
public static implicit operator ConstraintSettings(VehicleConstraintSettings value) =>
Unsafe.BitCast(value);
public void Dispose()
{
if (IsNull())
return;
Release();
}
///
public bool GetEnabled() => ((ConstraintSettings)this).GetEnabled();
///
public void SetEnabled(bool value) => ((ConstraintSettings)this).SetEnabled(value);
///
public uint GetConstraintPriority() => ((ConstraintSettings)this).GetConstraintPriority();
///
public void SetConstraintPriority(uint value) => ((ConstraintSettings)this).SetConstraintPriority(value);
///
public uint GetNumVelocityStepsOverride() => ((ConstraintSettings)this).GetNumVelocityStepsOverride();
///
public void SetNumVelocityStepsOverride(uint value) =>
((ConstraintSettings)this).SetNumVelocityStepsOverride(value);
///
public uint GetNumPositionStepsOverride() => ((ConstraintSettings)this).GetNumPositionStepsOverride();
///
public void SetNumPositionStepsOverride(uint value) =>
((ConstraintSettings)this).SetNumPositionStepsOverride(value);
///
public float GetDrawConstraintSize() => ((ConstraintSettings)this).GetDrawConstraintSize();
///
public void SetDrawConstraintSize(float value) => ((ConstraintSettings)this).SetDrawConstraintSize(value);
///
public ulong GetUserData() => ((ConstraintSettings)this).GetUserData();
///
public void SetUserData(ulong value) => ((ConstraintSettings)this).SetUserData(value);
}
}