Skip to content
reduz edited this page Feb 23, 2014 · 12 revisions

Area2D

####Inherits: CollisionObject2D ####Category: Core

Brief Description

General purpose area detection and influence for 2D Phisics.

Member Functions

Signals

  • body&#95enter ( Object body )
  • body&#95enter&#95shape ( int body_id, Object body, int body_shape, int area_shape )
  • body&#95exit ( Object body )
  • body&#95exit&#95shape ( int body_id, Object body, int body_shape, int area_shape )

Description

General purpose area detection for 2D Phisics. Areas can be used for detection of objects that enter/exit them, as well as overriding space parameters (changing gravity, damping, etc). An Area2D can be set as a children to a RigidBody2D to generate a custom gravity field. For this, use SPACE_OVERRIDE_COMBINE and point gravity at the center of mass.

Member Function Description

  • void set&#95gravity&#95is&#95point ( bool enable )

When overriding space parameters, areas can have a center of gravity as a point.

  • bool is&#95gravity&#95a&#95point ( ) const

Return if gravity is a point. When overriding space parameters, areas can have a center of gravity as a point.

  • void set&#95gravity&#95vector ( Vector2 vector )

Set gravity vector. If gravity is a point, this will be the attraction center

Clone this wiki locally