Raytrace through blocks to find entities

Started by lt.wret on

Topic category: Help with modding (Java Edition)

Last seen on 18:42, 23. Apr 2024
Joined Apr 2020

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Raytrace through blocks to find entities

I'm currently working on a scan system, the idea is you can scan in a line directly where you are looking and any entities with-in this line are scanned. Additionally I want this scan to penetrate blocks (allowing you to scan through caves etc.)

For a reference point see "Seer's tactical scan ability from Apex Legends"



I've attempted using just a "does entity exist at: ray trace xyz" and apply glow however this means that the ray trace will go through entities and not scan them, won't pierce blocks and must be aimed at the block under an entity for a successful scan.

One idea I had was to work out where the player is facing and then run a does entity exist at 3 blocks away with a radius of 3, then check again at 6, 9, 12, 15. But I don't know how to work out where they are facing and then move forward from that position.


Any solutions or ideas appreciated, thanks <3