Class CollisionPolygon2D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
A node that provides a thickened polygon shape (a prism) to a CollisionObject2D parent and allows to edit it. The polygon can be concave or convex. This can give a detection shape to an Area2D or turn PhysicsBody2D into a solid object.
Warning: A non-uniformly scaled CollisionShape2D will likely not behave as expected. Make sure to keep its scale the same on all axes and adjust its shape resource instead.
public class CollisionPolygon2D : Node2D, IDisposable
- Inheritance
-
CollisionPolygon2D
- Implements
- Inherited Members
Constructors
CollisionPolygon2D()
public CollisionPolygon2D()
Properties
BuildMode
Collision build mode. Use one of the CollisionPolygon2D.BuildModeEnum constants.
public CollisionPolygon2D.BuildModeEnum BuildMode { get; set; }
Property Value
Disabled
If true
, no collisions will be detected.
public bool Disabled { get; set; }
Property Value
OneWayCollision
If true
, only edges that face up, relative to CollisionPolygon2D's rotation, will collide with other objects.
Note: This property has no effect if this CollisionPolygon2D is a child of an Area2D node.
public bool OneWayCollision { get; set; }
Property Value
OneWayCollisionMargin
The margin used for one-way collision (in pixels). Higher values will make the shape thicker, and work better for colliders that enter the polygon at a high velocity.
public float OneWayCollisionMargin { get; set; }
Property Value
Polygon
The polygon's list of vertices. Each point will be connected to the next, and the final point will be connected to the first.
Note: The returned vertices are in the local coordinate space of the given CollisionPolygon2D.
Warning: The returned value is a clone of the Vector2[], not a reference.
public Vector2[] Polygon { get; set; }
Property Value
- Vector2[]
Methods
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.