mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-29 14:38:25 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
1 changed files with 784842 additions and 0 deletions
28
Brutal.Jolt/Manual/ContactManifold.cs
Normal file
28
Brutal.Jolt/Manual/ContactManifold.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
namespace Brutal.JoltApi;
|
||||
|
||||
// Jolt's inline world-space accessors, done in C# over the fields the struct already holds rather than a native
|
||||
// call per point. The generator leaves them out (see _manualValueMembers).
|
||||
public partial struct ContactManifold
|
||||
{
|
||||
/// <summary>The world-space position of contact point <paramref name="index"/> on shape 1.</summary>
|
||||
/// <exception cref="ArgumentOutOfRangeException">The index is at or past the live contact point count.</exception>
|
||||
public readonly float3 GetWorldSpaceContactPointOn1(uint index) =>
|
||||
BaseOffset + PointAt(in RelativeContactPointsOn1, index, "contact points on shape 1");
|
||||
|
||||
/// <summary>The world-space position of contact point <paramref name="index"/> on shape 2.</summary>
|
||||
/// <exception cref="ArgumentOutOfRangeException">The index is at or past the live contact point count.</exception>
|
||||
public readonly float3 GetWorldSpaceContactPointOn2(uint index) =>
|
||||
BaseOffset + PointAt(in RelativeContactPointsOn2, index, "contact points on shape 2");
|
||||
|
||||
// Only the first Size slots are live, so the bound is the count rather than the 64-slot capacity
|
||||
private static float3 PointAt(in StaticArrayVec3_64 points, uint index, string what)
|
||||
{
|
||||
if (index >= points.Size)
|
||||
throw new ArgumentOutOfRangeException(
|
||||
nameof(index),
|
||||
index,
|
||||
$"Expected an index below the number of {what}."
|
||||
);
|
||||
return points.Elements[(int)index].XYZ;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue