-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Crash when activating/disabling CollisionShape2D in various cases #11695
Comments
Would be interested to know workarounds. Needed for stuff like having a smaller collision box when crouched. |
Can you live with using a single collider? As a workaround you might try simply set the extents of your collider to match what you want it to be on crouch, and then revert the extents once you leave the crouch state. You can even use the animator for this to synchronize the colliders with your sprite frame by frame. |
Hmm, forgot how much you can animate in Godot. I didn't find a way of changing the extents in the API, but I'll give it a try animating it! |
Assuming you are working with a RectangleShape2D you should be able to do the following from the script (though I do find the animator nicer to work with since its intuitive to overlay over your sprites): myCollisionShape2D.get_shape().set_extents(my_new_extents) https://godot.readthedocs.io/en/latest/classes/class_rectangleshape2d.html#class-rectangleshape2d EDIT: And similarly for CapsuleShape2D in your case: myCollisionShape2D.get_shape().set_radius(my_new_radius) https://godot.readthedocs.io/en/latest/classes/class_capsuleshape2d.html#class-capsuleshape2d |
Hey! I'm trying to fix this one, I'll comment again if I find anything useful. |
Fix wrong col_obj access using wrong index variable.
Fix wrong col_obj access using wrong index variable. Related with issue godotengine#11695
Fixed by #12757. |
Operating system or device, Godot version, GPU Model and driver (if graphics related):
Godot 3.0, recent Calinou build from 27/09
Issue description:
Using move_and_slide on a KinematicBody2D in combination with disabling a CollisionShape2D and enabling another crashes when the KinematicBody2D hits the a surface.
Steps to reproduce:
Link to minimal example project:
Use button 'space' to activate/disable the colliders.
Crash with colliders.zip
The text was updated successfully, but these errors were encountered: