Detecting if Node hits another one

Godot Version

4.3

Question

Hello, I’m working on a fishing game. I have made a prototype fishing hook as shown here:


The hook is controlled by Player1 script in Stats. It can move around like this while also extending. The current size is the max extend length, I will figure out the min later:

This is what the pond looks like with fish:

I think I can figure out making the hook extend/unextend and move around, my main issue is the collision detection. How can I make it so when the player presses the button to cast, it will see if there is a fish currently touching the hook. The hook has layer 3 with mask 1, while the fishes have layer 1 with mask 2.

My idea would be to set an area2d for the hook instead. Area 2d can track when an object enters and exits. So a script can be attach to it that stores an array of fish that are in the area which updates over time. Then when cast button is pressed just check whats in the array

1 Like

I second this answer, it seems the best to me. Looking forward to seeing the fish game fish-eshed (haha0=). That water looks cool

I stole the water picture from online

still looks cool