Skip to content
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

Fix errors in CharacterBody when floor is destroyed or removed #54820

Merged

Conversation

pouleyKetchoupp
Copy link
Contributor

In all physics servers, body_get_direct_state() now silently returns null when the body has been already freed or is removed from space, so the client code can detect this state and invalidate the body rid.

In 2D, there is no change in behavior (just no more errors).

In 3D, the Bullet server returned a valid direct body state when the body was removed from the physics space, but in this case it didn't make sense to use the information from the body state.

Fixes #54666 on master.

In all physics servers, body_get_direct_state() now silently returns
nullptr when the body has been already freed or is removed from space,
so the client code can detect this state and invalidate the body rid.

In 2D, there is no change in behavior (just no more errors).

In 3D, the Bullet server returned a valid direct body state when the
body was removed from the physics space, but in this case it didn't
make sense to use the information from the body state.
@pouleyKetchoupp pouleyKetchoupp force-pushed the fix-character-body-floor-errors branch from 722f275 to bfd0d33 Compare November 10, 2021 15:27
@akien-mga akien-mga merged commit c5a99a2 into godotengine:master Nov 10, 2021
@akien-mga
Copy link
Member

Thanks!

@pouleyKetchoupp pouleyKetchoupp deleted the fix-character-body-floor-errors branch November 10, 2021 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[3.4] move_and_slide() and move_and_slide_with_snap() getting nullptr errors when colliding body is freed
2 participants