GPUParticlesCollisionHeightField3D

Hereda: GPUParticlesCollision3D < VisualInstance3D < Node3D < Node < Object

Una forma de colisión de partículas 3D con forma de mapa de altura en tiempo real que afecta a los nodos GPUParticles3D.

Descripción

Una forma de colisión de partículas 3D con forma de mapa de altura en tiempo real que afecta a los nodos GPUParticles3D.

Las formas de mapa de altura permiten representar de forma eficiente las colisiones de objetos convexos y cóncavos con un solo "suelo" (como el terreno). Esto es menos flexible que GPUParticlesCollisionSDF3D, pero no requiere un paso de procesado.

GPUParticlesCollisionHeightField3D también se puede regenerar en tiempo real cuando se mueve, cuando se mueve la cámara o incluso de forma continua. Esto hace que GPUParticlesCollisionHeightField3D sea una buena opción para efectos climáticos como la lluvia y la nieve, y juegos con geometría muy dinámica. Sin embargo, esta clase es limitada ya que los mapas de altura no pueden representar salientes (por ejemplo, interiores o cuevas).

Nota: ParticleProcessMaterial.collision_mode debe ser `` true`` en el material de proceso del GPUParticles3D para que la colisión funcione.

Nota: La colisión de partículas solo afecta a GPUParticles3D, no a CPUParticles3D.

Propiedades

bool

follow_camera_enabled

false

int

heightfield_mask

1048575

Resolution

resolution

2

Vector3

size

Vector3(2, 2, 2)

UpdateMode

update_mode

0

Métodos

bool

get_heightfield_mask_value(layer_number: int) const

void

set_heightfield_mask_value(layer_number: int, value: bool)


Enumeraciones

enum Resolution: 🔗

Resolution RESOLUTION_256 = 0

Generate a 256×256 heightmap. Intended for small-scale scenes, or larger scenes with no distant particles.

Resolution RESOLUTION_512 = 1

Generate a 512×512 heightmap. Intended for medium-scale scenes, or larger scenes with no distant particles.

Resolution RESOLUTION_1024 = 2

Generate a 1024×1024 heightmap. Intended for large scenes with distant particles.

Resolution RESOLUTION_2048 = 3

Generate a 2048×2048 heightmap. Intended for very large scenes with distant particles.

Resolution RESOLUTION_4096 = 4

Generate a 4096×4096 heightmap. Intended for huge scenes with distant particles.

Resolution RESOLUTION_8192 = 5

Generate a 8192×8192 heightmap. Intended for gigantic scenes with distant particles.

Resolution RESOLUTION_MAX = 6

Representa el tamaño del enum Resolution.


enum UpdateMode: 🔗

UpdateMode UPDATE_MODE_WHEN_MOVED = 0

Only update the heightmap when the GPUParticlesCollisionHeightField3D node is moved, or when the camera moves if follow_camera_enabled is true. An update can be forced by slightly moving the GPUParticlesCollisionHeightField3D in any direction, or by calling RenderingServer.particles_collision_height_field_update().

UpdateMode UPDATE_MODE_ALWAYS = 1

Update the heightmap every frame. This has a significant performance cost. This update should only be used when geometry that particles can collide with changes significantly during gameplay.


Descripciones de Propiedades

bool follow_camera_enabled = false 🔗

  • void set_follow_camera_enabled(value: bool)

  • bool is_follow_camera_enabled()

Si es true, el GPUParticlesCollisionHeightField3D seguirá la cámara actual en el espacio global. El GPUParticlesCollisionHeightField3D no necesita ser un hijo del nodo Camera3D para que esto funcione.

Seguir a la cámara tiene un coste de rendimiento, ya que obligará al mapa de altura a actualizarse cada vez que la cámara se mueva. Considera la posibilidad de reducir resolution para mejorar el rendimiento si follow_camera_enabled es true.


int heightfield_mask = 1048575 🔗

  • void set_heightfield_mask(value: int)

  • int get_heightfield_mask()

The visual layers to account for when updating the heightmap. Only MeshInstance3Ds whose VisualInstance3D.layers match with this heightfield_mask will be included in the heightmap collision update. By default, all 20 user-visible layers are taken into account for updating the heightmap collision.

Note: Since the heightfield_mask allows for 32 layers to be stored in total, there are an additional 12 layers that are only used internally by the engine and aren't exposed in the editor. Setting heightfield_mask using a script allows you to toggle those reserved layers, which can be useful for editor plugins.

To adjust heightfield_mask more easily using a script, use get_heightfield_mask_value() and set_heightfield_mask_value().


Resolution resolution = 2 🔗

Higher resolutions can represent small details more accurately in large scenes, at the cost of lower performance. If update_mode is UPDATE_MODE_ALWAYS, consider using the lowest resolution possible.


Vector3 size = Vector3(2, 2, 2) 🔗

The collision heightmap's size in 3D units. To improve heightmap quality, size should be set as small as possible while covering the parts of the scene you need.


UpdateMode update_mode = 0 🔗

The update policy to use for the generated heightmap.


Descripciones de Métodos

bool get_heightfield_mask_value(layer_number: int) const 🔗

Devuelve true si la capa especificada de heightfield_mask está habilitada, dado un layer_number entre 1 y 20, inclusivo.


void set_heightfield_mask_value(layer_number: int, value: bool) 🔗

Basado en value, habilita o deshabilita la capa especificada en heightfield_mask, dado un layer_number entre 1 y 20, inclusivo.