:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/GPUParticlesCollisionHeightField3D.xml. .. _class_GPUParticlesCollisionHeightField3D: GPUParticlesCollisionHeightField3D ================================== **Inherits:** :ref:`GPUParticlesCollision3D` **<** :ref:`VisualInstance3D` **<** :ref:`Node3D` **<** :ref:`Node` **<** :ref:`Object` A real-time heightmap-shaped 3D particle collision shape affecting :ref:`GPUParticles3D` nodes. .. rst-class:: classref-introduction-group Description ----------- A real-time heightmap-shaped 3D particle collision shape affecting :ref:`GPUParticles3D` nodes. Heightmap shapes allow for efficiently representing collisions for convex and concave objects with a single "floor" (such as terrain). This is less flexible than :ref:`GPUParticlesCollisionSDF3D`, but it doesn't require a baking step. \ **GPUParticlesCollisionHeightField3D** can also be regenerated in real-time when it is moved, when the camera moves, or even continuously. This makes **GPUParticlesCollisionHeightField3D** a good choice for weather effects such as rain and snow and games with highly dynamic geometry. However, this class is limited since heightmaps cannot represent overhangs (e.g. indoors or caves). \ **Note:** :ref:`ParticleProcessMaterial.collision_mode` must be ``true`` on the :ref:`GPUParticles3D`'s process material for collision to work. \ **Note:** Particle collision only affects :ref:`GPUParticles3D`, not :ref:`CPUParticles3D`. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------+ | :ref:`bool` | :ref:`follow_camera_enabled` | ``false`` | +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------+ | :ref:`int` | :ref:`heightfield_mask` | ``1048575`` | +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------+ | :ref:`Resolution` | :ref:`resolution` | ``2`` | +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------+ | :ref:`Vector3` | :ref:`size` | ``Vector3(2, 2, 2)`` | +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------+ | :ref:`UpdateMode` | :ref:`update_mode` | ``0`` | +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_heightfield_mask_value`\ (\ layer_number\: :ref:`int`\ ) |const| | +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_heightfield_mask_value`\ (\ layer_number\: :ref:`int`, value\: :ref:`bool`\ ) | +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_GPUParticlesCollisionHeightField3D_Resolution: .. rst-class:: classref-enumeration enum **Resolution**: :ref:`🔗` .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_256: .. rst-class:: classref-enumeration-constant :ref:`Resolution` **RESOLUTION_256** = ``0`` Generate a 256×256 heightmap. Intended for small-scale scenes, or larger scenes with no distant particles. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_512: .. rst-class:: classref-enumeration-constant :ref:`Resolution` **RESOLUTION_512** = ``1`` Generate a 512×512 heightmap. Intended for medium-scale scenes, or larger scenes with no distant particles. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_1024: .. rst-class:: classref-enumeration-constant :ref:`Resolution` **RESOLUTION_1024** = ``2`` Generate a 1024×1024 heightmap. Intended for large scenes with distant particles. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_2048: .. rst-class:: classref-enumeration-constant :ref:`Resolution` **RESOLUTION_2048** = ``3`` Generate a 2048×2048 heightmap. Intended for very large scenes with distant particles. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_4096: .. rst-class:: classref-enumeration-constant :ref:`Resolution` **RESOLUTION_4096** = ``4`` Generate a 4096×4096 heightmap. Intended for huge scenes with distant particles. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_8192: .. rst-class:: classref-enumeration-constant :ref:`Resolution` **RESOLUTION_8192** = ``5`` Generate a 8192×8192 heightmap. Intended for gigantic scenes with distant particles. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_MAX: .. rst-class:: classref-enumeration-constant :ref:`Resolution` **RESOLUTION_MAX** = ``6`` Represents the size of the :ref:`Resolution` enum. .. rst-class:: classref-item-separator ---- .. _enum_GPUParticlesCollisionHeightField3D_UpdateMode: .. rst-class:: classref-enumeration enum **UpdateMode**: :ref:`🔗` .. _class_GPUParticlesCollisionHeightField3D_constant_UPDATE_MODE_WHEN_MOVED: .. rst-class:: classref-enumeration-constant :ref:`UpdateMode` **UPDATE_MODE_WHEN_MOVED** = ``0`` Only update the heightmap when the **GPUParticlesCollisionHeightField3D** node is moved, or when the camera moves if :ref:`follow_camera_enabled` is ``true``. An update can be forced by slightly moving the **GPUParticlesCollisionHeightField3D** in any direction, or by calling :ref:`RenderingServer.particles_collision_height_field_update()`. .. _class_GPUParticlesCollisionHeightField3D_constant_UPDATE_MODE_ALWAYS: .. rst-class:: classref-enumeration-constant :ref:`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. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_GPUParticlesCollisionHeightField3D_property_follow_camera_enabled: .. rst-class:: classref-property :ref:`bool` **follow_camera_enabled** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_follow_camera_enabled**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_follow_camera_enabled**\ (\ ) If ``true``, the **GPUParticlesCollisionHeightField3D** will follow the current camera in global space. The **GPUParticlesCollisionHeightField3D** does not need to be a child of the :ref:`Camera3D` node for this to work. Following the camera has a performance cost, as it will force the heightmap to update whenever the camera moves. Consider lowering :ref:`resolution` to improve performance if :ref:`follow_camera_enabled` is ``true``. .. rst-class:: classref-item-separator ---- .. _class_GPUParticlesCollisionHeightField3D_property_heightfield_mask: .. rst-class:: classref-property :ref:`int` **heightfield_mask** = ``1048575`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_heightfield_mask**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_heightfield_mask**\ (\ ) The visual layers to account for when updating the heightmap. Only :ref:`MeshInstance3D`\ s whose :ref:`VisualInstance3D.layers` match with this :ref:`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 :ref:`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 :ref:`heightfield_mask` using a script allows you to toggle those reserved layers, which can be useful for editor plugins. To adjust :ref:`heightfield_mask` more easily using a script, use :ref:`get_heightfield_mask_value()` and :ref:`set_heightfield_mask_value()`. .. rst-class:: classref-item-separator ---- .. _class_GPUParticlesCollisionHeightField3D_property_resolution: .. rst-class:: classref-property :ref:`Resolution` **resolution** = ``2`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_resolution**\ (\ value\: :ref:`Resolution`\ ) - :ref:`Resolution` **get_resolution**\ (\ ) Higher resolutions can represent small details more accurately in large scenes, at the cost of lower performance. If :ref:`update_mode` is :ref:`UPDATE_MODE_ALWAYS`, consider using the lowest resolution possible. .. rst-class:: classref-item-separator ---- .. _class_GPUParticlesCollisionHeightField3D_property_size: .. rst-class:: classref-property :ref:`Vector3` **size** = ``Vector3(2, 2, 2)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_size**\ (\ value\: :ref:`Vector3`\ ) - :ref:`Vector3` **get_size**\ (\ ) The collision heightmap's size in 3D units. To improve heightmap quality, :ref:`size` should be set as small as possible while covering the parts of the scene you need. .. rst-class:: classref-item-separator ---- .. _class_GPUParticlesCollisionHeightField3D_property_update_mode: .. rst-class:: classref-property :ref:`UpdateMode` **update_mode** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_update_mode**\ (\ value\: :ref:`UpdateMode`\ ) - :ref:`UpdateMode` **get_update_mode**\ (\ ) The update policy to use for the generated heightmap. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_GPUParticlesCollisionHeightField3D_method_get_heightfield_mask_value: .. rst-class:: classref-method :ref:`bool` **get_heightfield_mask_value**\ (\ layer_number\: :ref:`int`\ ) |const| :ref:`🔗` Returns ``true`` if the specified layer of the :ref:`heightfield_mask` is enabled, given a ``layer_number`` between ``1`` and ``20``, inclusive. .. rst-class:: classref-item-separator ---- .. _class_GPUParticlesCollisionHeightField3D_method_set_heightfield_mask_value: .. rst-class:: classref-method |void| **set_heightfield_mask_value**\ (\ layer_number\: :ref:`int`, value\: :ref:`bool`\ ) :ref:`🔗` Based on ``value``, enables or disables the specified layer in the :ref:`heightfield_mask`, given a ``layer_number`` between ``1`` and ``20``, inclusive. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`