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

Changing radius of RigidBody2D's shape ignores Area2D gravity #33766

Open
Tracked by #45334
bram-dingelstad opened this issue Nov 20, 2019 · 2 comments
Open
Tracked by #45334

Changing radius of RigidBody2D's shape ignores Area2D gravity #33766

bram-dingelstad opened this issue Nov 20, 2019 · 2 comments

Comments

@bram-dingelstad
Copy link

Godot version:
v3.2.beta1.official

OS/device including version:
Ubuntu 18.04.3 LTS

Issue description:
When changing the radius of a RigidBody2D's CircleShape2D, an Area2D's gravity is ignored.

(Apologies for low frame rate recording)

The yellow circle is the Area2D in the minimal reproduction project, the red circle is the RigidBody2D. Issue might be related to #33369 and #19271 as I also ran into those while running into this issue.

Also doesn't work when trying to use with non-gravity point Area2D.
Also doesn't work when using non CircleShape2D shapes for the Area2D.

Steps to reproduce:

  1. Create a RigidBody2D node with a CircleShape2D for a shape that dynamically grows
  2. Create an Area2D node with Gravity Point enabled and Space Override set to Replace
  3. Let RigidBody2D grow inside of Area2D to observe effect

Minimal reproduction project:
minimal-reproduction-project.zip

@bram-dingelstad
Copy link
Author

Let me know if there's anything I can do to help!

@tom-jk
Copy link

tom-jk commented Aug 7, 2020

Testing on linux mint 18.3.
Can reproduce in 3.2.beta1, 3.2.3.rc3.

If you connect the Area2D's body_entered and body_exited signals to functions that print "entered"/"exited", you'll see that a resize causes the player to exit, and resizes on successive frames keep it from re-entry.

First, you should really only interact with physics in a _physics_process function, not a _process function (but that doesn't make a practical difference here).

If you replace

$CollisionShape2D.shape.radius = size

with

$CollisionShape2D.shape.set_deferred("radius", size)

the problem is resolved.

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

No branches or pull requests

3 participants