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

Removing a CollisionShape or CollisionPolygon from a sleeping RigidBody at runtime breaks gravity in Bullet physics #40739

Closed
hoontee opened this issue Jul 27, 2020 · 2 comments · Fixed by #40989

Comments

@hoontee
Copy link
Contributor

hoontee commented Jul 27, 2020

Godot version:
3.2.3.rc1

OS/device including version:
Windows 10 2004

Issue description:
When removing a CollisionShape or CollisionPolygon from a sleeping RigidBody at runtime with the Bullet physics engine, its gravity stops working.
Does not occur with GodotPhysics.

Steps to reproduce:
Create a RigidBody with a CollisionShape, set sleeping to true, then attach the following script:

extends RigidBody

func _ready():
	var collision_shape = $CollisionShape
	add_child(collision_shape.duplicate())
	collision_shape.queue_free()

In this case, queue_free frees the old CollisionShape after Bullet initializes the physics body. It can be mitigated by calling free instead of queue_free.

Minimal reproduction project:
Physics.zip

@hoontee hoontee changed the title Removing the CollisionShape or CollisionPolygon from a sleeping RigidBody breaks gravity in Bullet physics Calling queue_free on the CollisionShape or CollisionPolygon from a sleeping RigidBody breaks gravity in Bullet physics Jul 27, 2020
@hoontee hoontee changed the title Calling queue_free on the CollisionShape or CollisionPolygon from a sleeping RigidBody breaks gravity in Bullet physics Removing a CollisionShape or CollisionPolygon from a sleeping RigidBody at runtime breaks gravity in Bullet physics Jul 27, 2020
@hoontee
Copy link
Contributor Author

hoontee commented Aug 2, 2020

Not reproducible in 3.2.3.rc3. (Fixed by reverting #40185?)

@madmiraal
Copy link
Contributor

Reopening, because I can reproduce this issue in both master (bc813fd) and 3.2.3.rc3 by delaying the replacement of the CollisionShape by one physics frame.

MRP 4.0: 40739-4.0.zip
MRP 3.2: 40739-3.2.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants