Class CollisionShape2D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
A node that provides a Shape2D to a CollisionObject2D parent and allows to edit it. This can give a detection shape to an Area2D or turn a PhysicsBody2D into a solid object.
public class CollisionShape2D : Node2D, IDisposable
- Inheritance
-
CollisionShape2D
- Implements
- Inherited Members
Constructors
CollisionShape2D()
public CollisionShape2D()
Properties
DebugColor
The collision shape debug color.
Note: The default value is ProjectSettings.debug/shapes/collision/shape_color
. The Color(0, 0, 0, 1)
value documented here is a placeholder, and not the actual default debug color.
public Color DebugColor { get; set; }
Property Value
Disabled
A disabled collision shape has no effect in the world. This property should be changed with SetDeferred(StringName, Variant).
public bool Disabled { get; set; }
Property Value
OneWayCollision
Sets whether this collision shape should only detect collision on one side (top or bottom).
Note: This property has no effect if this CollisionShape2D 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 shape at a high velocity.
public float OneWayCollisionMargin { get; set; }
Property Value
Shape
The actual shape owned by this collision shape.
public Shape2D Shape { get; set; }
Property Value
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.