Bookshelf icon indicating copy to clipboard operation
Bookshelf copied to clipboard

Raycast doesn't always stop at the nearest contact point when using both blocks and entities

Open aksiome opened this issue 7 months ago β€’ 0 comments

πŸ”’ Version

v3.0.2

πŸ” Related Feature

#bs.raycast:run

βœ… Expected Behavior

The raycast should stop at the nearest contact point, regardless of whether it’s a block or an entity.

❌ Actual Behavior

In certain edge cases, when an entity’s hitbox is inside a block and the block's collision shape is smaller (i.e., would be contacted later based on distance), the raycast prioritizes the block over the entity, even if the entity is technically closer.

πŸ” Steps to Reproduce

No response

πŸ’‘ Possible Fix

A potential fix could be to gather all potential collision distances, both from blocks and entities, and then process only the nearest one (or sort them if piercing is enabled).

aksiome avatar May 20 '25 15:05 aksiome