You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This plugin is meant to be used along with a CollisionShape2D, and not a CollisionPolygon2D.
There is a Shape2D Resource named ConvexPolygonShape2D, but Godot's Editor is not activating a GUI to edit the points like it does for CollisionPolygon2D.
This is because the CollisionPolygon2D allows "concave" polygons by using multiple convex shapes internally.
How to generate a ConvexPolygonShape2D
Create a CollisionPolygon2D
Use the Editor to add/edit points
Ensure you made a single convex shape
Use the following Node to extract a ConvexPolygonShape2D from it.
@toolextendsNodeclass_nameCollisionPolygon2DConvexShapeExtractor## Extracts a ConvexPolygonShape2D from a CollisionPolygon2D.## THE SHAPE MUST BE CONVEX -- DO NOT MAKE CONCAVE SHAPES.#### Usage:## - Add anywhere## - Target an input polygon and an output shape## - Reopen the scene in the Editor## - Save the generated shape to a file using the Editor#### Be careful if you leave `shape` defined, it will write in it.@exportvarpolygon: CollisionPolygon2D@exportvarshape: ConvexPolygonShape2Dfunc_ready():
extract()
funcextract() ->int:
ifpolygon==null:
push_error("CollisionPolygon2D is null")
returnERR_CANT_ACQUIRE_RESOURCEifshape==null:
shape=ConvexPolygonShape2D.new()
shape.points=polygon.polygonreturnOK
The text was updated successfully, but these errors were encountered:
This plugin is meant to be used along with a
CollisionShape2D
, and not aCollisionPolygon2D
.There is a Shape2D Resource named
ConvexPolygonShape2D
, but Godot's Editor is not activating a GUI to edit the points like it does forCollisionPolygon2D
.How to generate a
ConvexPolygonShape2D
CollisionPolygon2D
ConvexPolygonShape2D
from it.The text was updated successfully, but these errors were encountered: