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

Open
spkingr opened this issue Jul 13, 2019 · 4 comments

Comments

@spkingr
Copy link

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

@raphael10241024

This comment has been minimized.

Copy link
Contributor

commented Jul 14, 2019

Unable to reproduce with latest build, seems already fixed.

@spkingr

This comment has been minimized.

Copy link
Author

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?

@raphael10241024

This comment has been minimized.

Copy link
Contributor

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

@asheraryam

This comment has been minimized.

Copy link
Contributor

commented Jul 17, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.