-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add VisualShape2D
node
#2
Conversation
I've been also thinking about |
The only thing left to do is providing a way to conveniently edit the rest of the shapes other than polygon shapes. I've created a proposal at Godot to make this happen on the core side godotengine/godot-proposals#1157, but in any case this is possible to do on the module level, but not high-priority. |
Sort of closes godotengine/godot-proposals#1126.
This is pretty much another implementation of godotengine/godot#16483 (it's been suggested to implement this sort of class outside of Godot core), with a larger set of features:
edit polygon-based shapes just like you edit
Polygon2D
(inheriting Godot'sAbstractPolygon2DEditor
)the shape can be automatically set from parent node (
CollisionShape2D
,CollisionPolygon2D
, basically any node which have eithershape
,polygon
, orpoints
properties defined), so there's no need to set this via code to match those shapes:optionally use Godot's default color for collision shapes debugging and respect the
Visible Collision Shapes
debug option, if you need to display the shapes of custom-made physics/collision nodes (for instance, not usingCollisionShape2D
but setting the collision shapes via code), which also helps Collision shapes created through CollisionObject2D APIs are not visible godotengine/godot#36499.Limitations
added.ConcavePolygonShape2D
is not easy to edit because it uses segments over points. Create intermediate segments in ConcavePolygonShape2D. godotengine/godot#32979 is there to fix this inconsistency, but that's only 4.0 fix. So, please useConvexPolygonShape2D
for polygon editing (triangle, pentagons etc), though it's not limited to convex shapes, concave polygons can also be edited through this class. It may be possible to fix this locally in 3.2, but not high priority.There's no textures support, and probably won't be because this class heavily relies on per-shape drawing implemented in Godot. Use
Polygon2D
node for that. But you may be able to apply textures via shaders anyways.Example project
visual_shapes.zip (will be merged to Goost examples once this is merged).
You'll have to checkout the
visual-shape-2d
branch and compile the module to test this.Feedback
Suggestions welcome, including the name of the class.