Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sources/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>
<!-- Runtime dependencies -->
<ItemGroup>
<PackageVersion Include="BepuPhysics" Version="2.5.0-beta.25" />
<PackageVersion Include="BepuPhysics" Version="2.5.0-beta.27" />
<PackageVersion Include="DotRecast.Core" Version="2025.2.1" />
<PackageVersion Include="DotRecast.Detour" Version="2025.2.1" />
<PackageVersion Include="DotRecast.Recast" Version="2025.2.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public bool ShouldPerformPhysicsTest(CollisionMask mask, CollidableReference col
public bool RayCast(in Vector3 origin, in Vector3 dir, float maxDistance, out HitInfo result, CollisionMask collisionMask = CollisionMask.Everything)
{
var handler = new RayClosestHitHandler(this, collisionMask);
Simulation.RayCast(origin.ToNumeric(), dir.ToNumeric(), maxDistance, ref handler);
Simulation.RayCast(origin.ToNumeric(), dir.ToNumeric(), maxDistance, BufferPool, ref handler);
if (handler.HitInformation.HasValue)
{
result = handler.HitInformation.Value;
Expand Down Expand Up @@ -397,7 +397,7 @@ public unsafe ConversionEnum<ManagedConverter, HitInfoStack, HitInfo> RayCastPen
fixed (HitInfoStack* ptr = &buffer[0])
{
var handler = new RayHitsStackHandler(ptr, buffer.Length, this, collisionMask);
Simulation.RayCast(origin.ToNumeric(), dir.ToNumeric(), maxDistance, ref handler);
Simulation.RayCast(origin.ToNumeric(), dir.ToNumeric(), maxDistance, BufferPool, ref handler);
return new (buffer[..handler.Head], new ManagedConverter(this));
}
}
Expand All @@ -414,7 +414,7 @@ public unsafe ConversionEnum<ManagedConverter, HitInfoStack, HitInfo> RayCastPen
public void RayCastPenetrating(in Vector3 origin, in Vector3 dir, float maxDistance, ICollection<HitInfo> collection, CollisionMask collisionMask = CollisionMask.Everything)
{
var handler = new RayHitsCollectionHandler(this, collection, collisionMask);
Simulation.RayCast(origin.ToNumeric(), dir.ToNumeric(), maxDistance, ref handler);
Simulation.RayCast(origin.ToNumeric(), dir.ToNumeric(), maxDistance, BufferPool, ref handler);
}

/// <summary>
Expand Down Expand Up @@ -622,7 +622,7 @@ private unsafe void OverlapInner<TShape, TCollector>(in TShape shape, in SRigidP

try
{
Simulation.BroadPhase.GetOverlaps(boundingBoxMin, boundingBoxMax, ref broadPhaseEnumerator);
Simulation.BroadPhase.GetOverlaps(boundingBoxMin, boundingBoxMax, BufferPool, ref broadPhaseEnumerator);

var batcher = new CollisionBatcher<BatcherCallbacks<TCollector>>(BufferPool, Simulation.Shapes, Simulation.NarrowPhase.CollisionTaskRegistry, 0, new()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,6 @@ internal void RayTest<TRayHitHandler>(
if (ShapeIndex.Exists == false || Simulation is null)
return;

Collider.RayTest(Simulation.Simulation.Shapes, ShapeIndex, Pose!.Value, new RayData { Origin = origin, Direction = dir }, ref maximumT, ref hitHandler);
Collider.RayTest(Simulation.Simulation.Shapes, ShapeIndex, Pose!.Value, new RayData { Origin = origin, Direction = dir }, ref maximumT, ref hitHandler, Simulation.BufferPool);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,16 @@ void ICollider.AppendModel(List<BasicMeshBuffers> buffer, ShapeCacheSystem shape
}
}

void ICollider.RayTest<TRayHitHandler>(Shapes shapes, TypedIndex shapeIndex, in NRigidPose pose, in RayData ray, ref float maximumT, ref TRayHitHandler hitHandler)
void ICollider.RayTest<TRayHitHandler>(Shapes shapes, TypedIndex shapeIndex, in NRigidPose pose, in RayData ray, ref float maximumT, ref TRayHitHandler hitHandler, BufferPool pool)
{
if (shapeIndex.Type == Compound.TypeId)
{
shapes.GetShape<Compound>(shapeIndex.Index).RayTest(pose, in ray, ref maximumT, shapes, ref hitHandler);
shapes.GetShape<Compound>(shapeIndex.Index).RayTest(pose, in ray, ref maximumT, shapes, pool, ref hitHandler);
}
else
{
Debug.Assert(shapeIndex.Type == BigCompound.TypeId);
shapes.GetShape<BigCompound>(shapeIndex.Index).RayTest(pose, in ray, ref maximumT, shapes, ref hitHandler);
shapes.GetShape<BigCompound>(shapeIndex.Index).RayTest(pose, in ray, ref maximumT, shapes, pool, ref hitHandler);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ bool ICollider.TryAttach(Shapes shapes, BufferPool pool, ShapeCacheSystem shapeC
return true;
}

void ICollider.RayTest<TRayHitHandler>(Shapes shapes, TypedIndex shapeIndex, in NRigidPose pose, in RayData ray, ref float maximumT, ref TRayHitHandler hitHandler)
void ICollider.RayTest<TRayHitHandler>(Shapes shapes, TypedIndex shapeIndex, in NRigidPose pose, in RayData ray, ref float maximumT, ref TRayHitHandler hitHandler, BufferPool pool)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ internal void RayTest<TRayHitHandler>(
in NRigidPose pose,
in RayData ray,
ref float maximumT,
ref TRayHitHandler hitHandler)
ref TRayHitHandler hitHandler,
BufferPool pool)
where TRayHitHandler : struct, IShapeRayHitHandler;
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ void ICollider.AppendModel(List<BasicMeshBuffers> buffer, ShapeCacheSystem shape
cacheOut = cache;
}

void ICollider.RayTest<TRayHitHandler>(Shapes shapes, TypedIndex shapeIndex, in NRigidPose pose, in RayData ray, ref float maximumT, ref TRayHitHandler hitHandler)
void ICollider.RayTest<TRayHitHandler>(Shapes shapes, TypedIndex shapeIndex, in NRigidPose pose, in RayData ray, ref float maximumT, ref TRayHitHandler hitHandler, BufferPool pool)
{
Debug.Assert(shapeIndex.Type == Mesh.TypeId);
shapes.GetShape<Mesh>(shapeIndex.Index).RayTest(pose, in ray, ref maximumT, ref hitHandler);
shapes.GetShape<Mesh>(shapeIndex.Index).RayTest(pose, in ray, ref maximumT, pool, ref hitHandler);
}
}
Loading