AreaProjectile2D

Inherits: Projectile2D < RefCounted < Object

Specialized Projectile2D implementation using batch-draw and PhysicsServer2D areas for collision detection.


Description

The most basic type of projectile. AreaProjectile2D are created, processed and manipulated entirely through the PhysicServer2D and are batch drawn by the ProjectileProcessor2D.

AreaProjectile2D are extremely performance efficient but are restricted to a single Texture2D and cannot have individual components.


Tutorials


Properties



Methods



Property Descriptions

RID area

PhysicsServer2D area RID for collision detection.


bool can_be_drawn = false

If true the projectile instance will be batch drawn.


Texture2D graphics

Visual texture of the projectile.


int radius = 0

Size of the projectile circle collision in pixels.

The collision radius of the projectile is affected by the size of the projectile itself.


RID shape

Collision shape RID for physics queries.


Vector2 texture_size

Half-size of the assigned texture for visual centering.



Method Descriptions

void area_monitor_callback(status: int, area_rid: RID, instance_id: int, area_shape_index: int, self_shape_index: int)

Handles area-to-area collision events. Requires monitoring to be set to true.

self_shape_index and area_shape_index contain indices of the interacting shapes from this projectile area and the other area, respectively. area_rid contains the RID of the other area. These values can be used with the PhysicsServer2D.


void body_monitor_callback(status: int, body_rid: RID, instance_id: int, body_shape_index: int, self_shape_index: int)

Handles area-to-body collision events.

self_shape_index and body_shape_index contain indices of the interacting shapes from this projectile area and the other body, respectively. body_rid contains the RID of the other body. These values can be used with the PhysicsServer2D.