Area3D

Hereda: CollisionObject3D < Node3D < Node < Object

Una región del espacio 3D que detecta otros CollisionObject3D entrando o saliendo de él.

Descripción

Area3D is a region of 3D space defined by one or multiple CollisionShape3D or CollisionPolygon3D child nodes. It detects when other CollisionObject3Ds enter or exit it, and it also keeps track of which collision objects haven't exited it yet (i.e. which one are overlapping it).

This node can also locally alter or override physics parameters (gravity, damping) and route audio to custom audio buses.

Note: Areas and bodies created with PhysicsServer3D might not interact as expected with Area3Ds, and might not emit signals or track objects correctly.

Warning: Using a ConcavePolygonShape3D inside a CollisionShape3D child of this node (created e.g. by using the Create Trimesh Collision Sibling option in the Mesh menu that appears when selecting a MeshInstance3D node) may give unexpected results, since this collision shape is hollow. If this is not desired, it has to be split into multiple ConvexPolygonShape3Ds or primitive shapes like BoxShape3D, or in some cases it may be replaceable by a CollisionPolygon3D.

Tutoriales

Propiedades

float

angular_damp

0.1

SpaceOverride

angular_damp_space_override

0

StringName

audio_bus_name

&"Master"

bool

audio_bus_override

false

float

gravity

9.8

Vector3

gravity_direction

Vector3(0, -1, 0)

bool

gravity_point

false

Vector3

gravity_point_center

Vector3(0, -1, 0)

float

gravity_point_unit_distance

0.0

SpaceOverride

gravity_space_override

0

float

linear_damp

0.1

SpaceOverride

linear_damp_space_override

0

bool

monitorable

true

bool

monitoring

true

int

priority

0

float

reverb_bus_amount

0.0

bool

reverb_bus_enabled

false

StringName

reverb_bus_name

&"Master"

float

reverb_bus_uniformity

0.0

float

wind_attenuation_factor

0.0

float

wind_force_magnitude

0.0

NodePath

wind_source_path

NodePath("")

Métodos

Array[Area3D]

get_overlapping_areas() const

Array[Node3D]

get_overlapping_bodies() const

bool

has_overlapping_areas() const

bool

has_overlapping_bodies() const

bool

overlaps_area(area: Node) const

bool

overlaps_body(body: Node) const


Señales

area_entered(area: Area3D) 🔗

Emitida cuando el area recibido entra en esta área. Requiere que monitoring se configure como true.


area_exited(area: Area3D) 🔗

Emitida cuando el area recibido sale de esta área. Requiere que monitoring se configure como true.


area_shape_entered(area_rid: RID, area: Area3D, area_shape_index: int, local_shape_index: int) 🔗

Emitted when a Shape3D of the received area enters a shape of this area. Requires monitoring to be set to true.

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

Example: Get the CollisionShape3D node from the shape index:

var other_shape_owner = area.shape_find_owner(area_shape_index)
var other_shape_node = area.shape_owner_get_owner(other_shape_owner)

var local_shape_owner = shape_find_owner(local_shape_index)
var local_shape_node = shape_owner_get_owner(local_shape_owner)

area_shape_exited(area_rid: RID, area: Area3D, area_shape_index: int, local_shape_index: int) 🔗

Emitida cuando una Shape3D del area recibido sale de una forma de esta área. Requiere que monitoring esté establecido en true.

Véase también area_shape_entered.


body_entered(body: Node3D) 🔗

Emitida cuando el body recibido entra en esta área. body puede ser un PhysicsBody3D o un GridMap. Los GridMap se detectan si su MeshLibrary tiene formas de colisión configuradas. Requiere que monitoring esté establecido en true.


body_exited(body: Node3D) 🔗

Emitida cuando el body recibido sale de esta área. body puede ser un PhysicsBody3D o un GridMap. Los GridMap se detectan si su MeshLibrary tiene formas de colisión configuradas. Requiere que monitoring esté establecido en true.


body_shape_entered(body_rid: RID, body: Node3D, body_shape_index: int, local_shape_index: int) 🔗

Emitted when a Shape3D of the received body enters a shape of this area. body can be a PhysicsBody3D or a GridMap. GridMaps are detected if their MeshLibrary has collision shapes configured. Requires monitoring to be set to true.

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

Example: Get the CollisionShape3D node from the shape index:

var body_shape_owner = body.shape_find_owner(body_shape_index)
var body_shape_node = body.shape_owner_get_owner(body_shape_owner)

