-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
[3.4] move_and_slide() and move_and_slide_with_snap() getting nullptr errors when colliding body is freed #54666
Comments
CC @godotengine/physics |
This behavior should be investigated for |
Judging by the error message, this may be fixed by #54650. |
It does |
What I get with #43650 in this project is a crash. That PR can't reasonably fix this. It may at much silence the first error line, but the second one is natural as long as the physics engine considers it's an error to call
|
I reproduced the issue as well. It happens in Godot 3.4 stable and 3.4 rc3, but not in Godot 3.3.2. |
As a first step and to avoid changing the general behavior for RIDs, I'm thinking of adding a method to the physics server to check if a given RID is valid (similar to what we do on |
After checking the different cases and the code, I'm actually going with @RandomShaper's suggestion to make I'm also going to apply the same thing in 2D and 3D for bodies removed from the scene, since it's currently causing similar errors (and a crash in Godot Physics 3D). Later we can decide if there's a way to solve this kind of situation in a more generic way, but for now it's easy and seems to work well for this case in physics. |
Godot version
3.4
System information
Windows 10, GLES3, Intel i5 4460, NVidia RTX 3060ti
Issue description
When an object that a KinematicBody node is colliding with is freed, the following errors are logged:
This is a frustrating error to encounter when simply trying to change levels, as you must free the level scene before adding a new one, which causes this error. It's not a fatal error, thankfully, but logging it is a tad annoying when there will be a new body in the very next frame.
Steps to reproduce
move_and_slide()
ormove_and_slide_with_snap()
in the_physics_process()
step on a KinematicBody object using typical parameters.queue_free()
on the floor or wall.Minimal reproduction project
floor_free_example.zip
The text was updated successfully, but these errors were encountered: