AreaProjectile2D
Inherits: Projectile2D
Specialized Projectile2D implementation using 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.
Properties
RID | area | PhysicsServer2D.area_create() |
int | collision_layer | 0 |
int | collision_mask | 0 |
Texture2D | graphics | |
int | radius | 50 |
RID | shape | PhysicsServer2D.circle_shape_create() |
Vector2 | texture_size |
Methods
void | area_monitor_callback |
void | body_monitor_callback |
Property Descriptions
RID area = PhysicsServer2D.area_create()
PhysicsServer2D area RID for collision detection.
int collision_layer = 0
Physics layers of the projectile itself.
int collision_mask = 0
Physics layers that can interact with this projectile.
Texture2D graphics
Visual texture for the projectile.
int radius = 50
Size of the projectile Collision in pixels.
RID shape = PhysicsServer2D.circle_shape_create()
Collision shape RID for physics queries.
Vector2 texture_size
Half-size of 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.