-
-
Notifications
You must be signed in to change notification settings - Fork 20.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raycast Node stops detecting collisions #40952
Comments
Might help with a tiny example project so devs can trigger it and fix it |
I have the project somewhat advanced, I'm going to prepare a primitive version of the project where you can appreciate the error so you can have it as a reference. I'm talking about the lack of knowledge but I have the suspicion that the problem comes from the amount of Raycasts that are on the screen simultaneously and the problem is not solved by activating and deactivating the Raycasts at the right time, on the other hand if there are only 2 or 3 enemies as I say it works perfectly, that's for sure, as long as they are 2 or 3 from the beginning because if from the beginning there are many and they are reduced to 2 or 3, once the Raycasts start to fail they don't work correctly again in the course of the game. Edit: I just uploaded it, edit the first comment and the link appears until the end, I hope it helps because if it's a problem with the Raycasts, I think the functioning of the Raycasts is of vital importance for almost any project. |
Yeah, I actually forgot to mention that. I tried it in version 3.0.6 (to be tested) and obviously it didn't open the project in this version, but it did from version 3.1.2 and the problem persists although at least the inconvenience is already located: The Raycasts are not good friends of the KinematicBodies who make use of the move and collide / move and slide methods and it seems that this is happening since several versions back. |
@Calinou It's not about reporting a problem with my project, it's about reporting a problem with Godot, if the Issue is closed it won't have visibility and they won't even try to review it. It must be open so that it can be seen and reviewed, that's why I uploaded the project. |
@akien-mga An apology for being insistent but if I don't insist, you won't see the problem and I think it's an undetected problem but one that you can check when you download the project I uploaded. I have tried several solutions but the problem is always the same: The Raycasts don't work in certain cases, as they don't detect the collision because of that "popping" the collision returns false and I can keep going over it to change the condition and force it to require a true, but it's not about solving the problem in my project, but that the Raycast nodes work correctly so that I don't have to resort to tricks, because honestly and after so much time thinking about it until the failure is detected, I have even considered the idea of redoing the project with Unity because it is complicated to deal with failures that escape my hands (since I am not an expert and I cannot solve engine problems on my own). Edit: I have to add that the problem persists even in the RC versions of 3.2.3, since as a desperate measure I tried to test the RC to see if by chance it didn't happen in these, but yes, it also happens. |
CC @madmiraal |
@xavierocampos This is related to #41031. You have at least one In the Test Project the |
@madmiraal I thank you very much for the answer, yes, the objects that have a scale of 0, 0, 0 is because they have an AnimationPlayer node to hide/show them, but as I understand from what you say even if during the execution of the game the scale changes from 0 to 1 that affects something and preferably we should avoid touching the scale, right? I'm going to try it in the same Test Project to not alter the original project and see if it works well. Update: I've just updated the test project correcting those details you mentioned and I think it's correct, I tried a couple of times and it seems to be solved so I thank you again although it's not weird? I mean it's good to know that detail to avoid problems, but if the scale affects so much to other components wouldn't it be better to eliminate the transform scale? As I say I speak from ignorance, I'm learning and every new thing I learn is very grateful and is a step further, but I think that leaving an option that use it can give problems is only giving the option to the developer to cause these problems, of course if there is a powerful reason to leave the transform then I better shut up hehe Update 2: There, I think I understood better after spending some time testing just to understand how it worked. Yes, it does make sense to scale, I can scale a mesh and nothing happens, I can scale a spatial, but not scale physical nodes. Definitely a lesson learned, thanks! |
No, you do can touch the scale but you should generally avoid scaling to 0,0,0 and you should definitely NOT scale physics bodies. |
Yes, thank you, I will certainly take that as a lesson learned without a doubt. |
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.
But as soon as things start to happen on screen, it starts that popping and it doesn't detect collisions anymore.
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 share with you an example project so you can review it, with the visible collision forms move with the direction keys of the keyboard and shoot the ball with the space key, you will see how the calculations of the Raycasts are broken at some point and they stop working.
Test Project
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.
EDIT 2: New correction, it keeps happening even if you put the ball as RigidBody, it happens less, but it keeps happening because finally the player is a KinematicBody and it moves with move and slide... I definitely think this problem is a mess...
The text was updated successfully, but these errors were encountered: