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

The Rigidbody2D cannot rotate after set the CollisionShape2D disabled first and enabled later #30551

Closed
spkingr opened this issue Jul 13, 2019 · 9 comments

Comments

@spkingr
Copy link

@spkingr spkingr commented Jul 13, 2019

The Rigidbody2D cannot rotate if you disable the collision shape and then enable it again. But it's fine if you do nothing to the collision shape.

Godot version:
3.1.1

OS/device including version:
Windows 10

Issue description:
The rotation by apply_torque_impulse of the RigidBody2D may work incorrectly in Godot 3.1.1.
If you never disable the collision shape of the RigidBody2D, everything is normal, but if you first disable the shape use $CollisionShape2D.set_deferred('disabled', true) then after some events trigger and set it enabled with $CollisionShape2D.set_deferred('disabled', false), then the rotation looks like "broken", the node can only work with apply_central_impulse but no effect with apply_torque_impulse now.

Steps to reproduce:

func _ready():
	$CollisionShape2D.set_deferred('disabled', false)

The code above works fine, but you cannot rotate with the code below:

func _ready():
	$CollisionShape2D.set_deferred('disabled', true)
	yield(get_tree().create_timer(3), 'timeout')
	$CollisionShape2D.set_deferred('disabled', false)

This is not the actual code but for the test is enough, and I upload the very little represented project in Github: https://github.com/spkingr/test-git/tree/master/SpaceShipRotation

Minimal reproduction project:
https://github.com/spkingr/test-git/tree/master/SpaceShipRotation

The images:
cannot rotate image
normal rotation image

@Raphael2048
Copy link
Contributor

@Raphael2048 Raphael2048 commented Jul 14, 2019

Unable to reproduce with latest build, seems already fixed.

Loading

@spkingr
Copy link
Author

@spkingr spkingr commented Jul 14, 2019

Unable to reproduce with latest build, seems already fixed.

So how to use the latest API in Godot 3.1 stable version to solve this bug?

Loading

@Raphael2048
Copy link
Contributor

@Raphael2048 Raphael2048 commented Jul 14, 2019

Not stable version, just built with latest master source code. See here to build it https://docs.godotengine.org/en/3.1/development/compiling/index.html

Loading

@asheraryam
Copy link
Contributor

@asheraryam asheraryam commented Jul 17, 2019

There are also daily nightly binaries here.
https://hugo.pro/projects/godot-builds/

Loading

@mcbloch
Copy link

@mcbloch mcbloch commented Oct 6, 2019

Had the same issue disabling and enabling the collision shape. I can confirm that it is fixed on a nightly build.
Extra information should this be usefull:
Godot Engine v3.2.alpha.calinou.1d9233c38
OpenGL ES 3.0 Renderer: GeForce GTX 970M/PCIe/SSE2

Loading

@spkingr spkingr closed this Feb 2, 2020
@spkingr
Copy link
Author

@spkingr spkingr commented Feb 2, 2020

Fixed in 3.2.

Loading

@akien-mga akien-mga added this to the 3.2 milestone Feb 5, 2020
@lukepass
Copy link

@lukepass lukepass commented Aug 4, 2020

Hello, I am using the version 3.2.2 and I have exactly the same problem. I cannot apply torque forces when the collision shape is disabled. Any solution?

Thanks.

Loading

@Calinou
Copy link
Member

@Calinou Calinou commented Aug 4, 2020

@lukepass Please create a new issue with a minimal reproduction project attached.

Loading

@lukepass
Copy link

@lukepass lukepass commented Aug 4, 2020

@Calinou I uploaded the project and opened a new issue:

#41024

Thanks!

Loading

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

Successfully merging a pull request may close this issue.

None yet
8 participants