//
// 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
{
///
///
/// Class that does collision detection between wheels and ground
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleCollisionTester.h:19
///
/// class VehicleCollisionTester : public RefTarget<VehicleCollisionTester>, public NonCopyable
///
///
[InteropHandle]
public readonly partial struct VehicleCollisionTester : IDisposable
{
///
///
/// Object layer to use for collision detection, this is used when the filters are not overridden
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleCollisionTester.h:32
///
/// ObjectLayer GetObjectLayer() const
///
///
public ushort GetObjectLayer() => Jolt.PInvoke.VehicleCollisionTester_GetObjectLayer(this);
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleCollisionTester.h:33
///
/// void SetObjectLayer(ObjectLayer inObjectLayer)
///
///
public void SetObjectLayer(ushort objectLayer) =>
Jolt.PInvoke.VehicleCollisionTester_SetObjectLayer(this, objectLayer);
///
///
/// Access to the broad phase layer filter, when set this overrides the object layer supplied in the
/// constructor
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleCollisionTester.h:36
///
/// void SetBroadPhaseLayerFilter(const BroadPhaseLayerFilter *inFilter)
///
///
public void SetBroadPhaseLayerFilter(BroadPhaseLayerFilter filter) =>
Jolt.PInvoke.VehicleCollisionTester_SetBroadPhaseLayerFilter(this, filter);
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleCollisionTester.h:37
///
/// const BroadPhaseLayerFilter * GetBroadPhaseLayerFilter() const
///
///
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public BroadPhaseLayerFilter GetBroadPhaseLayerFilter() =>
Jolt.PInvoke.VehicleCollisionTester_GetBroadPhaseLayerFilter(this);
///
///
/// Access to the object layer filter, when set this overrides the object layer supplied in the constructor
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleCollisionTester.h:40
///
/// void SetObjectLayerFilter(const ObjectLayerFilter *inFilter)
///
///
public void SetObjectLayerFilter(ObjectLayerFilter filter) =>
Jolt.PInvoke.VehicleCollisionTester_SetObjectLayerFilter(this, filter);
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleCollisionTester.h:41
///
/// const ObjectLayerFilter * GetObjectLayerFilter() const
///
///
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public ObjectLayerFilter GetObjectLayerFilter() =>
Jolt.PInvoke.VehicleCollisionTester_GetObjectLayerFilter(this);
///
///
/// Access to the body filter, when set this overrides the default filter that filters out the vehicle body
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleCollisionTester.h:44
///
/// void SetBodyFilter(const BodyFilter *inFilter)
///
///
public void SetBodyFilter(BodyFilter filter) => Jolt.PInvoke.VehicleCollisionTester_SetBodyFilter(this, filter);
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleCollisionTester.h:45
///
/// const BodyFilter * GetBodyFilter() const
///
///
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public BodyFilter GetBodyFilter() => Jolt.PInvoke.VehicleCollisionTester_GetBodyFilter(this);
///
///
/// Do a collision test with the world
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleCollisionTester.h:60
///
/// virtual bool Collide(PhysicsSystem &inPhysicsSystem, const VehicleConstraint &inVehicleConstraint, uint inWheelIndex, RVec3Arg inOrigin, Vec3Arg inDirection, const BodyID &inVehicleBodyID, Body *&outBody, SubShapeID &outSubShapeID, RVec3 &outContactPosition, Vec3 &outContactNormal, float &outSuspensionLength) const = 0
///
///
///
///
/// Do a collision test with the world
/// @param inPhysicsSystem The physics system that should be tested against
/// @param inVehicleConstraint The vehicle constraint
/// @param inWheelIndex Index of the wheel that we're testing collision for
/// @param inOrigin Origin for the test, corresponds to the world space position for the suspension attachment point
/// @param inDirection Direction for the test (unit vector, world space)
/// @param inVehicleBodyID This body should be filtered out during collision detection to avoid self collisions
/// @param outBody Body that the wheel collided with
/// @param outSubShapeID Sub shape ID that the wheel collided with
/// @param outContactPosition Contact point between wheel and floor, in world space
/// @param outContactNormal Contact normal between wheel and floor, pointing away from the floor
/// @param outSuspensionLength New length of the suspension [0, inSuspensionMaxLength]
/// @return True when collision found, false if not
///
///
public bool Collide(
PhysicsSystem physicsSystem,
VehicleConstraint vehicleConstraint,
uint wheelIndex,
float3 origin,
float3 direction,
uint vehicleBodyID,
out Body body,
out uint subShapeID,
out float3 contactPosition,
out float3 contactNormal,
out float suspensionLength
)
{
var _result = Jolt.PInvoke.VehicleCollisionTester_Collide(
this,
physicsSystem,
vehicleConstraint,
wheelIndex,
origin,
direction,
vehicleBodyID,
out body,
out subShapeID,
out contactPosition,
out contactNormal,
out suspensionLength,
out var _inRange
);
if (_inRange == 0)
throw new ArgumentOutOfRangeException(
nameof(wheelIndex),
wheelIndex,
"Expected an index below the number of wheels."
);
return _result;
}
///
///
/// Do a cheap contact properties prediction based on the contact properties from the last collision test
/// (provided as input parameters)
///
///
/// C++:
/// Jolt/Physics/Vehicle/VehicleCollisionTester.h:74
///
/// virtual void PredictContactProperties(PhysicsSystem &inPhysicsSystem, const VehicleConstraint &inVehicleConstraint, uint inWheelIndex, RVec3Arg inOrigin, Vec3Arg inDirection, const BodyID &inVehicleBodyID, Body *&ioBody, SubShapeID &ioSubShapeID, RVec3 &ioContactPosition, Vec3 &ioContactNormal, float &ioSuspensionLength) const = 0
///
///
///
///
/// Do a cheap contact properties prediction based on the contact properties from the last collision test (provided as input parameters)
/// @param inPhysicsSystem The physics system that should be tested against
/// @param inVehicleConstraint The vehicle constraint
/// @param inWheelIndex Index of the wheel that we're testing collision for
/// @param inOrigin Origin for the test, corresponds to the world space position for the suspension attachment point
/// @param inDirection Direction for the test (unit vector, world space)
/// @param inVehicleBodyID The body ID for the vehicle itself
/// @param ioBody Body that the wheel previously collided with
/// @param ioSubShapeID Sub shape ID that the wheel collided with during the last check
/// @param ioContactPosition Contact point between wheel and floor during the last check, in world space
/// @param ioContactNormal Contact normal between wheel and floor during the last check, pointing away from the floor
/// @param ioSuspensionLength New length of the suspension [0, inSuspensionMaxLength]
///
///
public void PredictContactProperties(
PhysicsSystem physicsSystem,
VehicleConstraint vehicleConstraint,
uint wheelIndex,
float3 origin,
float3 direction,
uint vehicleBodyID,
ref Body body,
ref uint subShapeID,
ref float3 contactPosition,
ref float3 contactNormal,
ref float suspensionLength
)
{
Jolt.PInvoke.VehicleCollisionTester_PredictContactProperties(
this,
physicsSystem,
vehicleConstraint,
wheelIndex,
origin,
direction,
vehicleBodyID,
ref body,
ref subShapeID,
ref contactPosition,
ref contactNormal,
ref suspensionLength,
out var _inRange
);
if (_inRange == 0)
throw new ArgumentOutOfRangeException(
nameof(wheelIndex),
wheelIndex,
"Expected an index below the number of wheels."
);
}
public void AddRef() => Jolt.PInvoke.VehicleCollisionTester_AddRef(this);
public void Release() => Jolt.PInvoke.VehicleCollisionTester_Release(this);
public uint GetRefCount() => Jolt.PInvoke.VehicleCollisionTester_GetRefCount(this);
public void Dispose()
{
if (IsNull())
return;
Release();
}
}
}