(Solved) Crusher enemy using Raycasting

So, In my game, I’m trying to make a crusher enemy that uses raying from it’s corners to detect the player.

However, It’s not working. It’s meant to slam down when the player’s x position is equal to one of the bottom corners, and when it’s UNDERNEATH the enemy (Hence the Y position conditions).

(Currently it just changes animation, since I’m trying to get it to detect the player first before I start making the slam down events)

What should I do?

Comparing the X position of Maxiji and the hossod point requires them to be exactly the same. 3.000001 is not the same as 3.00, and so the condition won’t be met.

What I’d do is check whether Maxiji’s X position lies between the two blocks’ X points and is below the block - something like:

AND
Maxiji.CentreX > hossod.PointX("triggerpointdownleft")
Maxiji.CentreX < hossod.PointX("triggerpointdownright")
Maxiji.CentreY > hossod.PointY("triggerpointdownright")

1 Like

THat seemed to have done the trick! thank you! I’ll up date this If i run into anymore trouble.

1 Like