mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
2459 lines
133 KiB
C#
2459 lines
133 KiB
C#
using System.Runtime.InteropServices;
|
|
using Brutal.Numerics;
|
|
|
|
/*
|
|
* @brief Contains generated Box2D function entry-points.
|
|
*
|
|
* @note If you want to override function behavior, you can do so in Rules.xml and Box2D.cs.
|
|
*
|
|
* @warning This file is auto-generated by Brutal.Box2D.Generate.
|
|
* Do not edit this file directly.
|
|
* If you want to change the generated code, modify the generation rules.
|
|
*/
|
|
namespace Brutal.Box2DApi
|
|
{
|
|
public static partial class Box2D
|
|
{
|
|
/// This allows the user to override the allocation functions. These should be
|
|
/// set during application startup.
|
|
[LibraryImport(Dll, EntryPoint = "b2SetAllocator")]
|
|
public static unsafe partial void SetAllocator(B2AllocFcn allocFcn, B2FreeFcn freeFcn);
|
|
|
|
/// RETURN: the total bytes allocated by Box2D
|
|
[LibraryImport(Dll, EntryPoint = "b2GetByteCount")]
|
|
public static unsafe partial int GetByteCount();
|
|
|
|
/// Override the default assert callback
|
|
/// <param name="assertFcn">a non-null assert callback </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2SetAssertFcn")]
|
|
public static unsafe partial void SetAssertFcn(B2AssertFcn assertFcn);
|
|
|
|
/// Get the current version of Box2D
|
|
[LibraryImport(Dll, EntryPoint = "b2GetVersion")]
|
|
public static unsafe partial B2Version GetVersion();
|
|
|
|
///
|
|
[LibraryImport(Dll, EntryPoint = "b2InternalAssertFcn")]
|
|
public static unsafe partial int InternalAssertFcn(byte* condition, byte* fileName, int lineNumber);
|
|
|
|
/// Get the absolute number of system ticks. The value is platform specific.
|
|
[LibraryImport(Dll, EntryPoint = "b2GetTicks")]
|
|
public static unsafe partial ulong GetTicks();
|
|
|
|
/// Get the milliseconds passed from an initial tick value.
|
|
[LibraryImport(Dll, EntryPoint = "b2GetMilliseconds")]
|
|
public static unsafe partial float GetMilliseconds(ulong ticks);
|
|
|
|
/// Get the milliseconds passed from an initial tick value. Resets the passed in
|
|
/// value to the current tick value.
|
|
[LibraryImport(Dll, EntryPoint = "b2GetMillisecondsAndReset")]
|
|
public static unsafe partial float GetMillisecondsAndReset(in ulong ticks);
|
|
|
|
/// Yield to be used in a busy loop.
|
|
[LibraryImport(Dll, EntryPoint = "b2Yield")]
|
|
public static unsafe partial void Yield();
|
|
|
|
///
|
|
[LibraryImport(Dll, EntryPoint = "b2Hash")]
|
|
public static unsafe partial uint Hash(uint hash, byte* data, int count);
|
|
|
|
/// Is this a valid number? Not NaN or infinity.
|
|
[LibraryImport(Dll, EntryPoint = "b2IsValidFloat")]
|
|
public static unsafe partial Bool8 IsValidFloat(float a);
|
|
|
|
/// Is this a valid vector? Not NaN or infinity.
|
|
[LibraryImport(Dll, EntryPoint = "b2IsValidVec2")]
|
|
public static unsafe partial Bool8 IsValidVec2(float2 v);
|
|
|
|
/// Is this a valid rotation? Not NaN or infinity. Is normalized.
|
|
[LibraryImport(Dll, EntryPoint = "b2IsValidRotation")]
|
|
public static unsafe partial Bool8 IsValidRotation(B2Rot q);
|
|
|
|
/// Is this a valid bounding box? Not Nan or infinity. Upper bound greater than or equal to lower bound.
|
|
[LibraryImport(Dll, EntryPoint = "b2IsValidAABB")]
|
|
public static unsafe partial Bool8 IsValidAabb(B2Aabb aabb);
|
|
|
|
/// Is this a valid plane? Normal is a unit vector. Not Nan or infinity.
|
|
[LibraryImport(Dll, EntryPoint = "b2IsValidPlane")]
|
|
public static unsafe partial Bool8 IsValidPlane(B2Plane a);
|
|
|
|
/// RETURN: the minimum of two integers
|
|
[LibraryImport(Dll, EntryPoint = "b2MinInt")]
|
|
public static unsafe partial int MinInt(int a, int b);
|
|
|
|
/// RETURN: the maximum of two integers
|
|
[LibraryImport(Dll, EntryPoint = "b2MaxInt")]
|
|
public static unsafe partial int MaxInt(int a, int b);
|
|
|
|
/// RETURN: the absolute value of an integer
|
|
[LibraryImport(Dll, EntryPoint = "b2AbsInt")]
|
|
public static unsafe partial int AbsInt(int a);
|
|
|
|
/// RETURN: an integer clamped between a lower and upper bound
|
|
[LibraryImport(Dll, EntryPoint = "b2ClampInt")]
|
|
public static unsafe partial int ClampInt(int a, int lower, int upper);
|
|
|
|
/// RETURN: the minimum of two floats
|
|
[LibraryImport(Dll, EntryPoint = "b2MinFloat")]
|
|
public static unsafe partial float MinFloat(float a, float b);
|
|
|
|
/// RETURN: the maximum of two floats
|
|
[LibraryImport(Dll, EntryPoint = "b2MaxFloat")]
|
|
public static unsafe partial float MaxFloat(float a, float b);
|
|
|
|
/// RETURN: the absolute value of a float
|
|
[LibraryImport(Dll, EntryPoint = "b2AbsFloat")]
|
|
public static unsafe partial float AbsFloat(float a);
|
|
|
|
/// RETURN: a float clamped between a lower and upper bound
|
|
[LibraryImport(Dll, EntryPoint = "b2ClampFloat")]
|
|
public static unsafe partial float ClampFloat(float a, float lower, float upper);
|
|
|
|
/// Compute an approximate arctangent in the range [-pi, pi]
|
|
/// This is hand coded for cross-platform determinism. The atan2f
|
|
/// function in the standard library is not cross-platform deterministic.
|
|
/// Accurate to around 0.0023 degrees
|
|
[LibraryImport(Dll, EntryPoint = "b2Atan2")]
|
|
public static unsafe partial float Atan2(float y, float x);
|
|
|
|
/// Compute the cosine and sine of an angle in radians. Implemented
|
|
/// for cross-platform determinism.
|
|
[LibraryImport(Dll, EntryPoint = "b2ComputeCosSin")]
|
|
public static unsafe partial B2CosSin ComputeCosSin(float radians);
|
|
|
|
/// Vector dot product
|
|
[LibraryImport(Dll, EntryPoint = "b2Dot")]
|
|
public static unsafe partial float Dot(float2 a, float2 b);
|
|
|
|
/// Vector cross product. In 2D this yields a scalar.
|
|
[LibraryImport(Dll, EntryPoint = "b2Cross")]
|
|
public static unsafe partial float Cross(float2 a, float2 b);
|
|
|
|
/// Perform the cross product on a vector and a scalar. In 2D this produces a vector.
|
|
[LibraryImport(Dll, EntryPoint = "b2CrossVS")]
|
|
public static unsafe partial float2 CrossVS(float2 v, float s);
|
|
|
|
/// Perform the cross product on a scalar and a vector. In 2D this produces a vector.
|
|
[LibraryImport(Dll, EntryPoint = "b2CrossSV")]
|
|
public static unsafe partial float2 CrossSV(float s, float2 v);
|
|
|
|
/// Get a left pointing perpendicular vector. Equivalent to b2CrossSV(1.0f, v)
|
|
[LibraryImport(Dll, EntryPoint = "b2LeftPerp")]
|
|
public static unsafe partial float2 LeftPerp(float2 v);
|
|
|
|
/// Get a right pointing perpendicular vector. Equivalent to b2CrossVS(v, 1.0f)
|
|
[LibraryImport(Dll, EntryPoint = "b2RightPerp")]
|
|
public static unsafe partial float2 RightPerp(float2 v);
|
|
|
|
/// Vector addition
|
|
[LibraryImport(Dll, EntryPoint = "b2Add")]
|
|
public static unsafe partial float2 Add(float2 a, float2 b);
|
|
|
|
/// Vector subtraction
|
|
[LibraryImport(Dll, EntryPoint = "b2Sub")]
|
|
public static unsafe partial float2 Sub(float2 a, float2 b);
|
|
|
|
/// Vector negation
|
|
[LibraryImport(Dll, EntryPoint = "b2Neg")]
|
|
public static unsafe partial float2 Neg(float2 a);
|
|
|
|
/// Vector linear interpolation
|
|
/// https://fgiesen.wordpress.com/2012/08/15/linear-interpolation-past-present-and-future/
|
|
[LibraryImport(Dll, EntryPoint = "b2Lerp")]
|
|
public static unsafe partial float2 Lerp(float2 a, float2 b, float t);
|
|
|
|
/// Component-wise multiplication
|
|
[LibraryImport(Dll, EntryPoint = "b2Mul")]
|
|
public static unsafe partial float2 Mul(float2 a, float2 b);
|
|
|
|
/// Multiply a scalar and vector
|
|
[LibraryImport(Dll, EntryPoint = "b2MulSV")]
|
|
public static unsafe partial float2 MulSV(float s, float2 v);
|
|
|
|
/// a + s * b
|
|
[LibraryImport(Dll, EntryPoint = "b2MulAdd")]
|
|
public static unsafe partial float2 MulAdd(float2 a, float s, float2 b);
|
|
|
|
/// a - s * b
|
|
[LibraryImport(Dll, EntryPoint = "b2MulSub")]
|
|
public static unsafe partial float2 MulSub(float2 a, float s, float2 b);
|
|
|
|
/// Component-wise absolute vector
|
|
[LibraryImport(Dll, EntryPoint = "b2Abs")]
|
|
public static unsafe partial float2 Abs(float2 a);
|
|
|
|
/// Component-wise minimum vector
|
|
[LibraryImport(Dll, EntryPoint = "b2Min")]
|
|
public static unsafe partial float2 Min(float2 a, float2 b);
|
|
|
|
/// Component-wise maximum vector
|
|
[LibraryImport(Dll, EntryPoint = "b2Max")]
|
|
public static unsafe partial float2 Max(float2 a, float2 b);
|
|
|
|
/// Component-wise clamp vector v into the range [a, b]
|
|
[LibraryImport(Dll, EntryPoint = "b2Clamp")]
|
|
public static unsafe partial float2 Clamp(float2 v, float2 a, float2 b);
|
|
|
|
/// Get the length of this vector (the norm)
|
|
[LibraryImport(Dll, EntryPoint = "b2Length")]
|
|
public static unsafe partial float Length(float2 v);
|
|
|
|
/// Get the distance between two points
|
|
[LibraryImport(Dll, EntryPoint = "b2Distance")]
|
|
public static unsafe partial float Distance(float2 a, float2 b);
|
|
|
|
/// Convert a vector into a unit vector if possible, otherwise returns the zero vector.
|
|
/// todo MSVC is not inlining this function in several places per warning 4710
|
|
[LibraryImport(Dll, EntryPoint = "b2Normalize")]
|
|
public static unsafe partial float2 Normalize(float2 v);
|
|
|
|
/// Determines if the provided vector is normalized (norm(a) == 1).
|
|
[LibraryImport(Dll, EntryPoint = "b2IsNormalized")]
|
|
public static unsafe partial Bool8 IsNormalized(float2 a);
|
|
|
|
/// Convert a vector into a unit vector if possible, otherwise returns the zero vector. Also
|
|
/// outputs the length.
|
|
[LibraryImport(Dll, EntryPoint = "b2GetLengthAndNormalize")]
|
|
public static unsafe partial float2 GetLengthAndNormalize(in float length, float2 v);
|
|
|
|
/// Normalize rotation
|
|
[LibraryImport(Dll, EntryPoint = "b2NormalizeRot")]
|
|
public static unsafe partial B2Rot NormalizeRot(B2Rot q);
|
|
|
|
/// Integrate rotation from angular velocity
|
|
/// <param name="q1">initial rotation </param>
|
|
/// <param name="deltaAngle">the angular displacement in radians </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2IntegrateRotation")]
|
|
public static unsafe partial B2Rot IntegrateRotation(B2Rot q1, float deltaAngle);
|
|
|
|
/// Get the length squared of this vector
|
|
[LibraryImport(Dll, EntryPoint = "b2LengthSquared")]
|
|
public static unsafe partial float LengthSquared(float2 v);
|
|
|
|
/// Get the distance squared between points
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceSquared")]
|
|
public static unsafe partial float DistanceSquared(float2 a, float2 b);
|
|
|
|
/// Make a rotation using an angle in radians
|
|
[LibraryImport(Dll, EntryPoint = "b2MakeRot")]
|
|
public static unsafe partial B2Rot MakeRot(float radians);
|
|
|
|
/// Compute the rotation between two unit vectors
|
|
[LibraryImport(Dll, EntryPoint = "b2ComputeRotationBetweenUnitVectors")]
|
|
public static unsafe partial B2Rot ComputeRotationBetweenUnitVectors(float2 v1, float2 v2);
|
|
|
|
/// Is this rotation normalized?
|
|
[LibraryImport(Dll, EntryPoint = "b2IsNormalizedRot")]
|
|
public static unsafe partial Bool8 IsNormalizedRot(B2Rot q);
|
|
|
|
/// Normalized linear interpolation
|
|
/// https://fgiesen.wordpress.com/2012/08/15/linear-interpolation-past-present-and-future/
|
|
/// https://web.archive.org/web/20170825184056/http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/
|
|
[LibraryImport(Dll, EntryPoint = "b2NLerp")]
|
|
public static unsafe partial B2Rot NLerp(B2Rot q1, B2Rot q2, float t);
|
|
|
|
/// Compute the angular velocity necessary to rotate between two rotations over a give time
|
|
/// <param name="q1">initial rotation </param>
|
|
/// <param name="q2">final rotation </param>
|
|
/// <param name="invH">inverse time step </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2ComputeAngularVelocity")]
|
|
public static unsafe partial float ComputeAngularVelocity(B2Rot q1, B2Rot q2, float invH);
|
|
|
|
/// Get the angle in radians in the range [-pi, pi]
|
|
[LibraryImport(Dll, EntryPoint = "b2Rot_GetAngle")]
|
|
internal static unsafe partial float RotGetAngle(B2Rot q);
|
|
|
|
/// Get the x-axis
|
|
[LibraryImport(Dll, EntryPoint = "b2Rot_GetXAxis")]
|
|
internal static unsafe partial float2 RotGetXAxis(B2Rot q);
|
|
|
|
/// Get the y-axis
|
|
[LibraryImport(Dll, EntryPoint = "b2Rot_GetYAxis")]
|
|
internal static unsafe partial float2 RotGetYAxis(B2Rot q);
|
|
|
|
/// Multiply two rotations: q * r
|
|
[LibraryImport(Dll, EntryPoint = "b2MulRot")]
|
|
public static unsafe partial B2Rot MulRot(B2Rot q, B2Rot r);
|
|
|
|
/// Transpose multiply two rotations: qT * r
|
|
[LibraryImport(Dll, EntryPoint = "b2InvMulRot")]
|
|
public static unsafe partial B2Rot InvMulRot(B2Rot q, B2Rot r);
|
|
|
|
/// relative angle between b and a (rot_b * inv(rot_a))
|
|
[LibraryImport(Dll, EntryPoint = "b2RelativeAngle")]
|
|
public static unsafe partial float RelativeAngle(B2Rot b, B2Rot a);
|
|
|
|
/// Convert any angle into the range [-pi, pi]
|
|
[LibraryImport(Dll, EntryPoint = "b2UnwindAngle")]
|
|
public static unsafe partial float UnwindAngle(float radians);
|
|
|
|
/// Rotate a vector
|
|
[LibraryImport(Dll, EntryPoint = "b2RotateVector")]
|
|
public static unsafe partial float2 RotateVector(B2Rot q, float2 v);
|
|
|
|
/// Inverse rotate a vector
|
|
[LibraryImport(Dll, EntryPoint = "b2InvRotateVector")]
|
|
public static unsafe partial float2 InvRotateVector(B2Rot q, float2 v);
|
|
|
|
/// Transform a point (e.g. local space to world space)
|
|
[LibraryImport(Dll, EntryPoint = "b2TransformPoint")]
|
|
public static unsafe partial float2 TransformPoint(B2Transform t, float2 p);
|
|
|
|
/// Inverse transform a point (e.g. world space to local space)
|
|
[LibraryImport(Dll, EntryPoint = "b2InvTransformPoint")]
|
|
public static unsafe partial float2 InvTransformPoint(B2Transform t, float2 p);
|
|
|
|
/// Multiply two transforms. If the result is applied to a point p local to frame B,
|
|
/// the transform would first convert p to a point local to frame A, then into a point
|
|
/// in the world frame.
|
|
/// v2 = A.q.Rot(B.q.Rot(v1) + B.p) + A.p
|
|
/// = (A.q * B.q).Rot(v1) + A.q.Rot(B.p) + A.p
|
|
[LibraryImport(Dll, EntryPoint = "b2MulTransforms")]
|
|
public static unsafe partial B2Transform MulTransforms(B2Transform a, B2Transform b);
|
|
|
|
/// Creates a transform that converts a local point in frame B to a local point in frame A.
|
|
/// v2 = A.q' * (B.q * v1 + B.p - A.p)
|
|
/// = A.q' * B.q * v1 + A.q' * (B.p - A.p)
|
|
[LibraryImport(Dll, EntryPoint = "b2InvMulTransforms")]
|
|
public static unsafe partial B2Transform InvMulTransforms(B2Transform a, B2Transform b);
|
|
|
|
/// Multiply a 2-by-2 matrix times a 2D vector
|
|
[LibraryImport(Dll, EntryPoint = "b2MulMV")]
|
|
public static unsafe partial float2 MulMV(float2x2 a, float2 v);
|
|
|
|
/// Get the inverse of a 2-by-2 matrix
|
|
[LibraryImport(Dll, EntryPoint = "b2GetInverse22")]
|
|
public static unsafe partial float2x2 GetInverse22(float2x2 a);
|
|
|
|
/// Solve A * x = b, where b is a column vector. This is more efficient
|
|
/// than computing the inverse in one-shot cases.
|
|
[LibraryImport(Dll, EntryPoint = "b2Solve22")]
|
|
public static unsafe partial float2 Solve22(float2x2 a, float2 b);
|
|
|
|
/// Does a fully contain b
|
|
[LibraryImport(Dll, EntryPoint = "b2AABB_Contains")]
|
|
internal static unsafe partial Bool8 AabbContains(B2Aabb a, B2Aabb b);
|
|
|
|
/// Get the center of the AABB.
|
|
[LibraryImport(Dll, EntryPoint = "b2AABB_Center")]
|
|
internal static unsafe partial float2 AabbCenter(B2Aabb a);
|
|
|
|
/// Get the extents of the AABB (half-widths).
|
|
[LibraryImport(Dll, EntryPoint = "b2AABB_Extents")]
|
|
internal static unsafe partial float2 AabbExtents(B2Aabb a);
|
|
|
|
/// Union of two AABBs
|
|
[LibraryImport(Dll, EntryPoint = "b2AABB_Union")]
|
|
internal static unsafe partial B2Aabb AabbUnion(B2Aabb a, B2Aabb b);
|
|
|
|
/// Do a and b overlap
|
|
[LibraryImport(Dll, EntryPoint = "b2AABB_Overlaps")]
|
|
internal static unsafe partial Bool8 AabbOverlaps(B2Aabb a, B2Aabb b);
|
|
|
|
/// Compute the bounding box of an array of circles
|
|
[LibraryImport(Dll, EntryPoint = "b2MakeAABB")]
|
|
public static unsafe partial B2Aabb MakeAabb(in float2 points, int count, float radius);
|
|
|
|
/// Signed separation of a point from a plane
|
|
[LibraryImport(Dll, EntryPoint = "b2PlaneSeparation")]
|
|
public static unsafe partial float PlaneSeparation(B2Plane plane, float2 point);
|
|
|
|
/// One-dimensional mass-spring-damper simulation. Returns the new velocity given the position and time step.
|
|
/// You can then compute the new position using:
|
|
/// position += timeStep * newVelocity
|
|
/// This drives towards a zero position. By using implicit integration we get a stable solution
|
|
/// that doesn't require transcendental functions.
|
|
[LibraryImport(Dll, EntryPoint = "b2SpringDamper")]
|
|
public static unsafe partial float SpringDamper(
|
|
float hertz,
|
|
float dampingRatio,
|
|
float position,
|
|
float velocity,
|
|
float timeStep
|
|
);
|
|
|
|
/// Box2D bases all length units on meters, but you may need different units for your game.
|
|
/// You can set this value to use different units. This should be done at application startup
|
|
/// and only modified once. Default value is 1.
|
|
/// For example, if your game uses pixels for units you can use pixels for all length values
|
|
/// sent to Box2D. There should be no extra cost. However, Box2D has some internal tolerances
|
|
/// and thresholds that have been tuned for meters. By calling this function, Box2D is able
|
|
/// to adjust those tolerances and thresholds to improve accuracy.
|
|
/// A good rule of thumb is to pass the height of your player character to this function. So
|
|
/// if your player character is 32 pixels high, then pass 32 to this function. Then you may
|
|
/// confidently use pixels for all the length values sent to Box2D. All length values returned
|
|
/// from Box2D will also be pixels because Box2D does not do any scaling internally.
|
|
/// However, you are now on the hook for coming up with good values for gravity, density, and
|
|
/// forces.
|
|
/// WARNING: This must be modified before any calls to Box2D
|
|
[LibraryImport(Dll, EntryPoint = "b2SetLengthUnitsPerMeter")]
|
|
public static unsafe partial void SetLengthUnitsPerMeter(float lengthUnits);
|
|
|
|
/// Get the current length units per meter.
|
|
[LibraryImport(Dll, EntryPoint = "b2GetLengthUnitsPerMeter")]
|
|
public static unsafe partial float GetLengthUnitsPerMeter();
|
|
|
|
/// Validate ray cast input data (NaN, etc)
|
|
[LibraryImport(Dll, EntryPoint = "b2IsValidRay")]
|
|
public static unsafe partial Bool8 IsValidRay(in B2RayCastInput input);
|
|
|
|
/// Make a convex polygon from a convex hull. This will assert if the hull is not valid.
|
|
/// WARNING: Do not manually fill in the hull data, it must come directly from b2ComputeHull
|
|
[LibraryImport(Dll, EntryPoint = "b2MakePolygon")]
|
|
public static unsafe partial B2Polygon MakePolygon(in B2Hull hull, float radius);
|
|
|
|
/// Make an offset convex polygon from a convex hull. This will assert if the hull is not valid.
|
|
/// WARNING: Do not manually fill in the hull data, it must come directly from b2ComputeHull
|
|
[LibraryImport(Dll, EntryPoint = "b2MakeOffsetPolygon")]
|
|
public static unsafe partial B2Polygon MakeOffsetPolygon(in B2Hull hull, float2 position, B2Rot rotation);
|
|
|
|
/// Make an offset convex polygon from a convex hull. This will assert if the hull is not valid.
|
|
/// WARNING: Do not manually fill in the hull data, it must come directly from b2ComputeHull
|
|
[LibraryImport(Dll, EntryPoint = "b2MakeOffsetRoundedPolygon")]
|
|
public static unsafe partial B2Polygon MakeOffsetRoundedPolygon(
|
|
in B2Hull hull,
|
|
float2 position,
|
|
B2Rot rotation,
|
|
float radius
|
|
);
|
|
|
|
/// Make a square polygon, bypassing the need for a convex hull.
|
|
/// <param name="halfWidth">the half-width </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2MakeSquare")]
|
|
public static unsafe partial B2Polygon MakeSquare(float halfWidth);
|
|
|
|
/// Make a box (rectangle) polygon, bypassing the need for a convex hull.
|
|
/// <param name="halfWidth">the half-width (x-axis) </param>
|
|
/// <param name="halfHeight">the half-height (y-axis) </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2MakeBox")]
|
|
public static unsafe partial B2Polygon MakeBox(float halfWidth, float halfHeight);
|
|
|
|
/// Make a rounded box, bypassing the need for a convex hull.
|
|
/// <param name="halfWidth">the half-width (x-axis) </param>
|
|
/// <param name="halfHeight">the half-height (y-axis) </param>
|
|
/// <param name="radius">the radius of the rounded extension </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2MakeRoundedBox")]
|
|
public static unsafe partial B2Polygon MakeRoundedBox(float halfWidth, float halfHeight, float radius);
|
|
|
|
/// Make an offset box, bypassing the need for a convex hull.
|
|
/// <param name="halfWidth">the half-width (x-axis) </param>
|
|
/// <param name="halfHeight">the half-height (y-axis) </param>
|
|
/// <param name="center">the local center of the box </param>
|
|
/// <param name="rotation">the local rotation of the box </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2MakeOffsetBox")]
|
|
public static unsafe partial B2Polygon MakeOffsetBox(
|
|
float halfWidth,
|
|
float halfHeight,
|
|
float2 center,
|
|
B2Rot rotation
|
|
);
|
|
|
|
/// Make an offset rounded box, bypassing the need for a convex hull.
|
|
/// <param name="halfWidth">the half-width (x-axis) </param>
|
|
/// <param name="halfHeight">the half-height (y-axis) </param>
|
|
/// <param name="center">the local center of the box </param>
|
|
/// <param name="rotation">the local rotation of the box </param>
|
|
/// <param name="radius">the radius of the rounded extension </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2MakeOffsetRoundedBox")]
|
|
public static unsafe partial B2Polygon MakeOffsetRoundedBox(
|
|
float halfWidth,
|
|
float halfHeight,
|
|
float2 center,
|
|
B2Rot rotation,
|
|
float radius
|
|
);
|
|
|
|
/// Transform a polygon. This is useful for transferring a shape from one body to another.
|
|
[LibraryImport(Dll, EntryPoint = "b2TransformPolygon")]
|
|
public static unsafe partial B2Polygon TransformPolygon(B2Transform transform, in B2Polygon polygon);
|
|
|
|
/// Compute mass properties of a circle
|
|
[LibraryImport(Dll, EntryPoint = "b2ComputeCircleMass")]
|
|
public static unsafe partial B2MassData ComputeCircleMass(in B2Circle shape, float density);
|
|
|
|
/// Compute mass properties of a capsule
|
|
[LibraryImport(Dll, EntryPoint = "b2ComputeCapsuleMass")]
|
|
public static unsafe partial B2MassData ComputeCapsuleMass(in B2Capsule shape, float density);
|
|
|
|
/// Compute mass properties of a polygon
|
|
[LibraryImport(Dll, EntryPoint = "b2ComputePolygonMass")]
|
|
public static unsafe partial B2MassData ComputePolygonMass(in B2Polygon shape, float density);
|
|
|
|
/// Compute the bounding box of a transformed circle
|
|
[LibraryImport(Dll, EntryPoint = "b2ComputeCircleAABB")]
|
|
public static unsafe partial B2Aabb ComputeCircleAabb(in B2Circle shape, B2Transform transform);
|
|
|
|
/// Compute the bounding box of a transformed capsule
|
|
[LibraryImport(Dll, EntryPoint = "b2ComputeCapsuleAABB")]
|
|
public static unsafe partial B2Aabb ComputeCapsuleAabb(in B2Capsule shape, B2Transform transform);
|
|
|
|
/// Compute the bounding box of a transformed polygon
|
|
[LibraryImport(Dll, EntryPoint = "b2ComputePolygonAABB")]
|
|
public static unsafe partial B2Aabb ComputePolygonAabb(in B2Polygon shape, B2Transform transform);
|
|
|
|
/// Compute the bounding box of a transformed line segment
|
|
[LibraryImport(Dll, EntryPoint = "b2ComputeSegmentAABB")]
|
|
public static unsafe partial B2Aabb ComputeSegmentAabb(in B2Segment shape, B2Transform transform);
|
|
|
|
/// Test a point for overlap with a circle in local space
|
|
[LibraryImport(Dll, EntryPoint = "b2PointInCircle")]
|
|
public static unsafe partial Bool8 PointInCircle(float2 point, in B2Circle shape);
|
|
|
|
/// Test a point for overlap with a capsule in local space
|
|
[LibraryImport(Dll, EntryPoint = "b2PointInCapsule")]
|
|
public static unsafe partial Bool8 PointInCapsule(float2 point, in B2Capsule shape);
|
|
|
|
/// Test a point for overlap with a convex polygon in local space
|
|
[LibraryImport(Dll, EntryPoint = "b2PointInPolygon")]
|
|
public static unsafe partial Bool8 PointInPolygon(float2 point, in B2Polygon shape);
|
|
|
|
/// Ray cast versus circle shape in local space. Initial overlap is treated as a miss.
|
|
[LibraryImport(Dll, EntryPoint = "b2RayCastCircle")]
|
|
public static unsafe partial B2CastOutput RayCastCircle(in B2RayCastInput input, in B2Circle shape);
|
|
|
|
/// Ray cast versus capsule shape in local space. Initial overlap is treated as a miss.
|
|
[LibraryImport(Dll, EntryPoint = "b2RayCastCapsule")]
|
|
public static unsafe partial B2CastOutput RayCastCapsule(in B2RayCastInput input, in B2Capsule shape);
|
|
|
|
/// Ray cast versus segment shape in local space. Optionally treat the segment as one-sided with hits from
|
|
/// the left side being treated as a miss.
|
|
[LibraryImport(Dll, EntryPoint = "b2RayCastSegment")]
|
|
public static unsafe partial B2CastOutput RayCastSegment(
|
|
in B2RayCastInput input,
|
|
in B2Segment shape,
|
|
Bool8 oneSided
|
|
);
|
|
|
|
/// Ray cast versus polygon shape in local space. Initial overlap is treated as a miss.
|
|
[LibraryImport(Dll, EntryPoint = "b2RayCastPolygon")]
|
|
public static unsafe partial B2CastOutput RayCastPolygon(in B2RayCastInput input, in B2Polygon shape);
|
|
|
|
/// Shape cast versus a circle. Initial overlap is treated as a miss.
|
|
[LibraryImport(Dll, EntryPoint = "b2ShapeCastCircle")]
|
|
public static unsafe partial B2CastOutput ShapeCastCircle(in B2ShapeCastInput input, in B2Circle shape);
|
|
|
|
/// Shape cast versus a capsule. Initial overlap is treated as a miss.
|
|
[LibraryImport(Dll, EntryPoint = "b2ShapeCastCapsule")]
|
|
public static unsafe partial B2CastOutput ShapeCastCapsule(in B2ShapeCastInput input, in B2Capsule shape);
|
|
|
|
/// Shape cast versus a line segment. Initial overlap is treated as a miss.
|
|
[LibraryImport(Dll, EntryPoint = "b2ShapeCastSegment")]
|
|
public static unsafe partial B2CastOutput ShapeCastSegment(in B2ShapeCastInput input, in B2Segment shape);
|
|
|
|
/// Shape cast versus a convex polygon. Initial overlap is treated as a miss.
|
|
[LibraryImport(Dll, EntryPoint = "b2ShapeCastPolygon")]
|
|
public static unsafe partial B2CastOutput ShapeCastPolygon(in B2ShapeCastInput input, in B2Polygon shape);
|
|
|
|
/// Compute the convex hull of a set of points. Returns an empty hull if it fails.
|
|
/// Some failure cases:
|
|
/// - all points very close together
|
|
/// - all points on a line
|
|
/// - less than 3 points
|
|
/// - more than B2_MAX_POLYGON_VERTICES points
|
|
/// This welds close points and removes collinear points.
|
|
/// WARNING: Do not modify a hull once it has been computed
|
|
[LibraryImport(Dll, EntryPoint = "b2ComputeHull")]
|
|
public static unsafe partial B2Hull ComputeHull(ReadOnlySpan<float2> points, int count);
|
|
|
|
/// This determines if a hull is valid. Checks for:
|
|
/// - convexity
|
|
/// - collinear points
|
|
/// This is expensive and should not be called at runtime.
|
|
[LibraryImport(Dll, EntryPoint = "b2ValidateHull")]
|
|
public static unsafe partial Bool8 ValidateHull(in B2Hull hull);
|
|
|
|
/// Compute the distance between two line segments, clamping at the end points if needed.
|
|
[LibraryImport(Dll, EntryPoint = "b2SegmentDistance")]
|
|
public static unsafe partial B2SegmentDistanceResult SegmentDistance(
|
|
float2 p1,
|
|
float2 q1,
|
|
float2 p2,
|
|
float2 q2
|
|
);
|
|
|
|
/// Compute the closest points between two shapes represented as point clouds.
|
|
/// b2SimplexCache cache is input/output. On the first call set b2SimplexCache.count to zero.
|
|
/// The underlying GJK algorithm may be debugged by passing in debug simplexes and capacity. You may pass in NULL and 0 for these.
|
|
[LibraryImport(Dll, EntryPoint = "b2ShapeDistance")]
|
|
public static unsafe partial B2DistanceOutput ShapeDistance(
|
|
in B2DistanceInput input,
|
|
in B2SimplexCache cache,
|
|
in B2Simplex simplexes,
|
|
int simplexCapacity
|
|
);
|
|
|
|
/// Perform a linear shape cast of shape B moving and shape A fixed. Determines the hit point, normal, and translation fraction.
|
|
/// Initially touching shapes are treated as a miss.
|
|
[LibraryImport(Dll, EntryPoint = "b2ShapeCast")]
|
|
public static unsafe partial B2CastOutput ShapeCast(in B2ShapeCastPairInput input);
|
|
|
|
/// Make a proxy for use in overlap, shape cast, and related functions. This is a deep copy of the points.
|
|
[LibraryImport(Dll, EntryPoint = "b2MakeProxy")]
|
|
public static unsafe partial B2ShapeProxy MakeProxy(in float2 points, int count, float radius);
|
|
|
|
/// Make a proxy with a transform. This is a deep copy of the points.
|
|
[LibraryImport(Dll, EntryPoint = "b2MakeOffsetProxy")]
|
|
public static unsafe partial B2ShapeProxy MakeOffsetProxy(
|
|
in float2 points,
|
|
int count,
|
|
float radius,
|
|
float2 position,
|
|
B2Rot rotation
|
|
);
|
|
|
|
/// Evaluate the transform sweep at a specific time.
|
|
[LibraryImport(Dll, EntryPoint = "b2GetSweepTransform")]
|
|
public static unsafe partial B2Transform GetSweepTransform(in B2Sweep sweep, float time);
|
|
|
|
/// Compute the upper bound on time before two shapes penetrate. Time is represented as
|
|
/// a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate,
|
|
/// non-tunneling collisions. If you change the time interval, you should call this function
|
|
/// again.
|
|
[LibraryImport(Dll, EntryPoint = "b2TimeOfImpact")]
|
|
public static unsafe partial B2ToiOutput TimeOfImpact(in B2ToiInput input);
|
|
|
|
/// Compute the contact manifold between two circles
|
|
[LibraryImport(Dll, EntryPoint = "b2CollideCircles")]
|
|
public static unsafe partial B2Manifold CollideCircles(
|
|
in B2Circle circleA,
|
|
B2Transform xfA,
|
|
in B2Circle circleB,
|
|
B2Transform xfB
|
|
);
|
|
|
|
/// Compute the contact manifold between a capsule and circle
|
|
[LibraryImport(Dll, EntryPoint = "b2CollideCapsuleAndCircle")]
|
|
public static unsafe partial B2Manifold CollideCapsuleAndCircle(
|
|
in B2Capsule capsuleA,
|
|
B2Transform xfA,
|
|
in B2Circle circleB,
|
|
B2Transform xfB
|
|
);
|
|
|
|
/// Compute the contact manifold between an segment and a circle
|
|
[LibraryImport(Dll, EntryPoint = "b2CollideSegmentAndCircle")]
|
|
public static unsafe partial B2Manifold CollideSegmentAndCircle(
|
|
in B2Segment segmentA,
|
|
B2Transform xfA,
|
|
in B2Circle circleB,
|
|
B2Transform xfB
|
|
);
|
|
|
|
/// Compute the contact manifold between a polygon and a circle
|
|
[LibraryImport(Dll, EntryPoint = "b2CollidePolygonAndCircle")]
|
|
public static unsafe partial B2Manifold CollidePolygonAndCircle(
|
|
in B2Polygon polygonA,
|
|
B2Transform xfA,
|
|
in B2Circle circleB,
|
|
B2Transform xfB
|
|
);
|
|
|
|
/// Compute the contact manifold between a capsule and circle
|
|
[LibraryImport(Dll, EntryPoint = "b2CollideCapsules")]
|
|
public static unsafe partial B2Manifold CollideCapsules(
|
|
in B2Capsule capsuleA,
|
|
B2Transform xfA,
|
|
in B2Capsule capsuleB,
|
|
B2Transform xfB
|
|
);
|
|
|
|
/// Compute the contact manifold between an segment and a capsule
|
|
[LibraryImport(Dll, EntryPoint = "b2CollideSegmentAndCapsule")]
|
|
public static unsafe partial B2Manifold CollideSegmentAndCapsule(
|
|
in B2Segment segmentA,
|
|
B2Transform xfA,
|
|
in B2Capsule capsuleB,
|
|
B2Transform xfB
|
|
);
|
|
|
|
/// Compute the contact manifold between a polygon and capsule
|
|
[LibraryImport(Dll, EntryPoint = "b2CollidePolygonAndCapsule")]
|
|
public static unsafe partial B2Manifold CollidePolygonAndCapsule(
|
|
in B2Polygon polygonA,
|
|
B2Transform xfA,
|
|
in B2Capsule capsuleB,
|
|
B2Transform xfB
|
|
);
|
|
|
|
/// Compute the contact manifold between two polygons
|
|
[LibraryImport(Dll, EntryPoint = "b2CollidePolygons")]
|
|
public static unsafe partial B2Manifold CollidePolygons(
|
|
in B2Polygon polygonA,
|
|
B2Transform xfA,
|
|
in B2Polygon polygonB,
|
|
B2Transform xfB
|
|
);
|
|
|
|
/// Compute the contact manifold between an segment and a polygon
|
|
[LibraryImport(Dll, EntryPoint = "b2CollideSegmentAndPolygon")]
|
|
public static unsafe partial B2Manifold CollideSegmentAndPolygon(
|
|
in B2Segment segmentA,
|
|
B2Transform xfA,
|
|
in B2Polygon polygonB,
|
|
B2Transform xfB
|
|
);
|
|
|
|
/// Compute the contact manifold between a chain segment and a circle
|
|
[LibraryImport(Dll, EntryPoint = "b2CollideChainSegmentAndCircle")]
|
|
public static unsafe partial B2Manifold CollideChainSegmentAndCircle(
|
|
in B2ChainSegment segmentA,
|
|
B2Transform xfA,
|
|
in B2Circle circleB,
|
|
B2Transform xfB
|
|
);
|
|
|
|
/// Compute the contact manifold between a chain segment and a capsule
|
|
[LibraryImport(Dll, EntryPoint = "b2CollideChainSegmentAndCapsule")]
|
|
public static unsafe partial B2Manifold CollideChainSegmentAndCapsule(
|
|
in B2ChainSegment segmentA,
|
|
B2Transform xfA,
|
|
in B2Capsule capsuleB,
|
|
B2Transform xfB,
|
|
in B2SimplexCache cache
|
|
);
|
|
|
|
/// Compute the contact manifold between a chain segment and a rounded polygon
|
|
[LibraryImport(Dll, EntryPoint = "b2CollideChainSegmentAndPolygon")]
|
|
public static unsafe partial B2Manifold CollideChainSegmentAndPolygon(
|
|
in B2ChainSegment segmentA,
|
|
B2Transform xfA,
|
|
in B2Polygon polygonB,
|
|
B2Transform xfB,
|
|
in B2SimplexCache cache
|
|
);
|
|
|
|
/// Constructing the tree initializes the node pool.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_Create")]
|
|
internal static unsafe partial B2DynamicTree DynamicTreeCreate();
|
|
|
|
/// Destroy the tree, freeing the node pool.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_Destroy")]
|
|
internal static unsafe partial void DynamicTreeDestroy(in B2DynamicTree tree);
|
|
|
|
/// Create a proxy. Provide an AABB and a userData value.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_CreateProxy")]
|
|
internal static unsafe partial int DynamicTreeCreateProxy(
|
|
in B2DynamicTree tree,
|
|
B2Aabb aabb,
|
|
ulong categoryBits,
|
|
ulong userData
|
|
);
|
|
|
|
/// Destroy a proxy. This asserts if the id is invalid.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_DestroyProxy")]
|
|
internal static unsafe partial void DynamicTreeDestroyProxy(in B2DynamicTree tree, int proxyId);
|
|
|
|
/// Move a proxy to a new AABB by removing and reinserting into the tree.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_MoveProxy")]
|
|
internal static unsafe partial void DynamicTreeMoveProxy(in B2DynamicTree tree, int proxyId, B2Aabb aabb);
|
|
|
|
/// Enlarge a proxy and enlarge ancestors as necessary.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_EnlargeProxy")]
|
|
internal static unsafe partial void DynamicTreeEnlargeProxy(in B2DynamicTree tree, int proxyId, B2Aabb aabb);
|
|
|
|
/// Modify the category bits on a proxy. This is an expensive operation.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_SetCategoryBits")]
|
|
internal static unsafe partial void DynamicTreeSetCategoryBits(
|
|
in B2DynamicTree tree,
|
|
int proxyId,
|
|
ulong categoryBits
|
|
);
|
|
|
|
/// Get the category bits on a proxy.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_GetCategoryBits")]
|
|
internal static unsafe partial ulong DynamicTreeGetCategoryBits(in B2DynamicTree tree, int proxyId);
|
|
|
|
/// Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
|
|
/// RETURN: performance data
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_Query")]
|
|
internal static unsafe partial B2TreeStats DynamicTreeQuery(
|
|
in B2DynamicTree tree,
|
|
B2Aabb aabb,
|
|
ulong maskBits,
|
|
B2TreeQueryCallbackFcn callback,
|
|
nint context
|
|
);
|
|
|
|
/// Ray cast against the proxies in the tree. This relies on the callback
|
|
/// to perform a exact ray cast in the case were the proxy contains a shape.
|
|
/// The callback also performs the any collision filtering. This has performance
|
|
/// roughly equal to k * log(n), where k is the number of collisions and n is the
|
|
/// number of proxies in the tree.
|
|
/// Bit-wise filtering using mask bits can greatly improve performance in some scenarios.
|
|
/// However, this filtering may be approximate, so the user should still apply filtering to results.
|
|
/// <param name="tree">the dynamic tree to ray cast </param>
|
|
/// <param name="input">the ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1) </param>
|
|
/// <param name="maskBits">mask bit hint: `bool accept = (maskBits & node->categoryBits) != 0;` </param>
|
|
/// <param name="callback">a callback class that is called for each proxy that is hit by the ray </param>
|
|
/// <param name="context">user context that is passed to the callback </param>
|
|
/// RETURN: performance data
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_RayCast")]
|
|
internal static unsafe partial B2TreeStats DynamicTreeRayCast(
|
|
in B2DynamicTree tree,
|
|
in B2RayCastInput input,
|
|
ulong maskBits,
|
|
B2TreeRayCastCallbackFcn callback,
|
|
nint context
|
|
);
|
|
|
|
/// Ray cast against the proxies in the tree. This relies on the callback
|
|
/// to perform a exact ray cast in the case were the proxy contains a shape.
|
|
/// The callback also performs the any collision filtering. This has performance
|
|
/// roughly equal to k * log(n), where k is the number of collisions and n is the
|
|
/// number of proxies in the tree.
|
|
/// <param name="tree">the dynamic tree to ray cast </param>
|
|
/// <param name="input">the ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1). </param>
|
|
/// <param name="maskBits">filter bits: `bool accept = (maskBits & node->categoryBits) != 0;` </param>
|
|
/// <param name="callback">a callback class that is called for each proxy that is hit by the shape </param>
|
|
/// <param name="context">user context that is passed to the callback </param>
|
|
/// RETURN: performance data
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_ShapeCast")]
|
|
internal static unsafe partial B2TreeStats DynamicTreeShapeCast(
|
|
in B2DynamicTree tree,
|
|
in B2ShapeCastInput input,
|
|
ulong maskBits,
|
|
B2TreeShapeCastCallbackFcn callback,
|
|
nint context
|
|
);
|
|
|
|
/// Get the height of the binary tree.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_GetHeight")]
|
|
internal static unsafe partial int DynamicTreeGetHeight(in B2DynamicTree tree);
|
|
|
|
/// Get the ratio of the sum of the node areas to the root area.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_GetAreaRatio")]
|
|
internal static unsafe partial float DynamicTreeGetAreaRatio(in B2DynamicTree tree);
|
|
|
|
/// Get the bounding box that contains the entire tree
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_GetRootBounds")]
|
|
internal static unsafe partial B2Aabb DynamicTreeGetRootBounds(in B2DynamicTree tree);
|
|
|
|
/// Get the number of proxies created
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_GetProxyCount")]
|
|
internal static unsafe partial int DynamicTreeGetProxyCount(in B2DynamicTree tree);
|
|
|
|
/// Rebuild the tree while retaining subtrees that haven't changed. Returns the number of boxes sorted.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_Rebuild")]
|
|
internal static unsafe partial int DynamicTreeRebuild(in B2DynamicTree tree, Bool8 fullBuild);
|
|
|
|
/// Get the number of bytes used by this tree
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_GetByteCount")]
|
|
internal static unsafe partial int DynamicTreeGetByteCount(in B2DynamicTree tree);
|
|
|
|
/// Get proxy user data
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_GetUserData")]
|
|
internal static unsafe partial ulong DynamicTreeGetUserData(in B2DynamicTree tree, int proxyId);
|
|
|
|
/// Get the AABB of a proxy
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_GetAABB")]
|
|
internal static unsafe partial B2Aabb DynamicTreeGetAabb(in B2DynamicTree tree, int proxyId);
|
|
|
|
/// Validate this tree. For testing.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_Validate")]
|
|
internal static unsafe partial void DynamicTreeValidate(in B2DynamicTree tree);
|
|
|
|
/// Validate this tree has no enlarged AABBs. For testing.
|
|
[LibraryImport(Dll, EntryPoint = "b2DynamicTree_ValidateNoEnlarged")]
|
|
internal static unsafe partial void DynamicTreeValidateNoEnlarged(in B2DynamicTree tree);
|
|
|
|
/// Solves the position of a mover that satisfies the given collision planes.
|
|
/// <param name="targetDelta">the desired movement from the position used to generate the collision planes </param>
|
|
/// <param name="planes">the collision planes </param>
|
|
/// <param name="count">the number of collision planes </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2SolvePlanes")]
|
|
public static unsafe partial B2PlaneSolverResult SolvePlanes(
|
|
float2 targetDelta,
|
|
in B2CollisionPlane planes,
|
|
int count
|
|
);
|
|
|
|
/// Clips the velocity against the given collision planes. Planes with zero push or clipVelocity
|
|
/// set to false are skipped.
|
|
[LibraryImport(Dll, EntryPoint = "b2ClipVector")]
|
|
public static unsafe partial float2 ClipVector(float2 vector, in B2CollisionPlane planes, int count);
|
|
|
|
/// Use this to initialize your world definition
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultWorldDef")]
|
|
internal static unsafe partial B2WorldDef DefaultWorldDef();
|
|
|
|
/// Use this to initialize your body definition
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultBodyDef")]
|
|
internal static unsafe partial B2BodyDef DefaultBodyDef();
|
|
|
|
/// Use this to initialize your filter
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultFilter")]
|
|
internal static unsafe partial B2Filter DefaultFilter();
|
|
|
|
/// Use this to initialize your query filter
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultQueryFilter")]
|
|
internal static unsafe partial B2QueryFilter DefaultQueryFilter();
|
|
|
|
/// Use this to initialize your surface material
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultSurfaceMaterial")]
|
|
internal static unsafe partial B2SurfaceMaterial DefaultSurfaceMaterial();
|
|
|
|
/// Use this to initialize your shape definition
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultShapeDef")]
|
|
internal static unsafe partial B2ShapeDef DefaultShapeDef();
|
|
|
|
/// Use this to initialize your chain definition
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultChainDef")]
|
|
internal static unsafe partial B2ChainDef DefaultChainDef();
|
|
|
|
/// Use this to initialize your joint definition
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultDistanceJointDef")]
|
|
internal static unsafe partial B2DistanceJointDef DefaultDistanceJointDef();
|
|
|
|
/// Use this to initialize your joint definition
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultMotorJointDef")]
|
|
internal static unsafe partial B2MotorJointDef DefaultMotorJointDef();
|
|
|
|
/// Use this to initialize your joint definition
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultMouseJointDef")]
|
|
internal static unsafe partial B2MouseJointDef DefaultMouseJointDef();
|
|
|
|
/// Use this to initialize your joint definition
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultFilterJointDef")]
|
|
internal static unsafe partial B2FilterJointDef DefaultFilterJointDef();
|
|
|
|
/// Use this to initialize your joint definition
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultPrismaticJointDef")]
|
|
internal static unsafe partial B2PrismaticJointDef DefaultPrismaticJointDef();
|
|
|
|
/// Use this to initialize your joint definition.
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultRevoluteJointDef")]
|
|
internal static unsafe partial B2RevoluteJointDef DefaultRevoluteJointDef();
|
|
|
|
/// Use this to initialize your joint definition
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultWeldJointDef")]
|
|
internal static unsafe partial B2WeldJointDef DefaultWeldJointDef();
|
|
|
|
/// Use this to initialize your joint definition
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultWheelJointDef")]
|
|
internal static unsafe partial B2WheelJointDef DefaultWheelJointDef();
|
|
|
|
/// Use this to initialize your explosion definition
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultExplosionDef")]
|
|
internal static unsafe partial B2ExplosionDef DefaultExplosionDef();
|
|
|
|
/// Use this to initialize your drawing interface. This allows you to implement a sub-set
|
|
/// of the drawing functions.
|
|
[LibraryImport(Dll, EntryPoint = "b2DefaultDebugDraw")]
|
|
internal static unsafe partial B2DebugDraw DefaultDebugDraw();
|
|
|
|
/// Create a world for rigid body simulation. A world contains bodies, shapes, and constraints. You make create
|
|
/// up to 128 worlds. Each world is completely independent and may be simulated in parallel.
|
|
/// RETURN: the world id.
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateWorld")]
|
|
public static unsafe partial B2World CreateWorld(in B2WorldDef def);
|
|
|
|
/// Destroy a world
|
|
[LibraryImport(Dll, EntryPoint = "b2DestroyWorld")]
|
|
internal static unsafe partial void Dispose(B2World worldId);
|
|
|
|
/// World id validation. Provides validation for up to 64K allocations.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_IsValid")]
|
|
internal static unsafe partial Bool8 WorldIsValid(B2World id);
|
|
|
|
/// Simulate a world for one time step. This performs collision detection, integration, and constraint solution.
|
|
/// <param name="worldId">The world to simulate </param>
|
|
/// <param name="timeStep">The amount of time to simulate, this should be a fixed number. Usually 1/60. </param>
|
|
/// <param name="subStepCount">The number of sub-steps, increasing the sub-step count can increase accuracy. Usually 4. </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2World_Step")]
|
|
internal static unsafe partial void WorldStep(B2World worldId, float timeStep, int subStepCount);
|
|
|
|
/// Call this to draw shapes and other debug draw data
|
|
[LibraryImport(Dll, EntryPoint = "b2World_Draw")]
|
|
internal static unsafe partial void WorldDraw(B2World worldId, in B2DebugDraw draw);
|
|
|
|
/// Get the body events for the current time step. The event data is transient. Do not store a reference to this data.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_GetBodyEvents")]
|
|
internal static unsafe partial B2BodyEvents WorldGetBodyEvents(B2World worldId);
|
|
|
|
/// Get sensor events for the current time step. The event data is transient. Do not store a reference to this data.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_GetSensorEvents")]
|
|
internal static unsafe partial B2SensorEvents WorldGetSensorEvents(B2World worldId);
|
|
|
|
/// Get contact events for this current time step. The event data is transient. Do not store a reference to this data.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_GetContactEvents")]
|
|
internal static unsafe partial B2ContactEvents WorldGetContactEvents(B2World worldId);
|
|
|
|
/// Overlap test for all shapes that *potentially* overlap the provided AABB
|
|
[LibraryImport(Dll, EntryPoint = "b2World_OverlapAABB")]
|
|
internal static unsafe partial B2TreeStats WorldOverlapAabb(
|
|
B2World worldId,
|
|
B2Aabb aabb,
|
|
B2QueryFilter filter,
|
|
B2OverlapResultFcn fcn,
|
|
nint context
|
|
);
|
|
|
|
/// Overlap test for all shapes that overlap the provided shape proxy.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_OverlapShape")]
|
|
internal static unsafe partial B2TreeStats WorldOverlapShape(
|
|
B2World worldId,
|
|
in B2ShapeProxy proxy,
|
|
B2QueryFilter filter,
|
|
B2OverlapResultFcn fcn,
|
|
nint context
|
|
);
|
|
|
|
/// Cast a ray into the world to collect shapes in the path of the ray.
|
|
/// Your callback function controls whether you get the closest point, any point, or n-points.
|
|
/// NOTE: The callback function may receive shapes in any order
|
|
/// <param name="worldId">The world to cast the ray against </param>
|
|
/// <param name="origin">The start point of the ray </param>
|
|
/// <param name="translation">The translation of the ray from the start point to the end point </param>
|
|
/// <param name="filter">Contains bit flags to filter unwanted shapes from the results </param>
|
|
/// <param name="fcn">A user implemented callback function </param>
|
|
/// <param name="context">A user context that is passed along to the callback function </param>
|
|
/// RETURN: traversal performance counters
|
|
[LibraryImport(Dll, EntryPoint = "b2World_CastRay")]
|
|
internal static unsafe partial B2TreeStats WorldCastRay(
|
|
B2World worldId,
|
|
float2 origin,
|
|
float2 translation,
|
|
B2QueryFilter filter,
|
|
B2CastResultFcn fcn,
|
|
nint context
|
|
);
|
|
|
|
/// Cast a ray into the world to collect the closest hit. This is a convenience function. Ignores initial overlap.
|
|
/// This is less general than b2World_CastRay() and does not allow for custom filtering.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_CastRayClosest")]
|
|
internal static unsafe partial B2RayResult WorldCastRayClosest(
|
|
B2World worldId,
|
|
float2 origin,
|
|
float2 translation,
|
|
B2QueryFilter filter
|
|
);
|
|
|
|
/// Cast a shape through the world. Similar to a cast ray except that a shape is cast instead of a point.
|
|
/// SEE: b2World_CastRay
|
|
[LibraryImport(Dll, EntryPoint = "b2World_CastShape")]
|
|
internal static unsafe partial B2TreeStats WorldCastShape(
|
|
B2World worldId,
|
|
in B2ShapeProxy proxy,
|
|
float2 translation,
|
|
B2QueryFilter filter,
|
|
B2CastResultFcn fcn,
|
|
nint context
|
|
);
|
|
|
|
/// Cast a capsule mover through the world. This is a special shape cast that handles sliding along other shapes while reducing
|
|
/// clipping.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_CastMover")]
|
|
internal static unsafe partial float WorldCastMover(
|
|
B2World worldId,
|
|
in B2Capsule mover,
|
|
float2 translation,
|
|
B2QueryFilter filter
|
|
);
|
|
|
|
/// Collide a capsule mover with the world, gathering collision planes that can be fed to b2SolvePlanes. Useful for
|
|
/// kinematic character movement.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_CollideMover")]
|
|
internal static unsafe partial void WorldCollideMover(
|
|
B2World worldId,
|
|
in B2Capsule mover,
|
|
B2QueryFilter filter,
|
|
B2PlaneResultFcn fcn,
|
|
nint context
|
|
);
|
|
|
|
/// Enable/disable sleep. If your application does not need sleeping, you can gain some performance
|
|
/// by disabling sleep completely at the world level.
|
|
/// SEE: b2WorldDef
|
|
[LibraryImport(Dll, EntryPoint = "b2World_EnableSleeping")]
|
|
internal static unsafe partial void WorldEnableSleeping(B2World worldId, Bool8 flag);
|
|
|
|
/// Is body sleeping enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2World_IsSleepingEnabled")]
|
|
internal static unsafe partial Bool8 WorldIsSleepingEnabled(B2World worldId);
|
|
|
|
/// Enable/disable continuous collision between dynamic and static bodies. Generally you should keep continuous
|
|
/// collision enabled to prevent fast moving objects from going through static objects. The performance gain from
|
|
/// disabling continuous collision is minor.
|
|
/// SEE: b2WorldDef
|
|
[LibraryImport(Dll, EntryPoint = "b2World_EnableContinuous")]
|
|
internal static unsafe partial void WorldEnableContinuous(B2World worldId, Bool8 flag);
|
|
|
|
/// Is continuous collision enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2World_IsContinuousEnabled")]
|
|
internal static unsafe partial Bool8 WorldIsContinuousEnabled(B2World worldId);
|
|
|
|
/// Adjust the restitution threshold. It is recommended not to make this value very small
|
|
/// because it will prevent bodies from sleeping. Usually in meters per second.
|
|
/// SEE: b2WorldDef
|
|
[LibraryImport(Dll, EntryPoint = "b2World_SetRestitutionThreshold")]
|
|
internal static unsafe partial void WorldSetRestitutionThreshold(B2World worldId, float value);
|
|
|
|
/// Get the the restitution speed threshold. Usually in meters per second.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_GetRestitutionThreshold")]
|
|
internal static unsafe partial float WorldGetRestitutionThreshold(B2World worldId);
|
|
|
|
/// Adjust the hit event threshold. This controls the collision speed needed to generate a b2ContactHitEvent.
|
|
/// Usually in meters per second.
|
|
/// SEE: b2WorldDef::hitEventThreshold
|
|
[LibraryImport(Dll, EntryPoint = "b2World_SetHitEventThreshold")]
|
|
internal static unsafe partial void WorldSetHitEventThreshold(B2World worldId, float value);
|
|
|
|
/// Get the the hit event speed threshold. Usually in meters per second.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_GetHitEventThreshold")]
|
|
internal static unsafe partial float WorldGetHitEventThreshold(B2World worldId);
|
|
|
|
/// Register the custom filter callback. This is optional.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_SetCustomFilterCallback")]
|
|
internal static unsafe partial void WorldSetCustomFilterCallback(
|
|
B2World worldId,
|
|
B2CustomFilterFcn fcn,
|
|
nint context
|
|
);
|
|
|
|
/// Register the pre-solve callback. This is optional.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_SetPreSolveCallback")]
|
|
internal static unsafe partial void WorldSetPreSolveCallback(B2World worldId, B2PreSolveFcn fcn, nint context);
|
|
|
|
/// Set the gravity vector for the entire world. Box2D has no concept of an up direction and this
|
|
/// is left as a decision for the application. Usually in m/s^2.
|
|
/// SEE: b2WorldDef
|
|
[LibraryImport(Dll, EntryPoint = "b2World_SetGravity")]
|
|
internal static unsafe partial void WorldSetGravity(B2World worldId, float2 gravity);
|
|
|
|
/// Get the gravity vector
|
|
[LibraryImport(Dll, EntryPoint = "b2World_GetGravity")]
|
|
internal static unsafe partial float2 WorldGetGravity(B2World worldId);
|
|
|
|
/// Apply a radial explosion
|
|
/// <param name="worldId">The world id </param>
|
|
/// <param name="explosionDef">The explosion definition </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2World_Explode")]
|
|
internal static unsafe partial void WorldExplode(B2World worldId, in B2ExplosionDef explosionDef);
|
|
|
|
/// Adjust contact tuning parameters
|
|
/// <param name="worldId">The world id </param>
|
|
/// <param name="hertz">The contact stiffness (cycles per second) </param>
|
|
/// <param name="dampingRatio">The contact bounciness with 1 being critical damping (non-dimensional) </param>
|
|
/// <param name="pushSpeed">The maximum contact constraint push out speed (meters per second) </param>
|
|
/// NOTE: Advanced feature
|
|
[LibraryImport(Dll, EntryPoint = "b2World_SetContactTuning")]
|
|
internal static unsafe partial void WorldSetContactTuning(
|
|
B2World worldId,
|
|
float hertz,
|
|
float dampingRatio,
|
|
float pushSpeed
|
|
);
|
|
|
|
/// Set the maximum linear speed. Usually in m/s.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_SetMaximumLinearSpeed")]
|
|
internal static unsafe partial void WorldSetMaximumLinearSpeed(B2World worldId, float maximumLinearSpeed);
|
|
|
|
/// Get the maximum linear speed. Usually in m/s.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_GetMaximumLinearSpeed")]
|
|
internal static unsafe partial float WorldGetMaximumLinearSpeed(B2World worldId);
|
|
|
|
/// Enable/disable constraint warm starting. Advanced feature for testing. Disabling
|
|
/// warm starting greatly reduces stability and provides no performance gain.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_EnableWarmStarting")]
|
|
internal static unsafe partial void WorldEnableWarmStarting(B2World worldId, Bool8 flag);
|
|
|
|
/// Is constraint warm starting enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2World_IsWarmStartingEnabled")]
|
|
internal static unsafe partial Bool8 WorldIsWarmStartingEnabled(B2World worldId);
|
|
|
|
/// Get the number of awake bodies.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_GetAwakeBodyCount")]
|
|
internal static unsafe partial int WorldGetAwakeBodyCount(B2World worldId);
|
|
|
|
/// Get the current world performance profile
|
|
[LibraryImport(Dll, EntryPoint = "b2World_GetProfile")]
|
|
internal static unsafe partial B2Profile WorldGetProfile(B2World worldId);
|
|
|
|
/// Get world counters and sizes
|
|
[LibraryImport(Dll, EntryPoint = "b2World_GetCounters")]
|
|
internal static unsafe partial B2Counters WorldGetCounters(B2World worldId);
|
|
|
|
/// Set the user data pointer.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_SetUserData")]
|
|
internal static unsafe partial void WorldSetUserData(B2World worldId, nint userData);
|
|
|
|
/// Get the user data pointer.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_GetUserData")]
|
|
internal static unsafe partial void* WorldGetUserData(B2World worldId);
|
|
|
|
/// Set the friction callback. Passing NULL resets to default.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_SetFrictionCallback")]
|
|
internal static unsafe partial void WorldSetFrictionCallback(B2World worldId, B2FrictionCallback callback);
|
|
|
|
/// Set the restitution callback. Passing NULL resets to default.
|
|
[LibraryImport(Dll, EntryPoint = "b2World_SetRestitutionCallback")]
|
|
internal static unsafe partial void WorldSetRestitutionCallback(
|
|
B2World worldId,
|
|
B2RestitutionCallback callback
|
|
);
|
|
|
|
/// Dump memory stats to box2d_memory.txt
|
|
[LibraryImport(Dll, EntryPoint = "b2World_DumpMemoryStats")]
|
|
internal static unsafe partial void WorldDumpMemoryStats(B2World worldId);
|
|
|
|
/// This is for internal testing
|
|
[LibraryImport(Dll, EntryPoint = "b2World_RebuildStaticTree")]
|
|
internal static unsafe partial void WorldRebuildStaticTree(B2World worldId);
|
|
|
|
/// This is for internal testing
|
|
[LibraryImport(Dll, EntryPoint = "b2World_EnableSpeculative")]
|
|
internal static unsafe partial void WorldEnableSpeculative(B2World worldId, Bool8 flag);
|
|
|
|
/// Create a rigid body given a definition. No reference to the definition is retained. So you can create the definition
|
|
/// on the stack and pass it as a pointer.
|
|
/// WARNING: This function is locked during callbacks.
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateBody")]
|
|
internal static unsafe partial B2Body CreateBody(B2World worldId, in B2BodyDef def);
|
|
|
|
/// Destroy a rigid body given an id. This destroys all shapes and joints attached to the body.
|
|
/// Do not keep references to the associated shapes and joints.
|
|
[LibraryImport(Dll, EntryPoint = "b2DestroyBody")]
|
|
internal static unsafe partial void Dispose(B2Body bodyId);
|
|
|
|
/// Body identifier validation. Can be used to detect orphaned ids. Provides validation for up to 64K allocations.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_IsValid")]
|
|
internal static unsafe partial Bool8 BodyIsValid(B2Body id);
|
|
|
|
/// Get the body type: static, kinematic, or dynamic
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetType")]
|
|
internal static unsafe partial B2BodyType GetBodyType(B2Body bodyId);
|
|
|
|
/// Change the body type. This is an expensive operation. This automatically updates the mass
|
|
/// properties regardless of the automatic mass setting.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetType")]
|
|
internal static unsafe partial void BodySetType(B2Body bodyId, B2BodyType type);
|
|
|
|
/// Set the body name. Up to 31 characters excluding 0 termination.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetName")]
|
|
internal static unsafe partial void BodySetName(B2Body bodyId, byte* name);
|
|
|
|
/// Get the body name. May be null.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetName")]
|
|
internal static unsafe partial byte* BodyGetName(B2Body bodyId);
|
|
|
|
/// Set the user data for a body
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetUserData")]
|
|
internal static unsafe partial void BodySetUserData(B2Body bodyId, nint userData);
|
|
|
|
/// Get the user data stored in a body
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetUserData")]
|
|
internal static unsafe partial void* BodyGetUserData(B2Body bodyId);
|
|
|
|
/// Get the world position of a body. This is the location of the body origin.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetPosition")]
|
|
internal static unsafe partial float2 BodyGetPosition(B2Body bodyId);
|
|
|
|
/// Get the world rotation of a body as a cosine/sine pair (complex number)
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetRotation")]
|
|
internal static unsafe partial B2Rot BodyGetRotation(B2Body bodyId);
|
|
|
|
/// Get the world transform of a body.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetTransform")]
|
|
internal static unsafe partial B2Transform BodyGetTransform(B2Body bodyId);
|
|
|
|
/// Set the world transform of a body. This acts as a teleport and is fairly expensive.
|
|
/// NOTE: Generally you should create a body with then intended transform.
|
|
/// SEE: b2BodyDef::position and b2BodyDef::angle
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetTransform")]
|
|
internal static unsafe partial void BodySetTransform(B2Body bodyId, float2 position, B2Rot rotation);
|
|
|
|
/// Get a local point on a body given a world point
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetLocalPoint")]
|
|
internal static unsafe partial float2 BodyGetLocalPoint(B2Body bodyId, float2 worldPoint);
|
|
|
|
/// Get a world point on a body given a local point
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetWorldPoint")]
|
|
internal static unsafe partial float2 BodyGetWorldPoint(B2Body bodyId, float2 localPoint);
|
|
|
|
/// Get a local vector on a body given a world vector
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetLocalVector")]
|
|
internal static unsafe partial float2 BodyGetLocalVector(B2Body bodyId, float2 worldVector);
|
|
|
|
/// Get a world vector on a body given a local vector
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetWorldVector")]
|
|
internal static unsafe partial float2 BodyGetWorldVector(B2Body bodyId, float2 localVector);
|
|
|
|
/// Get the linear velocity of a body's center of mass. Usually in meters per second.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetLinearVelocity")]
|
|
internal static unsafe partial float2 BodyGetLinearVelocity(B2Body bodyId);
|
|
|
|
/// Get the angular velocity of a body in radians per second
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetAngularVelocity")]
|
|
internal static unsafe partial float BodyGetAngularVelocity(B2Body bodyId);
|
|
|
|
/// Set the linear velocity of a body. Usually in meters per second.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetLinearVelocity")]
|
|
internal static unsafe partial void BodySetLinearVelocity(B2Body bodyId, float2 linearVelocity);
|
|
|
|
/// Set the angular velocity of a body in radians per second
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetAngularVelocity")]
|
|
internal static unsafe partial void BodySetAngularVelocity(B2Body bodyId, float angularVelocity);
|
|
|
|
/// Set the velocity to reach the given transform after a given time step.
|
|
/// The result will be close but maybe not exact. This is meant for kinematic bodies.
|
|
/// The target is not applied if the velocity would be below the sleep threshold.
|
|
/// This will automatically wake the body if asleep.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetTargetTransform")]
|
|
internal static unsafe partial void BodySetTargetTransform(B2Body bodyId, B2Transform target, float timeStep);
|
|
|
|
/// Get the linear velocity of a local point attached to a body. Usually in meters per second.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetLocalPointVelocity")]
|
|
internal static unsafe partial float2 BodyGetLocalPointVelocity(B2Body bodyId, float2 localPoint);
|
|
|
|
/// Get the linear velocity of a world point attached to a body. Usually in meters per second.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetWorldPointVelocity")]
|
|
internal static unsafe partial float2 BodyGetWorldPointVelocity(B2Body bodyId, float2 worldPoint);
|
|
|
|
/// Apply a force at a world point. If the force is not applied at the center of mass,
|
|
/// it will generate a torque and affect the angular velocity. This optionally wakes up the body.
|
|
/// The force is ignored if the body is not awake.
|
|
/// <param name="bodyId">The body id </param>
|
|
/// <param name="force">The world force vector, usually in newtons (N) </param>
|
|
/// <param name="point">The world position of the point of application </param>
|
|
/// <param name="wake">Option to wake up the body </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_ApplyForce")]
|
|
internal static unsafe partial void BodyApplyForce(B2Body bodyId, float2 force, float2 point, Bool8 wake);
|
|
|
|
/// Apply a force to the center of mass. This optionally wakes up the body.
|
|
/// The force is ignored if the body is not awake.
|
|
/// <param name="bodyId">The body id </param>
|
|
/// <param name="force">the world force vector, usually in newtons (N). </param>
|
|
/// <param name="wake">also wake up the body </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_ApplyForceToCenter")]
|
|
internal static unsafe partial void BodyApplyForceToCenter(B2Body bodyId, float2 force, Bool8 wake);
|
|
|
|
/// Apply a torque. This affects the angular velocity without affecting the linear velocity.
|
|
/// This optionally wakes the body. The torque is ignored if the body is not awake.
|
|
/// <param name="bodyId">The body id </param>
|
|
/// <param name="torque">about the z-axis (out of the screen), usually in N*m. </param>
|
|
/// <param name="wake">also wake up the body </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_ApplyTorque")]
|
|
internal static unsafe partial void BodyApplyTorque(B2Body bodyId, float torque, Bool8 wake);
|
|
|
|
/// Apply an impulse at a point. This immediately modifies the velocity.
|
|
/// It also modifies the angular velocity if the point of application
|
|
/// is not at the center of mass. This optionally wakes the body.
|
|
/// The impulse is ignored if the body is not awake.
|
|
/// <param name="bodyId">The body id </param>
|
|
/// <param name="impulse">the world impulse vector, usually in N*s or kg*m/s. </param>
|
|
/// <param name="point">the world position of the point of application. </param>
|
|
/// <param name="wake">also wake up the body </param>
|
|
/// WARNING: This should be used for one-shot impulses. If you need a steady force, use a force instead, which will work better with the sub-stepping solver.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_ApplyLinearImpulse")]
|
|
internal static unsafe partial void BodyApplyLinearImpulse(
|
|
B2Body bodyId,
|
|
float2 impulse,
|
|
float2 point,
|
|
Bool8 wake
|
|
);
|
|
|
|
/// Apply an impulse to the center of mass. This immediately modifies the velocity.
|
|
/// The impulse is ignored if the body is not awake. This optionally wakes the body.
|
|
/// <param name="bodyId">The body id </param>
|
|
/// <param name="impulse">the world impulse vector, usually in N*s or kg*m/s. </param>
|
|
/// <param name="wake">also wake up the body </param>
|
|
/// WARNING: This should be used for one-shot impulses. If you need a steady force, use a force instead, which will work better with the sub-stepping solver.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_ApplyLinearImpulseToCenter")]
|
|
internal static unsafe partial void BodyApplyLinearImpulseToCenter(B2Body bodyId, float2 impulse, Bool8 wake);
|
|
|
|
/// Apply an angular impulse. The impulse is ignored if the body is not awake.
|
|
/// This optionally wakes the body.
|
|
/// <param name="bodyId">The body id </param>
|
|
/// <param name="impulse">the angular impulse, usually in units of kg*m*m/s </param>
|
|
/// <param name="wake">also wake up the body </param>
|
|
/// WARNING: This should be used for one-shot impulses. If you need a steady force, use a force instead, which will work better with the sub-stepping solver.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_ApplyAngularImpulse")]
|
|
internal static unsafe partial void BodyApplyAngularImpulse(B2Body bodyId, float impulse, Bool8 wake);
|
|
|
|
/// Get the mass of the body, usually in kilograms
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetMass")]
|
|
internal static unsafe partial float BodyGetMass(B2Body bodyId);
|
|
|
|
/// Get the rotational inertia of the body, usually in kg*m^2
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetRotationalInertia")]
|
|
internal static unsafe partial float BodyGetRotationalInertia(B2Body bodyId);
|
|
|
|
/// Get the center of mass position of the body in local space
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetLocalCenterOfMass")]
|
|
internal static unsafe partial float2 BodyGetLocalCenterOfMass(B2Body bodyId);
|
|
|
|
/// Get the center of mass position of the body in world space
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetWorldCenterOfMass")]
|
|
internal static unsafe partial float2 BodyGetWorldCenterOfMass(B2Body bodyId);
|
|
|
|
/// Override the body's mass properties. Normally this is computed automatically using the
|
|
/// shape geometry and density. This information is lost if a shape is added or removed or if the
|
|
/// body type changes.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetMassData")]
|
|
internal static unsafe partial void BodySetMassData(B2Body bodyId, B2MassData massData);
|
|
|
|
/// Get the mass data for a body
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetMassData")]
|
|
internal static unsafe partial B2MassData BodyGetMassData(B2Body bodyId);
|
|
|
|
/// This update the mass properties to the sum of the mass properties of the shapes.
|
|
/// This normally does not need to be called unless you called SetMassData to override
|
|
/// the mass and you later want to reset the mass.
|
|
/// You may also use this when automatic mass computation has been disabled.
|
|
/// You should call this regardless of body type.
|
|
/// Note that sensor shapes may have mass.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_ApplyMassFromShapes")]
|
|
internal static unsafe partial void BodyApplyMassFromShapes(B2Body bodyId);
|
|
|
|
/// Adjust the linear damping. Normally this is set in b2BodyDef before creation.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetLinearDamping")]
|
|
internal static unsafe partial void BodySetLinearDamping(B2Body bodyId, float linearDamping);
|
|
|
|
/// Get the current linear damping.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetLinearDamping")]
|
|
internal static unsafe partial float BodyGetLinearDamping(B2Body bodyId);
|
|
|
|
/// Adjust the angular damping. Normally this is set in b2BodyDef before creation.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetAngularDamping")]
|
|
internal static unsafe partial void BodySetAngularDamping(B2Body bodyId, float angularDamping);
|
|
|
|
/// Get the current angular damping.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetAngularDamping")]
|
|
internal static unsafe partial float BodyGetAngularDamping(B2Body bodyId);
|
|
|
|
/// Adjust the gravity scale. Normally this is set in b2BodyDef before creation.
|
|
/// SEE: b2BodyDef::gravityScale
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetGravityScale")]
|
|
internal static unsafe partial void BodySetGravityScale(B2Body bodyId, float gravityScale);
|
|
|
|
/// Get the current gravity scale
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetGravityScale")]
|
|
internal static unsafe partial float BodyGetGravityScale(B2Body bodyId);
|
|
|
|
/// RETURN: true if this body is awake
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_IsAwake")]
|
|
internal static unsafe partial Bool8 BodyIsAwake(B2Body bodyId);
|
|
|
|
/// Wake a body from sleep. This wakes the entire island the body is touching.
|
|
/// WARNING: Putting a body to sleep will put the entire island of bodies touching this body to sleep, which can be expensive and possibly unintuitive.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetAwake")]
|
|
internal static unsafe partial void BodySetAwake(B2Body bodyId, Bool8 awake);
|
|
|
|
/// Enable or disable sleeping for this body. If sleeping is disabled the body will wake.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_EnableSleep")]
|
|
internal static unsafe partial void BodyEnableSleep(B2Body bodyId, Bool8 enableSleep);
|
|
|
|
/// Returns true if sleeping is enabled for this body
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_IsSleepEnabled")]
|
|
internal static unsafe partial Bool8 BodyIsSleepEnabled(B2Body bodyId);
|
|
|
|
/// Set the sleep threshold, usually in meters per second
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetSleepThreshold")]
|
|
internal static unsafe partial void BodySetSleepThreshold(B2Body bodyId, float sleepThreshold);
|
|
|
|
/// Get the sleep threshold, usually in meters per second.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetSleepThreshold")]
|
|
internal static unsafe partial float BodyGetSleepThreshold(B2Body bodyId);
|
|
|
|
/// Returns true if this body is enabled
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_IsEnabled")]
|
|
internal static unsafe partial Bool8 BodyIsEnabled(B2Body bodyId);
|
|
|
|
/// Disable a body by removing it completely from the simulation. This is expensive.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_Disable")]
|
|
internal static unsafe partial void BodyDisable(B2Body bodyId);
|
|
|
|
/// Enable a body by adding it to the simulation. This is expensive.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_Enable")]
|
|
internal static unsafe partial void BodyEnable(B2Body bodyId);
|
|
|
|
/// Set this body to have fixed rotation. This causes the mass to be reset in all cases.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetFixedRotation")]
|
|
internal static unsafe partial void BodySetFixedRotation(B2Body bodyId, Bool8 flag);
|
|
|
|
/// Does this body have fixed rotation?
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_IsFixedRotation")]
|
|
internal static unsafe partial Bool8 BodyIsFixedRotation(B2Body bodyId);
|
|
|
|
/// Set this body to be a bullet. A bullet does continuous collision detection
|
|
/// against dynamic bodies (but not other bullets).
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_SetBullet")]
|
|
internal static unsafe partial void BodySetBullet(B2Body bodyId, Bool8 flag);
|
|
|
|
/// Is this body a bullet?
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_IsBullet")]
|
|
internal static unsafe partial Bool8 BodyIsBullet(B2Body bodyId);
|
|
|
|
/// Enable/disable contact events on all shapes.
|
|
/// SEE: b2ShapeDef::enableContactEvents
|
|
/// WARNING: changing this at runtime may cause mismatched begin/end touch events
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_EnableContactEvents")]
|
|
internal static unsafe partial void BodyEnableContactEvents(B2Body bodyId, Bool8 flag);
|
|
|
|
/// Enable/disable hit events on all shapes
|
|
/// SEE: b2ShapeDef::enableHitEvents
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_EnableHitEvents")]
|
|
internal static unsafe partial void BodyEnableHitEvents(B2Body bodyId, Bool8 flag);
|
|
|
|
/// Get the world that owns this body
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetWorld")]
|
|
internal static unsafe partial B2World BodyGetWorld(B2Body bodyId);
|
|
|
|
/// Get the number of shapes on this body
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetShapeCount")]
|
|
internal static unsafe partial int BodyGetShapeCount(B2Body bodyId);
|
|
|
|
/// Get the shape ids for all shapes on this body, up to the provided capacity.
|
|
/// RETURNS: the number of shape ids stored in the user array
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetShapes")]
|
|
internal static unsafe partial int BodyGetShapes(B2Body bodyId, in B2Shape shapeArray, int capacity);
|
|
|
|
/// Get the number of joints on this body
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetJointCount")]
|
|
internal static unsafe partial int BodyGetJointCount(B2Body bodyId);
|
|
|
|
/// Get the maximum capacity required for retrieving all the touching contacts on a body
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetContactCapacity")]
|
|
internal static unsafe partial int BodyGetContactCapacity(B2Body bodyId);
|
|
|
|
/// Get the touching contact data for a body.
|
|
/// NOTE: Box2D uses speculative collision so some contact points may be separated.
|
|
/// RETURNS: the number of elements filled in the provided array
|
|
/// WARNING: do not ignore the return value, it specifies the valid number of elements
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_GetContactData")]
|
|
internal static unsafe partial int BodyGetContactData(
|
|
B2Body bodyId,
|
|
in B2ContactData contactData,
|
|
int capacity
|
|
);
|
|
|
|
/// Get the current world AABB that contains all the attached shapes. Note that this may not encompass the body origin.
|
|
/// If there are no shapes attached then the returned AABB is empty and centered on the body origin.
|
|
[LibraryImport(Dll, EntryPoint = "b2Body_ComputeAABB")]
|
|
internal static unsafe partial B2Aabb BodyComputeAabb(B2Body bodyId);
|
|
|
|
/// Create a circle shape and attach it to a body. The shape definition and geometry are fully cloned.
|
|
/// Contacts are not created until the next time step.
|
|
/// RETURN: the shape id for accessing the shape
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateCircleShape")]
|
|
internal static unsafe partial B2Shape CreateCircleShape(B2Body bodyId, in B2ShapeDef def, in B2Circle circle);
|
|
|
|
/// Create a line segment shape and attach it to a body. The shape definition and geometry are fully cloned.
|
|
/// Contacts are not created until the next time step.
|
|
/// RETURN: the shape id for accessing the shape
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateSegmentShape")]
|
|
internal static unsafe partial B2Shape CreateSegmentShape(
|
|
B2Body bodyId,
|
|
in B2ShapeDef def,
|
|
in B2Segment segment
|
|
);
|
|
|
|
/// Create a capsule shape and attach it to a body. The shape definition and geometry are fully cloned.
|
|
/// Contacts are not created until the next time step.
|
|
/// RETURN: the shape id for accessing the shape
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateCapsuleShape")]
|
|
internal static unsafe partial B2Shape CreateCapsuleShape(
|
|
B2Body bodyId,
|
|
in B2ShapeDef def,
|
|
in B2Capsule capsule
|
|
);
|
|
|
|
/// Create a polygon shape and attach it to a body. The shape definition and geometry are fully cloned.
|
|
/// Contacts are not created until the next time step.
|
|
/// RETURN: the shape id for accessing the shape
|
|
[LibraryImport(Dll, EntryPoint = "b2CreatePolygonShape")]
|
|
internal static unsafe partial B2Shape CreatePolygonShape(
|
|
B2Body bodyId,
|
|
in B2ShapeDef def,
|
|
in B2Polygon polygon
|
|
);
|
|
|
|
/// Destroy a shape. You may defer the body mass update which can improve performance if several shapes on a
|
|
/// body are destroyed at once.
|
|
/// SEE: b2Body_ApplyMassFromShapes
|
|
[LibraryImport(Dll, EntryPoint = "b2DestroyShape")]
|
|
internal static unsafe partial void Dispose(B2Shape shapeId, Bool8 updateBodyMass);
|
|
|
|
/// Shape identifier validation. Provides validation for up to 64K allocations.
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_IsValid")]
|
|
internal static unsafe partial Bool8 ShapeIsValid(B2Shape id);
|
|
|
|
/// Get the type of a shape
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetType")]
|
|
internal static unsafe partial B2ShapeType GetShapeType(B2Shape shapeId);
|
|
|
|
/// Get the id of the body that a shape is attached to
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetBody")]
|
|
internal static unsafe partial B2Body ShapeGetBody(B2Shape shapeId);
|
|
|
|
/// Get the world that owns this shape
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetWorld")]
|
|
internal static unsafe partial B2World ShapeGetWorld(B2Shape shapeId);
|
|
|
|
/// Returns true if the shape is a sensor. It is not possible to change a shape
|
|
/// from sensor to solid dynamically because this breaks the contract for
|
|
/// sensor events.
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_IsSensor")]
|
|
internal static unsafe partial Bool8 ShapeIsSensor(B2Shape shapeId);
|
|
|
|
/// Set the user data for a shape
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_SetUserData")]
|
|
internal static unsafe partial void ShapeSetUserData(B2Shape shapeId, nint userData);
|
|
|
|
/// Get the user data for a shape. This is useful when you get a shape id
|
|
/// from an event or query.
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetUserData")]
|
|
internal static unsafe partial void* ShapeGetUserData(B2Shape shapeId);
|
|
|
|
/// Set the mass density of a shape, usually in kg/m^2.
|
|
/// This will optionally update the mass properties on the parent body.
|
|
/// SEE: b2ShapeDef::density, b2Body_ApplyMassFromShapes
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_SetDensity")]
|
|
internal static unsafe partial void ShapeSetDensity(B2Shape shapeId, float density, Bool8 updateBodyMass);
|
|
|
|
/// Get the density of a shape, usually in kg/m^2
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetDensity")]
|
|
internal static unsafe partial float ShapeGetDensity(B2Shape shapeId);
|
|
|
|
/// Set the friction on a shape
|
|
/// SEE: b2ShapeDef::friction
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_SetFriction")]
|
|
internal static unsafe partial void ShapeSetFriction(B2Shape shapeId, float friction);
|
|
|
|
/// Get the friction of a shape
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetFriction")]
|
|
internal static unsafe partial float ShapeGetFriction(B2Shape shapeId);
|
|
|
|
/// Set the shape restitution (bounciness)
|
|
/// SEE: b2ShapeDef::restitution
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_SetRestitution")]
|
|
internal static unsafe partial void ShapeSetRestitution(B2Shape shapeId, float restitution);
|
|
|
|
/// Get the shape restitution
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetRestitution")]
|
|
internal static unsafe partial float ShapeGetRestitution(B2Shape shapeId);
|
|
|
|
/// Set the shape material identifier
|
|
/// SEE: b2ShapeDef::material
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_SetMaterial")]
|
|
internal static unsafe partial void ShapeSetMaterial(B2Shape shapeId, int material);
|
|
|
|
/// Get the shape material identifier
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetMaterial")]
|
|
internal static unsafe partial int ShapeGetMaterial(B2Shape shapeId);
|
|
|
|
/// Set the shape surface material
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_SetSurfaceMaterial")]
|
|
internal static unsafe partial void ShapeSetSurfaceMaterial(B2Shape shapeId, B2SurfaceMaterial surfaceMaterial);
|
|
|
|
/// Get the shape surface material
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetSurfaceMaterial")]
|
|
internal static unsafe partial B2SurfaceMaterial ShapeGetSurfaceMaterial(B2Shape shapeId);
|
|
|
|
/// Get the shape filter
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetFilter")]
|
|
internal static unsafe partial B2Filter ShapeGetFilter(B2Shape shapeId);
|
|
|
|
/// Set the current filter. This is almost as expensive as recreating the shape. This may cause
|
|
/// contacts to be immediately destroyed. However contacts are not created until the next world step.
|
|
/// Sensor overlap state is also not updated until the next world step.
|
|
/// SEE: b2ShapeDef::filter
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_SetFilter")]
|
|
internal static unsafe partial void ShapeSetFilter(B2Shape shapeId, B2Filter filter);
|
|
|
|
/// Enable sensor events for this shape.
|
|
/// SEE: b2ShapeDef::enableSensorEvents
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_EnableSensorEvents")]
|
|
internal static unsafe partial void ShapeEnableSensorEvents(B2Shape shapeId, Bool8 flag);
|
|
|
|
/// Returns true if sensor events are enabled.
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_AreSensorEventsEnabled")]
|
|
internal static unsafe partial Bool8 ShapeAreSensorEventsEnabled(B2Shape shapeId);
|
|
|
|
/// Enable contact events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors.
|
|
/// SEE: b2ShapeDef::enableContactEvents
|
|
/// WARNING: changing this at run-time may lead to lost begin/end events
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_EnableContactEvents")]
|
|
internal static unsafe partial void ShapeEnableContactEvents(B2Shape shapeId, Bool8 flag);
|
|
|
|
/// Returns true if contact events are enabled
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_AreContactEventsEnabled")]
|
|
internal static unsafe partial Bool8 ShapeAreContactEventsEnabled(B2Shape shapeId);
|
|
|
|
/// Enable pre-solve contact events for this shape. Only applies to dynamic bodies. These are expensive
|
|
/// and must be carefully handled due to multithreading. Ignored for sensors.
|
|
/// SEE: b2PreSolveFcn
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_EnablePreSolveEvents")]
|
|
internal static unsafe partial void ShapeEnablePreSolveEvents(B2Shape shapeId, Bool8 flag);
|
|
|
|
/// Returns true if pre-solve events are enabled
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_ArePreSolveEventsEnabled")]
|
|
internal static unsafe partial Bool8 ShapeArePreSolveEventsEnabled(B2Shape shapeId);
|
|
|
|
/// Enable contact hit events for this shape. Ignored for sensors.
|
|
/// SEE: b2WorldDef.hitEventThreshold
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_EnableHitEvents")]
|
|
internal static unsafe partial void ShapeEnableHitEvents(B2Shape shapeId, Bool8 flag);
|
|
|
|
/// Returns true if hit events are enabled
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_AreHitEventsEnabled")]
|
|
internal static unsafe partial Bool8 ShapeAreHitEventsEnabled(B2Shape shapeId);
|
|
|
|
/// Test a point for overlap with a shape
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_TestPoint")]
|
|
internal static unsafe partial Bool8 ShapeTestPoint(B2Shape shapeId, float2 point);
|
|
|
|
/// Ray cast a shape directly
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_RayCast")]
|
|
internal static unsafe partial B2CastOutput ShapeRayCast(B2Shape shapeId, in B2RayCastInput input);
|
|
|
|
/// Get a copy of the shape's circle. Asserts the type is correct.
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetCircle")]
|
|
internal static unsafe partial B2Circle ShapeGetCircle(B2Shape shapeId);
|
|
|
|
/// Get a copy of the shape's line segment. Asserts the type is correct.
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetSegment")]
|
|
internal static unsafe partial B2Segment ShapeGetSegment(B2Shape shapeId);
|
|
|
|
/// Get a copy of the shape's chain segment. These come from chain shapes.
|
|
/// Asserts the type is correct.
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetChainSegment")]
|
|
internal static unsafe partial B2ChainSegment ShapeGetChainSegment(B2Shape shapeId);
|
|
|
|
/// Get a copy of the shape's capsule. Asserts the type is correct.
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetCapsule")]
|
|
internal static unsafe partial B2Capsule ShapeGetCapsule(B2Shape shapeId);
|
|
|
|
/// Get a copy of the shape's convex polygon. Asserts the type is correct.
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetPolygon")]
|
|
internal static unsafe partial B2Polygon ShapeGetPolygon(B2Shape shapeId);
|
|
|
|
/// Allows you to change a shape to be a circle or update the current circle.
|
|
/// This does not modify the mass properties.
|
|
/// SEE: b2Body_ApplyMassFromShapes
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_SetCircle")]
|
|
internal static unsafe partial void ShapeSetCircle(B2Shape shapeId, in B2Circle circle);
|
|
|
|
/// Allows you to change a shape to be a capsule or update the current capsule.
|
|
/// This does not modify the mass properties.
|
|
/// SEE: b2Body_ApplyMassFromShapes
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_SetCapsule")]
|
|
internal static unsafe partial void ShapeSetCapsule(B2Shape shapeId, in B2Capsule capsule);
|
|
|
|
/// Allows you to change a shape to be a segment or update the current segment.
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_SetSegment")]
|
|
internal static unsafe partial void ShapeSetSegment(B2Shape shapeId, in B2Segment segment);
|
|
|
|
/// Allows you to change a shape to be a polygon or update the current polygon.
|
|
/// This does not modify the mass properties.
|
|
/// SEE: b2Body_ApplyMassFromShapes
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_SetPolygon")]
|
|
internal static unsafe partial void ShapeSetPolygon(B2Shape shapeId, in B2Polygon polygon);
|
|
|
|
/// Get the parent chain id if the shape type is a chain segment, otherwise
|
|
/// returns b2_nullChainId.
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetParentChain")]
|
|
internal static unsafe partial B2Chain ShapeGetParentChain(B2Shape shapeId);
|
|
|
|
/// Get the maximum capacity required for retrieving all the touching contacts on a shape
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetContactCapacity")]
|
|
internal static unsafe partial int ShapeGetContactCapacity(B2Shape shapeId);
|
|
|
|
/// Get the touching contact data for a shape. The provided shapeId will be either shapeIdA or shapeIdB on the contact data.
|
|
/// NOTE: Box2D uses speculative collision so some contact points may be separated.
|
|
/// RETURNS: the number of elements filled in the provided array
|
|
/// WARNING: do not ignore the return value, it specifies the valid number of elements
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetContactData")]
|
|
internal static unsafe partial int ShapeGetContactData(
|
|
B2Shape shapeId,
|
|
in B2ContactData contactData,
|
|
int capacity
|
|
);
|
|
|
|
/// Get the maximum capacity required for retrieving all the overlapped shapes on a sensor shape.
|
|
/// This returns 0 if the provided shape is not a sensor.
|
|
/// <param name="shapeId">the id of a sensor shape </param>
|
|
/// RETURNS: the required capacity to get all the overlaps in b2Shape_GetSensorOverlaps
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetSensorCapacity")]
|
|
internal static unsafe partial int ShapeGetSensorCapacity(B2Shape shapeId);
|
|
|
|
/// Get the overlapped shapes for a sensor shape.
|
|
/// <param name="shapeId">the id of a sensor shape </param>
|
|
/// <param name="overlaps">a user allocated array that is filled with the overlapping shapes </param>
|
|
/// <param name="capacity">the capacity of overlappedShapes </param>
|
|
/// RETURNS: the number of elements filled in the provided array
|
|
/// WARNING: do not ignore the return value, it specifies the valid number of elements
|
|
/// WARNING: overlaps may contain destroyed shapes so use b2Shape_IsValid to confirm each overlap
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetSensorOverlaps")]
|
|
internal static unsafe partial int ShapeGetSensorOverlaps(B2Shape shapeId, in B2Shape overlaps, int capacity);
|
|
|
|
/// Get the current world AABB
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetAABB")]
|
|
internal static unsafe partial B2Aabb ShapeGetAabb(B2Shape shapeId);
|
|
|
|
/// Get the mass data for a shape
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetMassData")]
|
|
internal static unsafe partial B2MassData ShapeGetMassData(B2Shape shapeId);
|
|
|
|
/// Get the closest point on a shape to a target point. Target and result are in world space.
|
|
/// todo need sample
|
|
[LibraryImport(Dll, EntryPoint = "b2Shape_GetClosestPoint")]
|
|
internal static unsafe partial float2 ShapeGetClosestPoint(B2Shape shapeId, float2 target);
|
|
|
|
/// Create a chain shape
|
|
/// SEE: b2ChainDef for details
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateChain")]
|
|
internal static unsafe partial B2Chain CreateChain(B2Body bodyId, in B2ChainDef def);
|
|
|
|
/// Destroy a chain shape
|
|
[LibraryImport(Dll, EntryPoint = "b2DestroyChain")]
|
|
internal static unsafe partial void Dispose(B2Chain chainId);
|
|
|
|
/// Get the world that owns this chain shape
|
|
[LibraryImport(Dll, EntryPoint = "b2Chain_GetWorld")]
|
|
internal static unsafe partial B2World ChainGetWorld(B2Chain chainId);
|
|
|
|
/// Get the number of segments on this chain
|
|
[LibraryImport(Dll, EntryPoint = "b2Chain_GetSegmentCount")]
|
|
internal static unsafe partial int ChainGetSegmentCount(B2Chain chainId);
|
|
|
|
/// Fill a user array with chain segment shape ids up to the specified capacity. Returns
|
|
/// the actual number of segments returned.
|
|
[LibraryImport(Dll, EntryPoint = "b2Chain_GetSegments")]
|
|
internal static unsafe partial int ChainGetSegments(B2Chain chainId, in B2Shape segmentArray, int capacity);
|
|
|
|
/// Set the chain friction
|
|
/// SEE: b2ChainDef::friction
|
|
[LibraryImport(Dll, EntryPoint = "b2Chain_SetFriction")]
|
|
internal static unsafe partial void ChainSetFriction(B2Chain chainId, float friction);
|
|
|
|
/// Get the chain friction
|
|
[LibraryImport(Dll, EntryPoint = "b2Chain_GetFriction")]
|
|
internal static unsafe partial float ChainGetFriction(B2Chain chainId);
|
|
|
|
/// Set the chain restitution (bounciness)
|
|
/// SEE: b2ChainDef::restitution
|
|
[LibraryImport(Dll, EntryPoint = "b2Chain_SetRestitution")]
|
|
internal static unsafe partial void ChainSetRestitution(B2Chain chainId, float restitution);
|
|
|
|
/// Get the chain restitution
|
|
[LibraryImport(Dll, EntryPoint = "b2Chain_GetRestitution")]
|
|
internal static unsafe partial float ChainGetRestitution(B2Chain chainId);
|
|
|
|
/// Set the chain material
|
|
/// SEE: b2ChainDef::material
|
|
[LibraryImport(Dll, EntryPoint = "b2Chain_SetMaterial")]
|
|
internal static unsafe partial void ChainSetMaterial(B2Chain chainId, int material);
|
|
|
|
/// Get the chain material
|
|
[LibraryImport(Dll, EntryPoint = "b2Chain_GetMaterial")]
|
|
internal static unsafe partial int ChainGetMaterial(B2Chain chainId);
|
|
|
|
/// Chain identifier validation. Provides validation for up to 64K allocations.
|
|
[LibraryImport(Dll, EntryPoint = "b2Chain_IsValid")]
|
|
internal static unsafe partial Bool8 ChainIsValid(B2Chain id);
|
|
|
|
/// Destroy a joint
|
|
[LibraryImport(Dll, EntryPoint = "b2DestroyJoint")]
|
|
internal static unsafe partial void Dispose(B2Joint jointId);
|
|
|
|
/// Joint identifier validation. Provides validation for up to 64K allocations.
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_IsValid")]
|
|
internal static unsafe partial Bool8 JointIsValid(B2Joint id);
|
|
|
|
/// Get the joint type
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetType")]
|
|
internal static unsafe partial B2JointType GetJointType(B2Joint jointId);
|
|
|
|
/// Get body A id on a joint
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetBodyA")]
|
|
internal static unsafe partial B2Body JointGetBodyA(B2Joint jointId);
|
|
|
|
/// Get body B id on a joint
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetBodyB")]
|
|
internal static unsafe partial B2Body JointGetBodyB(B2Joint jointId);
|
|
|
|
/// Get the world that owns this joint
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetWorld")]
|
|
internal static unsafe partial B2World JointGetWorld(B2Joint jointId);
|
|
|
|
/// Set the local anchor on bodyA
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_SetLocalAnchorA")]
|
|
internal static unsafe partial void JointSetLocalAnchorA(B2Joint jointId, float2 localAnchor);
|
|
|
|
/// Get the local anchor on bodyA
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetLocalAnchorA")]
|
|
internal static unsafe partial float2 JointGetLocalAnchorA(B2Joint jointId);
|
|
|
|
/// Set the local anchor on bodyB
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_SetLocalAnchorB")]
|
|
internal static unsafe partial void JointSetLocalAnchorB(B2Joint jointId, float2 localAnchor);
|
|
|
|
/// Get the local anchor on bodyB
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetLocalAnchorB")]
|
|
internal static unsafe partial float2 JointGetLocalAnchorB(B2Joint jointId);
|
|
|
|
/// Get the joint reference angle in radians (revolute, prismatic, and weld)
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetReferenceAngle")]
|
|
internal static unsafe partial float JointGetReferenceAngle(B2Joint jointId);
|
|
|
|
/// Set the joint reference angle in radians, must be in [-pi,pi]. (revolute, prismatic, and weld)
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_SetReferenceAngle")]
|
|
internal static unsafe partial void JointSetReferenceAngle(B2Joint jointId, float angleInRadians);
|
|
|
|
/// Set the local axis on bodyA (prismatic and wheel)
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_SetLocalAxisA")]
|
|
internal static unsafe partial void JointSetLocalAxisA(B2Joint jointId, float2 localAxis);
|
|
|
|
/// Get the local axis on bodyA (prismatic and wheel)
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetLocalAxisA")]
|
|
internal static unsafe partial float2 JointGetLocalAxisA(B2Joint jointId);
|
|
|
|
/// Toggle collision between connected bodies
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_SetCollideConnected")]
|
|
internal static unsafe partial void JointSetCollideConnected(B2Joint jointId, Bool8 shouldCollide);
|
|
|
|
/// Is collision allowed between connected bodies?
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetCollideConnected")]
|
|
internal static unsafe partial Bool8 JointGetCollideConnected(B2Joint jointId);
|
|
|
|
/// Set the user data on a joint
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_SetUserData")]
|
|
internal static unsafe partial void JointSetUserData(B2Joint jointId, nint userData);
|
|
|
|
/// Get the user data on a joint
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetUserData")]
|
|
internal static unsafe partial void* JointGetUserData(B2Joint jointId);
|
|
|
|
/// Wake the bodies connect to this joint
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_WakeBodies")]
|
|
internal static unsafe partial void JointWakeBodies(B2Joint jointId);
|
|
|
|
/// Get the current constraint force for this joint. Usually in Newtons.
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetConstraintForce")]
|
|
internal static unsafe partial float2 JointGetConstraintForce(B2Joint jointId);
|
|
|
|
/// Get the current constraint torque for this joint. Usually in Newton * meters.
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetConstraintTorque")]
|
|
internal static unsafe partial float JointGetConstraintTorque(B2Joint jointId);
|
|
|
|
/// Get the current linear separation error for this joint. Does not consider admissible movement. Usually in meters.
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetLinearSeparation")]
|
|
internal static unsafe partial float JointGetLinearSeparation(B2Joint jointId);
|
|
|
|
/// Get the current angular separation error for this joint. Does not consider admissible movement. Usually in meters.
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetAngularSeparation")]
|
|
internal static unsafe partial float JointGetAngularSeparation(B2Joint jointId);
|
|
|
|
/// Get the joint constraint tuning. Advanced feature.
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_GetConstraintTuning")]
|
|
internal static unsafe partial void JointGetConstraintTuning(
|
|
B2Joint jointId,
|
|
in float hertz,
|
|
in float dampingRatio
|
|
);
|
|
|
|
/// Set the joint constraint tuning. Advanced feature.
|
|
/// <param name="jointId">the joint </param>
|
|
/// <param name="hertz">the stiffness in Hertz (cycles per second) </param>
|
|
/// <param name="dampingRatio">the non-dimensional damping ratio (one for critical damping) </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2Joint_SetConstraintTuning")]
|
|
internal static unsafe partial void JointSetConstraintTuning(B2Joint jointId, float hertz, float dampingRatio);
|
|
|
|
/// Create a distance joint
|
|
/// SEE: b2DistanceJointDef for details
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateDistanceJoint")]
|
|
internal static unsafe partial B2DistanceJoint CreateDistanceJoint(B2World worldId, in B2DistanceJointDef def);
|
|
|
|
/// Set the rest length of a distance joint
|
|
/// <param name="jointId">The id for a distance joint </param>
|
|
/// <param name="length">The new distance joint length </param>
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_SetLength")]
|
|
internal static unsafe partial void DistanceJointSetLength(B2Joint jointId, float length);
|
|
|
|
/// Get the rest length of a distance joint
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_GetLength")]
|
|
internal static unsafe partial float DistanceJointGetLength(B2Joint jointId);
|
|
|
|
/// Enable/disable the distance joint spring. When disabled the distance joint is rigid.
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_EnableSpring")]
|
|
internal static unsafe partial void DistanceJointEnableSpring(B2Joint jointId, Bool8 enableSpring);
|
|
|
|
/// Is the distance joint spring enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_IsSpringEnabled")]
|
|
internal static unsafe partial Bool8 DistanceJointIsSpringEnabled(B2Joint jointId);
|
|
|
|
/// Set the spring stiffness in Hertz
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_SetSpringHertz")]
|
|
internal static unsafe partial void DistanceJointSetSpringHertz(B2Joint jointId, float hertz);
|
|
|
|
/// Set the spring damping ratio, non-dimensional
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_SetSpringDampingRatio")]
|
|
internal static unsafe partial void DistanceJointSetSpringDampingRatio(B2Joint jointId, float dampingRatio);
|
|
|
|
/// Get the spring Hertz
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_GetSpringHertz")]
|
|
internal static unsafe partial float DistanceJointGetSpringHertz(B2Joint jointId);
|
|
|
|
/// Get the spring damping ratio
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_GetSpringDampingRatio")]
|
|
internal static unsafe partial float DistanceJointGetSpringDampingRatio(B2Joint jointId);
|
|
|
|
/// Enable joint limit. The limit only works if the joint spring is enabled. Otherwise the joint is rigid
|
|
/// and the limit has no effect.
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_EnableLimit")]
|
|
internal static unsafe partial void DistanceJointEnableLimit(B2Joint jointId, Bool8 enableLimit);
|
|
|
|
/// Is the distance joint limit enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_IsLimitEnabled")]
|
|
internal static unsafe partial Bool8 DistanceJointIsLimitEnabled(B2Joint jointId);
|
|
|
|
/// Set the minimum and maximum length parameters of a distance joint
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_SetLengthRange")]
|
|
internal static unsafe partial void DistanceJointSetLengthRange(
|
|
B2Joint jointId,
|
|
float minLength,
|
|
float maxLength
|
|
);
|
|
|
|
/// Get the distance joint minimum length
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_GetMinLength")]
|
|
internal static unsafe partial float DistanceJointGetMinLength(B2Joint jointId);
|
|
|
|
/// Get the distance joint maximum length
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_GetMaxLength")]
|
|
internal static unsafe partial float DistanceJointGetMaxLength(B2Joint jointId);
|
|
|
|
/// Get the current length of a distance joint
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_GetCurrentLength")]
|
|
internal static unsafe partial float DistanceJointGetCurrentLength(B2Joint jointId);
|
|
|
|
/// Enable/disable the distance joint motor
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_EnableMotor")]
|
|
internal static unsafe partial void DistanceJointEnableMotor(B2Joint jointId, Bool8 enableMotor);
|
|
|
|
/// Is the distance joint motor enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_IsMotorEnabled")]
|
|
internal static unsafe partial Bool8 DistanceJointIsMotorEnabled(B2Joint jointId);
|
|
|
|
/// Set the distance joint motor speed, usually in meters per second
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_SetMotorSpeed")]
|
|
internal static unsafe partial void DistanceJointSetMotorSpeed(B2Joint jointId, float motorSpeed);
|
|
|
|
/// Get the distance joint motor speed, usually in meters per second
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_GetMotorSpeed")]
|
|
internal static unsafe partial float DistanceJointGetMotorSpeed(B2Joint jointId);
|
|
|
|
/// Set the distance joint maximum motor force, usually in newtons
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_SetMaxMotorForce")]
|
|
internal static unsafe partial void DistanceJointSetMaxMotorForce(B2Joint jointId, float force);
|
|
|
|
/// Get the distance joint maximum motor force, usually in newtons
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_GetMaxMotorForce")]
|
|
internal static unsafe partial float DistanceJointGetMaxMotorForce(B2Joint jointId);
|
|
|
|
/// Get the distance joint current motor force, usually in newtons
|
|
[LibraryImport(Dll, EntryPoint = "b2DistanceJoint_GetMotorForce")]
|
|
internal static unsafe partial float DistanceJointGetMotorForce(B2Joint jointId);
|
|
|
|
/// Create a motor joint
|
|
/// SEE: b2MotorJointDef for details
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateMotorJoint")]
|
|
internal static unsafe partial B2MotorJoint CreateMotorJoint(B2World worldId, in B2MotorJointDef def);
|
|
|
|
/// Set the motor joint linear offset target
|
|
[LibraryImport(Dll, EntryPoint = "b2MotorJoint_SetLinearOffset")]
|
|
internal static unsafe partial void MotorJointSetLinearOffset(B2Joint jointId, float2 linearOffset);
|
|
|
|
/// Get the motor joint linear offset target
|
|
[LibraryImport(Dll, EntryPoint = "b2MotorJoint_GetLinearOffset")]
|
|
internal static unsafe partial float2 MotorJointGetLinearOffset(B2Joint jointId);
|
|
|
|
/// Set the motor joint angular offset target in radians. This angle will be unwound
|
|
/// so the motor will drive along the shortest arc.
|
|
[LibraryImport(Dll, EntryPoint = "b2MotorJoint_SetAngularOffset")]
|
|
internal static unsafe partial void MotorJointSetAngularOffset(B2Joint jointId, float angularOffset);
|
|
|
|
/// Get the motor joint angular offset target in radians
|
|
[LibraryImport(Dll, EntryPoint = "b2MotorJoint_GetAngularOffset")]
|
|
internal static unsafe partial float MotorJointGetAngularOffset(B2Joint jointId);
|
|
|
|
/// Set the motor joint maximum force, usually in newtons
|
|
[LibraryImport(Dll, EntryPoint = "b2MotorJoint_SetMaxForce")]
|
|
internal static unsafe partial void MotorJointSetMaxForce(B2Joint jointId, float maxForce);
|
|
|
|
/// Get the motor joint maximum force, usually in newtons
|
|
[LibraryImport(Dll, EntryPoint = "b2MotorJoint_GetMaxForce")]
|
|
internal static unsafe partial float MotorJointGetMaxForce(B2Joint jointId);
|
|
|
|
/// Set the motor joint maximum torque, usually in newton-meters
|
|
[LibraryImport(Dll, EntryPoint = "b2MotorJoint_SetMaxTorque")]
|
|
internal static unsafe partial void MotorJointSetMaxTorque(B2Joint jointId, float maxTorque);
|
|
|
|
/// Get the motor joint maximum torque, usually in newton-meters
|
|
[LibraryImport(Dll, EntryPoint = "b2MotorJoint_GetMaxTorque")]
|
|
internal static unsafe partial float MotorJointGetMaxTorque(B2Joint jointId);
|
|
|
|
/// Set the motor joint correction factor, usually in [0, 1]
|
|
[LibraryImport(Dll, EntryPoint = "b2MotorJoint_SetCorrectionFactor")]
|
|
internal static unsafe partial void MotorJointSetCorrectionFactor(B2Joint jointId, float correctionFactor);
|
|
|
|
/// Get the motor joint correction factor, usually in [0, 1]
|
|
[LibraryImport(Dll, EntryPoint = "b2MotorJoint_GetCorrectionFactor")]
|
|
internal static unsafe partial float MotorJointGetCorrectionFactor(B2Joint jointId);
|
|
|
|
/// Create a mouse joint
|
|
/// SEE: b2MouseJointDef for details
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateMouseJoint")]
|
|
internal static unsafe partial B2MouseJoint CreateMouseJoint(B2World worldId, in B2MouseJointDef def);
|
|
|
|
/// Set the mouse joint target
|
|
[LibraryImport(Dll, EntryPoint = "b2MouseJoint_SetTarget")]
|
|
internal static unsafe partial void MouseJointSetTarget(B2Joint jointId, float2 target);
|
|
|
|
/// Get the mouse joint target
|
|
[LibraryImport(Dll, EntryPoint = "b2MouseJoint_GetTarget")]
|
|
internal static unsafe partial float2 MouseJointGetTarget(B2Joint jointId);
|
|
|
|
/// Set the mouse joint spring stiffness in Hertz
|
|
[LibraryImport(Dll, EntryPoint = "b2MouseJoint_SetSpringHertz")]
|
|
internal static unsafe partial void MouseJointSetSpringHertz(B2Joint jointId, float hertz);
|
|
|
|
/// Get the mouse joint spring stiffness in Hertz
|
|
[LibraryImport(Dll, EntryPoint = "b2MouseJoint_GetSpringHertz")]
|
|
internal static unsafe partial float MouseJointGetSpringHertz(B2Joint jointId);
|
|
|
|
/// Set the mouse joint spring damping ratio, non-dimensional
|
|
[LibraryImport(Dll, EntryPoint = "b2MouseJoint_SetSpringDampingRatio")]
|
|
internal static unsafe partial void MouseJointSetSpringDampingRatio(B2Joint jointId, float dampingRatio);
|
|
|
|
/// Get the mouse joint damping ratio, non-dimensional
|
|
[LibraryImport(Dll, EntryPoint = "b2MouseJoint_GetSpringDampingRatio")]
|
|
internal static unsafe partial float MouseJointGetSpringDampingRatio(B2Joint jointId);
|
|
|
|
/// Set the mouse joint maximum force, usually in newtons
|
|
[LibraryImport(Dll, EntryPoint = "b2MouseJoint_SetMaxForce")]
|
|
internal static unsafe partial void MouseJointSetMaxForce(B2Joint jointId, float maxForce);
|
|
|
|
/// Get the mouse joint maximum force, usually in newtons
|
|
[LibraryImport(Dll, EntryPoint = "b2MouseJoint_GetMaxForce")]
|
|
internal static unsafe partial float MouseJointGetMaxForce(B2Joint jointId);
|
|
|
|
/// Create a filter joint.
|
|
/// SEE: b2FilterJointDef for details
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateFilterJoint")]
|
|
internal static unsafe partial B2FilterJoint CreateFilterJoint(B2World worldId, in B2FilterJointDef def);
|
|
|
|
/// Create a prismatic (slider) joint.
|
|
/// SEE: b2PrismaticJointDef for details
|
|
[LibraryImport(Dll, EntryPoint = "b2CreatePrismaticJoint")]
|
|
internal static unsafe partial B2PrismaticJoint CreatePrismaticJoint(
|
|
B2World worldId,
|
|
in B2PrismaticJointDef def
|
|
);
|
|
|
|
/// Enable/disable the joint spring.
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_EnableSpring")]
|
|
internal static unsafe partial void PrismaticJointEnableSpring(B2Joint jointId, Bool8 enableSpring);
|
|
|
|
/// Is the prismatic joint spring enabled or not?
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_IsSpringEnabled")]
|
|
internal static unsafe partial Bool8 PrismaticJointIsSpringEnabled(B2Joint jointId);
|
|
|
|
/// Set the prismatic joint stiffness in Hertz.
|
|
/// This should usually be less than a quarter of the simulation rate. For example, if the simulation
|
|
/// runs at 60Hz then the joint stiffness should be 15Hz or less.
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_SetSpringHertz")]
|
|
internal static unsafe partial void PrismaticJointSetSpringHertz(B2Joint jointId, float hertz);
|
|
|
|
/// Get the prismatic joint stiffness in Hertz
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_GetSpringHertz")]
|
|
internal static unsafe partial float PrismaticJointGetSpringHertz(B2Joint jointId);
|
|
|
|
/// Set the prismatic joint damping ratio (non-dimensional)
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_SetSpringDampingRatio")]
|
|
internal static unsafe partial void PrismaticJointSetSpringDampingRatio(B2Joint jointId, float dampingRatio);
|
|
|
|
/// Get the prismatic spring damping ratio (non-dimensional)
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_GetSpringDampingRatio")]
|
|
internal static unsafe partial float PrismaticJointGetSpringDampingRatio(B2Joint jointId);
|
|
|
|
/// Set the prismatic joint spring target angle, usually in meters
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_SetTargetTranslation")]
|
|
internal static unsafe partial void PrismaticJointSetTargetTranslation(B2Joint jointId, float translation);
|
|
|
|
/// Get the prismatic joint spring target translation, usually in meters
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_GetTargetTranslation")]
|
|
internal static unsafe partial float PrismaticJointGetTargetTranslation(B2Joint jointId);
|
|
|
|
/// Enable/disable a prismatic joint limit
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_EnableLimit")]
|
|
internal static unsafe partial void PrismaticJointEnableLimit(B2Joint jointId, Bool8 enableLimit);
|
|
|
|
/// Is the prismatic joint limit enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_IsLimitEnabled")]
|
|
internal static unsafe partial Bool8 PrismaticJointIsLimitEnabled(B2Joint jointId);
|
|
|
|
/// Get the prismatic joint lower limit
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_GetLowerLimit")]
|
|
internal static unsafe partial float PrismaticJointGetLowerLimit(B2Joint jointId);
|
|
|
|
/// Get the prismatic joint upper limit
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_GetUpperLimit")]
|
|
internal static unsafe partial float PrismaticJointGetUpperLimit(B2Joint jointId);
|
|
|
|
/// Set the prismatic joint limits
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_SetLimits")]
|
|
internal static unsafe partial void PrismaticJointSetLimits(B2Joint jointId, float lower, float upper);
|
|
|
|
/// Enable/disable a prismatic joint motor
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_EnableMotor")]
|
|
internal static unsafe partial void PrismaticJointEnableMotor(B2Joint jointId, Bool8 enableMotor);
|
|
|
|
/// Is the prismatic joint motor enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_IsMotorEnabled")]
|
|
internal static unsafe partial Bool8 PrismaticJointIsMotorEnabled(B2Joint jointId);
|
|
|
|
/// Set the prismatic joint motor speed, usually in meters per second
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_SetMotorSpeed")]
|
|
internal static unsafe partial void PrismaticJointSetMotorSpeed(B2Joint jointId, float motorSpeed);
|
|
|
|
/// Get the prismatic joint motor speed, usually in meters per second
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_GetMotorSpeed")]
|
|
internal static unsafe partial float PrismaticJointGetMotorSpeed(B2Joint jointId);
|
|
|
|
/// Set the prismatic joint maximum motor force, usually in newtons
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_SetMaxMotorForce")]
|
|
internal static unsafe partial void PrismaticJointSetMaxMotorForce(B2Joint jointId, float force);
|
|
|
|
/// Get the prismatic joint maximum motor force, usually in newtons
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_GetMaxMotorForce")]
|
|
internal static unsafe partial float PrismaticJointGetMaxMotorForce(B2Joint jointId);
|
|
|
|
/// Get the prismatic joint current motor force, usually in newtons
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_GetMotorForce")]
|
|
internal static unsafe partial float PrismaticJointGetMotorForce(B2Joint jointId);
|
|
|
|
/// Get the current joint translation, usually in meters.
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_GetTranslation")]
|
|
internal static unsafe partial float PrismaticJointGetTranslation(B2Joint jointId);
|
|
|
|
/// Get the current joint translation speed, usually in meters per second.
|
|
[LibraryImport(Dll, EntryPoint = "b2PrismaticJoint_GetSpeed")]
|
|
internal static unsafe partial float PrismaticJointGetSpeed(B2Joint jointId);
|
|
|
|
/// Create a revolute joint
|
|
/// SEE: b2RevoluteJointDef for details
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateRevoluteJoint")]
|
|
internal static unsafe partial B2RevoluteJoint CreateRevoluteJoint(B2World worldId, in B2RevoluteJointDef def);
|
|
|
|
/// Enable/disable the revolute joint spring
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_EnableSpring")]
|
|
internal static unsafe partial void RevoluteJointEnableSpring(B2Joint jointId, Bool8 enableSpring);
|
|
|
|
/// It the revolute angular spring enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_IsSpringEnabled")]
|
|
internal static unsafe partial Bool8 RevoluteJointIsSpringEnabled(B2Joint jointId);
|
|
|
|
/// Set the revolute joint spring stiffness in Hertz
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_SetSpringHertz")]
|
|
internal static unsafe partial void RevoluteJointSetSpringHertz(B2Joint jointId, float hertz);
|
|
|
|
/// Get the revolute joint spring stiffness in Hertz
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_GetSpringHertz")]
|
|
internal static unsafe partial float RevoluteJointGetSpringHertz(B2Joint jointId);
|
|
|
|
/// Set the revolute joint spring damping ratio, non-dimensional
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_SetSpringDampingRatio")]
|
|
internal static unsafe partial void RevoluteJointSetSpringDampingRatio(B2Joint jointId, float dampingRatio);
|
|
|
|
/// Get the revolute joint spring damping ratio, non-dimensional
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_GetSpringDampingRatio")]
|
|
internal static unsafe partial float RevoluteJointGetSpringDampingRatio(B2Joint jointId);
|
|
|
|
/// Set the revolute joint spring target angle, radians
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_SetTargetAngle")]
|
|
internal static unsafe partial void RevoluteJointSetTargetAngle(B2Joint jointId, float angle);
|
|
|
|
/// Get the revolute joint spring target angle, radians
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_GetTargetAngle")]
|
|
internal static unsafe partial float RevoluteJointGetTargetAngle(B2Joint jointId);
|
|
|
|
/// Get the revolute joint current angle in radians relative to the reference angle
|
|
/// SEE: b2RevoluteJointDef::referenceAngle
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_GetAngle")]
|
|
internal static unsafe partial float RevoluteJointGetAngle(B2Joint jointId);
|
|
|
|
/// Enable/disable the revolute joint limit
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_EnableLimit")]
|
|
internal static unsafe partial void RevoluteJointEnableLimit(B2Joint jointId, Bool8 enableLimit);
|
|
|
|
/// Is the revolute joint limit enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_IsLimitEnabled")]
|
|
internal static unsafe partial Bool8 RevoluteJointIsLimitEnabled(B2Joint jointId);
|
|
|
|
/// Get the revolute joint lower limit in radians
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_GetLowerLimit")]
|
|
internal static unsafe partial float RevoluteJointGetLowerLimit(B2Joint jointId);
|
|
|
|
/// Get the revolute joint upper limit in radians
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_GetUpperLimit")]
|
|
internal static unsafe partial float RevoluteJointGetUpperLimit(B2Joint jointId);
|
|
|
|
/// Set the revolute joint limits in radians. It is expected that lower
|
|
/// <
|
|
/// = upper
|
|
/// and that -0.99 * B2_PI
|
|
/// <
|
|
/// = lower
|
|
/// &
|
|
/// &
|
|
/// upper
|
|
/// <
|
|
/// = -0.99 * B2_PI.
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_SetLimits")]
|
|
internal static unsafe partial void RevoluteJointSetLimits(B2Joint jointId, float lower, float upper);
|
|
|
|
/// Enable/disable a revolute joint motor
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_EnableMotor")]
|
|
internal static unsafe partial void RevoluteJointEnableMotor(B2Joint jointId, Bool8 enableMotor);
|
|
|
|
/// Is the revolute joint motor enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_IsMotorEnabled")]
|
|
internal static unsafe partial Bool8 RevoluteJointIsMotorEnabled(B2Joint jointId);
|
|
|
|
/// Set the revolute joint motor speed in radians per second
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_SetMotorSpeed")]
|
|
internal static unsafe partial void RevoluteJointSetMotorSpeed(B2Joint jointId, float motorSpeed);
|
|
|
|
/// Get the revolute joint motor speed in radians per second
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_GetMotorSpeed")]
|
|
internal static unsafe partial float RevoluteJointGetMotorSpeed(B2Joint jointId);
|
|
|
|
/// Get the revolute joint current motor torque, usually in newton-meters
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_GetMotorTorque")]
|
|
internal static unsafe partial float RevoluteJointGetMotorTorque(B2Joint jointId);
|
|
|
|
/// Set the revolute joint maximum motor torque, usually in newton-meters
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_SetMaxMotorTorque")]
|
|
internal static unsafe partial void RevoluteJointSetMaxMotorTorque(B2Joint jointId, float torque);
|
|
|
|
/// Get the revolute joint maximum motor torque, usually in newton-meters
|
|
[LibraryImport(Dll, EntryPoint = "b2RevoluteJoint_GetMaxMotorTorque")]
|
|
internal static unsafe partial float RevoluteJointGetMaxMotorTorque(B2Joint jointId);
|
|
|
|
/// Create a weld joint
|
|
/// SEE: b2WeldJointDef for details
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateWeldJoint")]
|
|
internal static unsafe partial B2WeldJoint CreateWeldJoint(B2World worldId, in B2WeldJointDef def);
|
|
|
|
/// Set the weld joint linear stiffness in Hertz. 0 is rigid.
|
|
[LibraryImport(Dll, EntryPoint = "b2WeldJoint_SetLinearHertz")]
|
|
internal static unsafe partial void WeldJointSetLinearHertz(B2Joint jointId, float hertz);
|
|
|
|
/// Get the weld joint linear stiffness in Hertz
|
|
[LibraryImport(Dll, EntryPoint = "b2WeldJoint_GetLinearHertz")]
|
|
internal static unsafe partial float WeldJointGetLinearHertz(B2Joint jointId);
|
|
|
|
/// Set the weld joint linear damping ratio (non-dimensional)
|
|
[LibraryImport(Dll, EntryPoint = "b2WeldJoint_SetLinearDampingRatio")]
|
|
internal static unsafe partial void WeldJointSetLinearDampingRatio(B2Joint jointId, float dampingRatio);
|
|
|
|
/// Get the weld joint linear damping ratio (non-dimensional)
|
|
[LibraryImport(Dll, EntryPoint = "b2WeldJoint_GetLinearDampingRatio")]
|
|
internal static unsafe partial float WeldJointGetLinearDampingRatio(B2Joint jointId);
|
|
|
|
/// Set the weld joint angular stiffness in Hertz. 0 is rigid.
|
|
[LibraryImport(Dll, EntryPoint = "b2WeldJoint_SetAngularHertz")]
|
|
internal static unsafe partial void WeldJointSetAngularHertz(B2Joint jointId, float hertz);
|
|
|
|
/// Get the weld joint angular stiffness in Hertz
|
|
[LibraryImport(Dll, EntryPoint = "b2WeldJoint_GetAngularHertz")]
|
|
internal static unsafe partial float WeldJointGetAngularHertz(B2Joint jointId);
|
|
|
|
/// Set weld joint angular damping ratio, non-dimensional
|
|
[LibraryImport(Dll, EntryPoint = "b2WeldJoint_SetAngularDampingRatio")]
|
|
internal static unsafe partial void WeldJointSetAngularDampingRatio(B2Joint jointId, float dampingRatio);
|
|
|
|
/// Get the weld joint angular damping ratio, non-dimensional
|
|
[LibraryImport(Dll, EntryPoint = "b2WeldJoint_GetAngularDampingRatio")]
|
|
internal static unsafe partial float WeldJointGetAngularDampingRatio(B2Joint jointId);
|
|
|
|
/// Create a wheel joint
|
|
/// SEE: b2WheelJointDef for details
|
|
[LibraryImport(Dll, EntryPoint = "b2CreateWheelJoint")]
|
|
internal static unsafe partial B2WheelJoint CreateWheelJoint(B2World worldId, in B2WheelJointDef def);
|
|
|
|
/// Enable/disable the wheel joint spring
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_EnableSpring")]
|
|
internal static unsafe partial void WheelJointEnableSpring(B2Joint jointId, Bool8 enableSpring);
|
|
|
|
/// Is the wheel joint spring enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_IsSpringEnabled")]
|
|
internal static unsafe partial Bool8 WheelJointIsSpringEnabled(B2Joint jointId);
|
|
|
|
/// Set the wheel joint stiffness in Hertz
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_SetSpringHertz")]
|
|
internal static unsafe partial void WheelJointSetSpringHertz(B2Joint jointId, float hertz);
|
|
|
|
/// Get the wheel joint stiffness in Hertz
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_GetSpringHertz")]
|
|
internal static unsafe partial float WheelJointGetSpringHertz(B2Joint jointId);
|
|
|
|
/// Set the wheel joint damping ratio, non-dimensional
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_SetSpringDampingRatio")]
|
|
internal static unsafe partial void WheelJointSetSpringDampingRatio(B2Joint jointId, float dampingRatio);
|
|
|
|
/// Get the wheel joint damping ratio, non-dimensional
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_GetSpringDampingRatio")]
|
|
internal static unsafe partial float WheelJointGetSpringDampingRatio(B2Joint jointId);
|
|
|
|
/// Enable/disable the wheel joint limit
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_EnableLimit")]
|
|
internal static unsafe partial void WheelJointEnableLimit(B2Joint jointId, Bool8 enableLimit);
|
|
|
|
/// Is the wheel joint limit enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_IsLimitEnabled")]
|
|
internal static unsafe partial Bool8 WheelJointIsLimitEnabled(B2Joint jointId);
|
|
|
|
/// Get the wheel joint lower limit
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_GetLowerLimit")]
|
|
internal static unsafe partial float WheelJointGetLowerLimit(B2Joint jointId);
|
|
|
|
/// Get the wheel joint upper limit
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_GetUpperLimit")]
|
|
internal static unsafe partial float WheelJointGetUpperLimit(B2Joint jointId);
|
|
|
|
/// Set the wheel joint limits
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_SetLimits")]
|
|
internal static unsafe partial void WheelJointSetLimits(B2Joint jointId, float lower, float upper);
|
|
|
|
/// Enable/disable the wheel joint motor
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_EnableMotor")]
|
|
internal static unsafe partial void WheelJointEnableMotor(B2Joint jointId, Bool8 enableMotor);
|
|
|
|
/// Is the wheel joint motor enabled?
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_IsMotorEnabled")]
|
|
internal static unsafe partial Bool8 WheelJointIsMotorEnabled(B2Joint jointId);
|
|
|
|
/// Set the wheel joint motor speed in radians per second
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_SetMotorSpeed")]
|
|
internal static unsafe partial void WheelJointSetMotorSpeed(B2Joint jointId, float motorSpeed);
|
|
|
|
/// Get the wheel joint motor speed in radians per second
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_GetMotorSpeed")]
|
|
internal static unsafe partial float WheelJointGetMotorSpeed(B2Joint jointId);
|
|
|
|
/// Set the wheel joint maximum motor torque, usually in newton-meters
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_SetMaxMotorTorque")]
|
|
internal static unsafe partial void WheelJointSetMaxMotorTorque(B2Joint jointId, float torque);
|
|
|
|
/// Get the wheel joint maximum motor torque, usually in newton-meters
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_GetMaxMotorTorque")]
|
|
internal static unsafe partial float WheelJointGetMaxMotorTorque(B2Joint jointId);
|
|
|
|
/// Get the wheel joint current motor torque, usually in newton-meters
|
|
[LibraryImport(Dll, EntryPoint = "b2WheelJoint_GetMotorTorque")]
|
|
internal static unsafe partial float WheelJointGetMotorTorque(B2Joint jointId);
|
|
}
|
|
}
|