0 votes

Problem found in version 3.2.2 in Windows 10.

I was developing a project and I was having a problem with the movement of enemies that I posed in various ways until one day I decided to activate the collision forms to see what was happening on screen and it turns out that the Raycasts at a certain point and for some strange reason start popping as if they stop detecting collisions, so that's where the problem really was, that the Raycasts stop working.

There's no need to share code because it's not the code, but at some point and for some strange reason, they just stop working.

Here I share some screenshots, first when you start the game, everything is fine, you can see how the Raycasts are in red and work properly.

Capture 1

But as soon as things start to happen on screen, it starts that popping and it doesn't detect collisions anymore.

Capture 2

The ones below are normally not detecting collisions, but notice that the enemies on the top row should detect them and no longer do.

I'm sure it's a Godot bug, I've also posted it on GitHub to report it, in case you're interested: https://github.com/godotengine/godot/issues/40952

But for now, can you think of another way to detect Raycast-like behavior without using Raycast?

EDIT: I found the problem. It's not when anything happens, but one thing in particular: When the ball moves.

The ball is not a RigidBody (I don't like the behaviour of physics very much and it's difficult to adapt it to my tastes) but a KinematicBody that moves with move and collide, I've been looking for and correcting myself if I'm wrong but I've researched and read other people who indicate that when they have a Raycast touching the ground while moving the node with move and slide or move and collide the Raycasts start giving wrong behaviours, that's when I said "it's true! the ball moves with move and collide!"

I just tried a RigidBody and indeed, the fault does not occur. Anyway, it wasn't just about fixing the problem in my project, but about fixing the problem in Godot in general because after that I think I can say that we are actually facing a pretty important problem.

I have also commented it in GitHub where I share the project so that they revise it because now I believe to be able to affirm with total security that it is a problem of the Raycast with move and slide/move and collide.

in Engine by (14 points)
edited by

Its strange because i use raycast in my games and this never happened to me. Anyways, in github they will probably ask you for a projecto to reproduce it, although it isn't in the code. I just tried some raycast for like 20minutes right now, and they keep reporting ok. Would you mind sharing a minimal project to reproduce this?

Exactly, it's rare, that's why I report it and can share details, like if I leave 2 or 3 enemies on screen from the beginning the Raycasts work perfectly, but when I add more quantity and things start to happen on screen the raycasts stop working. I've tried turning them off and on only when something specific has to happen, but the exact same thing happens so I could only say that the problem is that Godot starts to fail to detect collisions with Raycasts when there are a large number of them on screen and several things happen at the same time.

Sharing the project is complicated because I intended it to be a commercial project and I would have to share the work done so in any case I would have to do a regression and return it to a more primitive state in order to share it, anyway if that helps I do it.

Yeah, i understand. But if you dont provide the devs a project to reproduce it, or detailed steps to do so, they wont be able to find the issue (unless lucky). A good idea sometimes is to make another minimal project reproducing the same issue.

Of course, if I can understand that and indeed in GitHub it is what I have been asked for, a small example of the project where you can see the bug to try to correct it. I'm going to prepare it and upload it directly to GitHub, it's that if as I say I speak from ignorance but I suspect and I'm almost sure that the problem is due to the great number of Raycasts on screen, These work well as long as not much happens on screen but as soon as things start happening on screen (and a ball bouncing at high speed can make a lot of things happen in a matter of tenths of a second) the calculations of the Raycast component in general are broken, as this is not an isolated case, but when it happens, it happens to everyone, no matter the node or what that node did.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.