Raycast not finding anything / even executing (Solved)

Before proceeding, please use the forum search feature at the top of the page to check if your question has already been answered.


How do I…

I am trying to create a boardgame that checks if a player already is on a circle to their right (using raycast). I have added in a scanline to try and mimic what the raycast is hitting.

What is the expected result

Player1 details populated into player1 variable

Explain what should happen when you run the game.

What is the actual result

Nothing Raycast doesn’t even run!!

Where are you raycasting from? This event:

image

will only raycast once, and most likely from the first circle_hit added to the scene.

I think you want to make is a subevent of the previous event.

thanks Mr Men,

I’ve added it to the subevent, however the raycast still isn’t triggering, any thoughts on why I’m not seeing any code which shows “raycast2” in the section?


As it stands, the “Circle is in collision with player1” filters the set of player1 objects that GDevelop uses in the subevents to that one player1 event. The raycast is only testing against that one player1 object, not all of them

To fix this, put a “Pick all player1 objects” condition in the same event, but before the raycast.




Thanks I’ve tried both ways and it seems raycasting just isn’t working, perhaps I’m not using the function correctly or something. I’ve read as much doco and looked at others code and the YouTube videos …just about to give up after a month or so of trying to get this basic thing to work

You didn’t implement my instructions correctly. Put the “Pick all player1 objects” in the same event as the raycast. Not as a separate parent event:

I just want to say i hate raycast

thank you I think this has fixed it