godot: Physic Body Instanced scene doesn't use CollisionShapes
When instancing a PhysicBody2D node (don’t know if this is true for 3d as well) the new CollisionShape or CollisionPolygon nodes added as childs of the instanced scene are not used for the collisions.
This is the hierachy:
main_node
- other nodes
- instanced RigidBody2D
- ... (other child nodes saved inside RigidBody2D)
- CollisionShape2D (new node added to the instanced scene, does not work)
I think this is useful in a lot of ways, but it also follows the whole idea of “instanced scenes”. Besides if it works with other nodes, why not with collision shapes?
Here’s a test project: https://dl.dropboxusercontent.com/u/274954519/instance_scene_collision_test.zip
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 1
- Comments: 17 (15 by maintainers)
Commits related to this issue
- Add workaround for godotengine/godot#2314 — committed to leonkrause/gdscripts by leonkrause 8 years ago
Well, this is really heavy hack I’d say… I think it is better to patch engine than do this…
On Sat, Nov 19, 2016 at 6:12 PM, Bojidar Marinov notifications@github.com wrote:
This problem is due to how godot handles collision shapes. CollisionShape is just helper node which does add_shape your shapes (resources you create in CollisionShape) and CollisionShape doesn’t exist during runtime. The problem is that CollisionShape node will add shapes to their ascender on the current scene tree, and if none, they will be just removed. To make this work, just add your shapes by hand to the collision body. Or setup collision body and CollisionShapes children of it in the same scene.