How do I use raycasts for line of sight?

I’m trying to make a grappling hook action in an extension, using the “ray cast to position” condition.

It’s supposed to send a ray cast from mochi/the player to the enemy/hook, and not activate if theres anything between them. But it doesn’t do that, even if theres a wall or something in between, it applies the force.

What am i missing???

You need to put all the objects that can get in the way, plus the enemy/hook, into an object group. You then raycast against that object group. The raycast will return the first object from that group which it hits.

Then check that object’s name is that of the enemy/hook.

Here’s a previous thread on how to do this. Ignore the raycast into the screen part, it’s the solution with the screen shots that you’re interested in.

This works perfectly. Thank you!