Description
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
Activity
Raphael2048 commentedon Jul 14, 2019
Unable to reproduce with latest build, seems already fixed.
spkingr commentedon Jul 14, 2019
So how to use the latest API in Godot 3.1 stable version to solve this bug?
Raphael2048 commentedon 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
realkotob commentedon Jul 17, 2019
There are also daily nightly binaries here.
https://hugo.pro/projects/godot-builds/
mcbloch commentedon 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
spkingr commentedon Feb 2, 2020
Fixed in 3.2.
lukepass commentedon 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.
Calinou commentedon Aug 4, 2020
@lukepass Please create a new issue with a minimal reproduction project attached.
lukepass commentedon Aug 4, 2020
@Calinou I uploaded the project and opened a new issue:
#41024
Thanks!