var local_shape_owner = shape_find_owner(local_shape_index)
var local_shape_node = shape_owner_get_owner(local_shape_owner)

body_shape_exited(body_rid: RID, body: Node3D, body_shape_index: int, local_shape_index: int) 🔗

Emitida cuando una Shape3D del body recibido sale de una forma de esta área. body puede ser un PhysicsBody3D o un GridMap. Los GridMap se detectan si su MeshLibrary tiene formas de colisión configuradas. Requiere que monitoring esté establecido en true.

Véase también body_shape_entered.


Enumeraciones

enum SpaceOverride: 🔗

SpaceOverride SPACE_OVERRIDE_DISABLED = 0

Esta zona no afecta a la gravedad/amortiguación.

SpaceOverride SPACE_OVERRIDE_COMBINE = 1

Esta área añade sus valores de gravedad/amortiguación a lo que se ha calculado hasta ahora (en el orden priority).

SpaceOverride SPACE_OVERRIDE_COMBINE_REPLACE = 2

Esta área añade sus valores de gravedad/amortiguación a lo que se ha calculado hasta ahora (en el orden priority), ignorando cualquier área de menor prioridad.

SpaceOverride SPACE_OVERRIDE_REPLACE = 3

Esta área reemplaza cualquier gravedad/amortiguación, incluso las predeterminadas, ignorando cualquier área de menor prioridad.

SpaceOverride SPACE_OVERRIDE_REPLACE_COMBINE = 4

Esta área reemplaza cualquier gravedad/amortiguación calculada hasta ahora (en orden de priority), pero sigue calculando el resto de las áreas.


Descripciones de Propiedades

float angular_damp = 0.1 🔗

  • void set_angular_damp(value: float)

  • float get_angular_damp()

The rate at which objects stop spinning in this area. Represents the angular velocity lost per second.

See ProjectSettings.physics/3d/default_angular_damp for more details about damping.


SpaceOverride angular_damp_space_override = 0 🔗

Override mode for angular damping calculations within this area.


StringName audio_bus_name = &"Master" 🔗

El nombre del bus de audio de la zona.


bool audio_bus_override = false 🔗

  • void set_audio_bus_override(value: bool)

  • bool is_overriding_audio_bus()

Si es true, el área del bus de audio sobrescribe el bus de audio por defecto.


float gravity = 9.8 🔗

  • void set_gravity(value: float)

  • float get_gravity()

The area's gravity intensity (in meters per second squared). This value multiplies the gravity direction. This is useful to alter the force of gravity without altering its direction.


Vector3 gravity_direction = Vector3(0, -1, 0) 🔗

  • void set_gravity_direction(value: Vector3)

  • Vector3 get_gravity_direction()

El vector de gravedad del área (no normalizado).


bool gravity_point = false 🔗

  • void set_gravity_is_point(value: bool)

  • bool is_gravity_a_point()

If true, gravity is calculated from a point (set via gravity_point_center). See also gravity_space_override.


Vector3 gravity_point_center = Vector3(0, -1, 0) 🔗

  • void set_gravity_point_center(value: Vector3)

  • Vector3 get_gravity_point_center()

If gravity is a point (see gravity_point), this will be the point of attraction.


float gravity_point_unit_distance = 0.0 🔗

  • void set_gravity_point_unit_distance(value: float)

  • float get_gravity_point_unit_distance()

La distancia a la que la fuerza de gravedad es igual a gravity. Por ejemplo, en un planeta de 100 metros de radio con una gravedad superficial de 4.0 m/s², establezca la gravity a 4.0 y la unidad de distancia a 100.0. La gravedad disminuirá según la ley del cuadrado inverso, entonces en este ejemplo, a 200 metros del centro la gravedad será 1.0 m/s² (doble de distancia, 1/4 más gravedad), a 50 metros será 16.0 m/s² (mitad de distancia, 4 veces más gravedad), y así sucesivamente.

Lo anterior es cierto solo cuando la unidad de distancia es un número positivo. Cuando está establecido a 0.0, la gravedad será constante independientemente de la distancia.


SpaceOverride gravity_space_override = 0 🔗

Modo de sobrescritura para los cálculos de gravedad dentro de esta área.


float linear_damp = 0.1 🔗

  • void set_linear_damp(value: float)

  • float get_linear_damp()

La tasa a la que los objetos dejan de moverse en esta área. Representa la velocidad lineal perdida por segundo.

Véase ProjectSettings.physics/3d/default_linear_damp para obtener más detalles sobre la amortiguación.


SpaceOverride linear_damp_space_override = 0 🔗

Override mode for linear damping calculations within this area.


bool monitorable = true 🔗

  • void set_monitorable(value: bool)

  • bool is_monitorable()

Si es true, otras áreas de monitoreo pueden detectar esta área.


bool monitoring = true 🔗

  • void set_monitoring(value: bool)

  • bool is_monitoring()

Si es true, el área detecta cuerpos o áreas que entran y salen de ella.


int priority = 0 🔗

  • void set_priority(value: int)

  • int get_priority()

La prioridad del área. Las áreas de mayor prioridad se procesan primero. La física de World3D siempre se procesa al final, después de todas las áreas.


float reverb_bus_amount = 0.0 🔗

  • void set_reverb_amount(value: float)

  • float get_reverb_amount()

El grado en que esta área aplica reverberación a su audio asociado. Va de 0 a 1 con una precisión de 0.1.


bool reverb_bus_enabled = false 🔗

  • void set_use_reverb_bus(value: bool)

  • bool is_using_reverb_bus()

Si es true, el área aplica reverberación a su audio asociado.


StringName reverb_bus_name = &"Master" 🔗

El nombre del bus de reverberación que se utilizará para el audio asociado a esta área.


float reverb_bus_uniformity = 0.0 🔗

  • void set_reverb_uniformity(value: float)

  • float get_reverb_uniformity()

El grado de reverberación de esta área es un efecto uniforme. Va de 0 a 1 con una precisión de 0,1.


float wind_attenuation_factor = 0.0 🔗

  • void set_wind_attenuation_factor(value: float)

  • float get_wind_attenuation_factor()

La tasa exponencial a la que la fuerza del viento disminuye con la distancia desde su origen.

Nota: Esta fuerza del viento solo se aplica a los nodos SoftBody3D. Otros cuerpos físicos no se ven afectados actualmente por el viento.


float wind_force_magnitude = 0.0 🔗

  • void set_wind_force_magnitude(value: float)

  • float get_wind_force_magnitude()

La magnitud de la fuerza del viento específica del área.

Nota: Esta fuerza del viento solo se aplica a los nodos SoftBody3D. Otros cuerpos físicos no se ven afectados actualmente por el viento.


NodePath wind_source_path = NodePath("") 🔗

El Node3D que se utiliza para especificar la dirección y el origen de una fuerza del viento específica del área. La dirección es opuesta al eje z de la transformación local del Node3D, y su origen es el origen de la transformación local del Node3D.

Nota: Esta fuerza del viento solo se aplica a los nodos SoftBody3D. Otros cuerpos físicos no se ven afectados actualmente por el viento.


Descripciones de Métodos

Array[Area3D] get_overlapping_areas() const 🔗

Returns a list of intersecting Area3Ds. The overlapping area's CollisionObject3D.collision_layer must be part of this area's CollisionObject3D.collision_mask in order to be detected.

For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.


Array[Node3D] get_overlapping_bodies() const 🔗

Returns a list of intersecting PhysicsBody3Ds and GridMaps. The overlapping body's CollisionObject3D.collision_layer must be part of this area's CollisionObject3D.collision_mask in order to be detected.

For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.


bool has_overlapping_areas() const 🔗

Returns true if intersecting any Area3Ds, otherwise returns false. The overlapping area's CollisionObject3D.collision_layer must be part of this area's CollisionObject3D.collision_mask in order to be detected.

For performance reasons (collisions are all processed at the same time) the list of overlapping areas is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.


bool has_overlapping_bodies() const 🔗

Returns true if intersecting any PhysicsBody3Ds or GridMaps, otherwise returns false. The overlapping body's CollisionObject3D.collision_layer must be part of this area's CollisionObject3D.collision_mask in order to be detected.

For performance reasons (collisions are all processed at the same time) the list of overlapping bodies is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.


bool overlaps_area(area: Node) const 🔗

Returns true if the given Area3D intersects or overlaps this Area3D, false otherwise.

Note: The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.


bool overlaps_body(body: Node) const 🔗

Returns true if the given physics body intersects or overlaps this Area3D, false otherwise.

Note: The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.

The body argument can either be a PhysicsBody3D or a GridMap instance. While GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body.