|Attention||Topic was automatically imported from the old Question2Answer platform.|
|Old Version||Published before Godot 3 was released.|
I have three instances in my scene. Each of these instances are different sizes and I was trying to programmatically resize the CollisionShape2D for each instance. However, I noticed that all the instances share the same size as the last instance in my scene.
I am using the following code to change the CollisionShape2D in the instance node.
get_node("Area2D/CollisionShape2D").get_shape().set_extents(Vector2(scale * 10.0, 5.0))
But this seems to target all the CollisionShape2Ds in the scene, rather than just the specific instance to which it is attached.
How do I target the specific instance in this case?
If you duplicated the instances after assigning the collision shape they share the same collision shape, manually create a unique collision shape for every instance.
davidoc | 2017-08-20 16:09
Thanks, that solved the problem.
offbeatoctopus | 2017-08-21 11:46