Pls can you tell me how to hide it, im trying it but I cant.
I thought you were very close. Something like this should work. I added an action just to set the name of the object to the text object just for testing. Just put the target objects in the group.
This is in 2D. the objects are draggable and I added a shapePainter just to show where the ray was hitting. For this project, group is a group containing objects “wall” and “b”
https://games.gdevelop-app.com/game-7fa54ad1-88a5-49c6-9a48-78b0b1ac99ef/index.html
If you’re still having problems, just post your current code.