
If you want a ray that can touch a specific entity or group of entities (stops after one found), you should tag it/them with mrcd_target, the ray mrcd_entity_targeted and rotate the AEC as the speed direction. You can remove them in entity types tag ( #mrcd:ignore) to change it. Note that some entities like player and projectiles are ignored by default. If it touched an entity, it will have a tag named mrcd_touch_entity, and the target entity will be tagged mrcd_target_entity. If you want a ray that can touch entities (stops after one found), you should tag the ray mrcd_entity and rotate the AEC as the speed direction. If you want a ray that can pass those blocks that a player can pass, you should tag the ray mrcd_bullet.

You can recognize which surface it touched from those tags. If it touches a block, it will have the tags mrcd_touch_edge and mrcd_touch_DIRECTION. These three scoreboards stand for how many milliblocks the ray can fly in three dimensions respectively each time you call function mrcd:ray_tick as the ray. Set scoreboard mrcd_x0, mrcd_y0, mrcd_z0 for any ray (entity used as the ray marker, usually area_effect_cloud or markers).

It defines the hitbox of most blocks and does some calculations to judge which surface will be touched. Minecraft Ray Collision Detector is a super precise raycast system in vanilla minecraft! This datapack solved the raycast problem perfectly with minimal command cost.
