+3 votes
  1. As per the docs, I understand that following hierarchy is followed:

     -ShapeOwner0 -> Shape2D0, Shape2d1......
     -ShapeOwner2 -> Shape2D0, Shape2d1......
     -ShapeOwner3 -> Shape2D0, Shape2d1......

    Is this a correct visualization?

  2. Is there any other design motive to have shape owners as an intermediate between an Object and it's collision shape, other than grouping collision shapes?

  3. Is CollisionPolygon2D also just a Editor-only helper node?

  4. Doc says create_shape_owner(Object) creates a new shape owner for the given object. However, while trying in GDScript, no matter which Object I provide, it creates an owner for the node calling this function. Is the Object parameter redundant?

in Engine by (44 points)

1 Answer

0 votes

I'm porting my game from Godot 2.1 to 3.2 and I've also come across these doubts. I've been updating myself on how these things work (by checking the source code, mainly).

So here are my answers:

  1. Yes.
  2. The only reason I can think of is that a transform can be applied at once to many shapes, because it's applied per owner and I guess that simplifies things like the inner workings of CollisionPolygon2D that applies its own transform to all the shapes it owns (those the polygon is decomposed in for use by the physics engine).
  3. In Godot 3.x, CollisionPolygon2D can work at runtime.
  4. How do you know? If you call shape_owner_get_owner() with the owner id returned by create_shape_owner() you should get back the Object you passed to it.
by (182 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.