Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | alexzheng | |
Old Version | Published before Godot 3 was released. |
the node struct:
Area2D
CircleShape2D
radius of the CircleShape2D is 10.
attached script
func _ready():
print("radius ", get_shape(0).get_radius())
print(get_shape(0).get_type())
in the instance scene, I changed the radius, or the type of the shape, or make the shape unique.
it’s always prints
radius 10
CircleShape2D
CircleShape2D is Childe of Area2D
alexzheng | 2017-04-21 23:53
after google, it may be a known bug in the engine.
alexzheng | 2017-04-22 00:03
Yeah it’s a known bug.
You can do a temporary fix by manually clearing the shapes and adding a new one from the CollisionShape2D
node, like this:
func _ready():
# Reset shapes
clear_shapes()
var col = get_node("CollisionShape2D")
add_shape(col.get_shape(), col.get_transform())
In all inherited scenes that have this script it will reset the shape to whatever the inherited scene has. Of course if you have more collision shapes or other areas in the scene you’ll need to do the same for them as well.
CowThing | 2017-04-22 00:47
is the node CollisionShape2D the one inherited from the base or must be added as a new node in the inherited scene.
alexzheng | 2017-04-22 04:28