Skip to content
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

PhysicsBody2D fails to generate collision shapes when the shape is added to a PhysicsBody2D instanced subscene #7151

Closed
HeartoLazor opened this issue Nov 18, 2016 · 1 comment
Labels

Comments

@HeartoLazor
Copy link
Contributor

Operating system or device - Godot version:
Windows 10
Godot 2.1.1 stable

Issue description (what happened, and what was expected):
PhysicsBody2D fails to generate collision shapes when the shape is added to a PhysicsBody2D instanced subscene.
Also creating a subscene with the Shape, Instance it and edit the shape from the Collision shape with editable children doesn't work, the Collision Shape retains the collision from the instance before the edits.
This seems to be a bug, because the user should expect always a working PhysicsBody2D if they have a children shape. Editable children flag in the subscene doesn't fix the issue.

In my game I want a generic collider with a script which only objetive is to damage enemies or player, the main requirement is this collider should have different shapes, for example a bullet could be a circle shape or a big rectangle, etc. So I created an Area2D subscene with my script without a shape, and my plan is to add custom shapes to subscene instances. That idea failed when the engine failed to create the collision shapes in this case.

Steps to reproduce:

  • Create a PhysicsBody2D node (Area2D, RigidBody2d, StaticBody2D, etc)
  • Make that PhysicsBody2D a subscene but don't add a Collision Shape
  • Instance the subscene and add a CollisionShape to the instance, not the subscene

Link to minimal example project:
Press play and wait for rigid bodies to collide with floor, subscene ones don't collide:
https://dl.dropboxusercontent.com/s/ffi6rapu9co0p7m/custom_collision_shape.zip

@vnen
Copy link
Member

vnen commented Nov 18, 2016

Duplicate of #2314.

@vnen vnen closed this as completed Nov 18, 2016
@vnen vnen added the archived label Nov 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants