[Solved] Raycast not detecting when against group

I’ve run into a problem with using a Raycast to detect objects and change a variable. For the life of me I cannot figure it out, although I’m sure I’m missing something key.

My intention is to use Raycast to detect rooms while generating a random “dungeon” floor.

My expectation is as follows in this example: if 2 way Hallway exists, it will use raycast to check if there is a room to the left and right, if it detects a room, it will do nothing, if it does not detect a room, it will spawn a randomly chosen room. And thus the next room will continue with the same logic.

Allow me to set up the details to fully understand what I have done.

-I have several individual types of rooms
-Each individual room has a variable that is relative to its possible directions,
for example: a up&down hallway, will have 2 variables: “room detected up” and “room detected down”. Both are Boolean and set to False as default.
-I have a group for all these rooms…its called Rooms.
-I then have a condition to create a Raycast from the center of the up&down hall, angled at 90, against “Rooms” (the group). The action would then be to change the variable “room detected down” to true.
-otherwise it will remain false, and proceed to create a room at whatever coordinate I desire.

One unusual thing I have noticed, is that when I change the raycast from against “rooms” to against “Left&Right Hall” or any other hall individually, it works as intended. It doesn’t like detecting the group for what ever reason.

What am I missing?

Please and Thank you


The “true” are just text, indicating the status of the variable “room up detected” and “room down detected”. as you can see, its detecting true even though nothing is there.


as you can see, if I place a room above, the variable “room detected up” is now false.

If HallUpDown is in Rooms, the raycast will detect the HallUpDown object itself. To fix this, start the raycast from outside the object.

I think I did what you suggested, and for some reasons I am still having problems. (yes the HallUpDown is in the group “Rooms”)

I created two new points for the object, both of which are outside of the object itself.

I then changed the raycast to be cast from these two points outside of the object, instead of the center.

however, the raycast is not detecting anything related to the group “Rooms”

so I tried a few things
Raycast against “Rooms” - still doesnt work
Raycast against “HallLeftRight” directly - does not work
Raycast against “Players” (a different group) - WORKS!

So the issue seems to be tied to the group and objects that are related to it.
could it be, because the group “Rooms” also has the variables of the objects?
(Gdevelop automatically gave the group the variables of the objects being put in the group.)

Looking a bit closer at the issue, I think another problem is HallUpDown is part of Rooms. When iterating over HallUpDown, the available Room objects are limited to just that one. As a result, the raycast only checks for collisions with itself and won’t detect other Room objects.

A way to fix this is to store the raycast origin in variables first. Then, in the next event, pick all Room objects and raycast from the stored position.

My apologies for the late reply, I just wanted to say thank you for the assistance in trying to figure this out.

I believe a major problem with this setup, was as you stated, using an object within a group to raycast against the other objects in the very same group was posing a major conflict in its detection capabilities.

I instead did a slight work around by using a separate object attached to each room via a external layout. This object was then able to be used as a detector for collision or even to use the Raycast from, since it was not part of the same group.

all in all, thank you again, your advice did get me thinking in different directions.

1 Like