You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows 11 - Godot Engine v4.3.stable.official.77dcf97d8 - OpenGL API 3.3.0 NVIDIA 546.18 - NVIDIA GeForce RTX 4060 Laptop GPU
Issue description
When you try to set up CapsuleShape2D programatically, it does not allow you to set Radius and Height at the same time, if you set the Radius first, then it will be overriden when setting the height later, or vice-versa, if you set the Height first, it will be overriden when setting the Radius later in a way that Height = 2*Radius, having a final circular collisionShape.
Steps to reproduce
-Set a basic 2D Scene containing an StaticBody2D as parent, and Sprite2D and CollisionShape2D as children.
-For this issue, Sprite can be whatever (or even unnecesary, I am just replicating the configuration of the scene I created).
-Set the CollisionShape2D to be a CapsuleShape in the editor.
-Create the following script for the StaticBody2D:
extends StaticBody2D
# Instantiating the Sprite2D and the CollisionShape2D@onreadyvarsprite: Sprite2D=$Sprite2D@onreadyvarcollision_shape: CollisionShape2D=$CollisionShape2D# Setting the initialization of the Scenefunc_ready() ->void:
configure_col_shape()
# Setting the texture and the CollisionShape from the Resourcefuncconfigure_col_shape():
# Configura el CollisionShape2Difcollision_shapeandcollision_shape.shapeisCapsuleShape2D:
collision_shape.shape.radius=100collision_shape.shape.height=20print("Radio: ", collision_shape.shape.radius, " Altura: ", collision_shape.shape.height)
-According to what happened to me, Collisionshape.shape.radius should be equal to 10 and Collisionshape.shape.height should be equal to 20.
Minimal reproduction project (MRP)
I do not have right now an MRP, but if instructions above are followed, the bug is easily replicable.
The text was updated successfully, but these errors were encountered:
I think this is what's happening: a capsule's radius cannot be more than half of height (in which case the shape is a circle). Setting height limits the radius to a correct value (and vice versa, if you test your code but switch the order, height should be 200). Try setting these values in editor, you will observe the same result.
Note that this differs from Godot 3, where height referred to the center part of the capsule. I guess that was unintuitive and therefore was changed to current behaviour, where height is the total height (but it makes radius and height somewhat interdependent).
Tested versions
-Reproducible in version 4.3
System information
Windows 11 - Godot Engine v4.3.stable.official.77dcf97d8 - OpenGL API 3.3.0 NVIDIA 546.18 - NVIDIA GeForce RTX 4060 Laptop GPU
Issue description
When you try to set up CapsuleShape2D programatically, it does not allow you to set Radius and Height at the same time, if you set the Radius first, then it will be overriden when setting the height later, or vice-versa, if you set the Height first, it will be overriden when setting the Radius later in a way that Height = 2*Radius, having a final circular collisionShape.
Steps to reproduce
-Set a basic 2D Scene containing an StaticBody2D as parent, and Sprite2D and CollisionShape2D as children.
-For this issue, Sprite can be whatever (or even unnecesary, I am just replicating the configuration of the scene I created).
-Set the CollisionShape2D to be a CapsuleShape in the editor.
-Create the following script for the StaticBody2D:
extends StaticBody2D
-According to what happened to me, Collisionshape.shape.radius should be equal to 10 and Collisionshape.shape.height should be equal to 20.
Minimal reproduction project (MRP)
I do not have right now an MRP, but if instructions above are followed, the bug is easily replicable.
The text was updated successfully, but these errors were encountered: