CollisionObject2D

Base node for 2D collision objects.

CollisionObject2D is the base class for 2D physics objects. It can hold any number of 2D collision Shape2Ds. Each shape must be assigned to a shape owner. The CollisionObject2D can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the shape_owner_* methods.

@GodotBaseClass
struct CollisionObject2D {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

_inputEvent
void _inputEvent(GodotObject viewport, InputEvent event, long shape_idx)

Accepts unhandled InputEvents. Requires inputPickable to be true. shape_idx is the child index of the clicked Shape2D. Connect to the input_event signal to easily pick up these events.

createShapeOwner
long createShapeOwner(GodotObject owner)

Creates a new shape owner for the given object. Returns owner_id of the new owner for future reference.

getRid
RID getRid()

Returns the object's RID.

getShapeOwnerOneWayCollisionMargin
double getShapeOwnerOneWayCollisionMargin(long owner_id)

Returns the one_way_collision_margin of the shape owner identified by given owner_id.

getShapeOwners
Array getShapeOwners()

Returns an Array of owner_id identifiers. You can use these ids in other methods that take owner_id as an argument.

isPickable
bool isPickable()
isShapeOwnerDisabled
bool isShapeOwnerDisabled(long owner_id)

If true, the shape owner and its shapes are disabled.

isShapeOwnerOneWayCollisionEnabled
bool isShapeOwnerOneWayCollisionEnabled(long owner_id)

Returns true if collisions for the shape owner originating from this CollisionObject2D will not be reported to collided with CollisionObject2Ds.

opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(CollisionObject2D other)
opEquals
bool opEquals(typeof(null) n)
removeShapeOwner
void removeShapeOwner(long owner_id)

Removes the given shape owner.

setPickable
void setPickable(bool enabled)
shapeFindOwner
long shapeFindOwner(long shape_index)

Returns the owner_id of the given shape.

shapeOwnerAddShape
void shapeOwnerAddShape(long owner_id, Shape2D shape)

Adds a Shape2D to the shape owner.

shapeOwnerClearShapes
void shapeOwnerClearShapes(long owner_id)

Removes all shapes from the shape owner.

shapeOwnerGetOwner
GodotObject shapeOwnerGetOwner(long owner_id)

Returns the parent object of the given shape owner.

shapeOwnerGetShape
Ref!Shape2D shapeOwnerGetShape(long owner_id, long shape_id)

Returns the Shape2D with the given id from the given shape owner.

shapeOwnerGetShapeCount
long shapeOwnerGetShapeCount(long owner_id)

Returns the number of shapes the given shape owner contains.

shapeOwnerGetShapeIndex
long shapeOwnerGetShapeIndex(long owner_id, long shape_id)

Returns the child index of the Shape2D with the given id from the given shape owner.

shapeOwnerGetTransform
Transform2D shapeOwnerGetTransform(long owner_id)

Returns the shape owner's Transform2D.

shapeOwnerRemoveShape
void shapeOwnerRemoveShape(long owner_id, long shape_id)

Removes a shape from the given shape owner.

shapeOwnerSetDisabled
void shapeOwnerSetDisabled(long owner_id, bool disabled)

If true, disables the given shape owner.

shapeOwnerSetOneWayCollision
void shapeOwnerSetOneWayCollision(long owner_id, bool enable)

If enable is true, collisions for the shape owner originating from this CollisionObject2D will not be reported to collided with CollisionObject2Ds.

shapeOwnerSetOneWayCollisionMargin
void shapeOwnerSetOneWayCollisionMargin(long owner_id, double margin)

Sets the one_way_collision_margin of the shape owner identified by given owner_id to margin pixels.

shapeOwnerSetTransform
void shapeOwnerSetTransform(long owner_id, Transform2D transform)

Sets the Transform2D of the given shape owner.

toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

inputPickable
bool inputPickable [@property getter]
bool inputPickable [@property setter]

If true, this object is pickable. A pickable object can detect the mouse pointer entering/leaving, and if the mouse is inside it, report input events. Requires at least one collision_layer bit to be set.

Static functions

_new
CollisionObject2D _new()

Construct a new instance of CollisionObject2D. Note: use memnew!CollisionObject2D instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta