$begingroup$

Downside

In a platformer stage I would like the enemy (purple) to detect the participant (inexperienced) inside a given vary. I’ve this presently working utilizing an overlap circle examine (dotted purple circle). Nevertheless this circle can prolong onto larger platforms however I solely need the participant to be detected whether it is on the identical stage.

Tried Options

  • Checking the Y stage distinction between the participant and enemy.
  • Raycast from the enemy to the participant to examine if there’s a platform between them. This half works as a result of there are instances when the participant is excessive above the enemy however there isn’t a platform between them (e.g. leaping between platforms)

What is a sturdy resolution that I can make use of right here?

Diagram of player and enemy in a level

$endgroup$


It’s essential to
log in to reply this query.