0.2.0-dev Download ZIP
81 lines ·6.4 KB Raw
| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="GPUParticlesCollisionHeightField3D" inherits="GPUParticlesCollision3D" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A real-time heightmap-shaped 3D particle collision shape affecting [GPUParticles3D] nodes. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | A real-time heightmap-shaped 3D particle collision shape affecting [GPUParticles3D] nodes. |
| 8 | Heightmap shapes allow for efficiently representing collisions for convex and concave objects with a single "floor" (such as terrain). This is less flexible than [GPUParticlesCollisionSDF3D], but it doesn't require a baking step. |
| 9 | [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). |
| 10 | [b]Note:[/b] [member ParticleProcessMaterial.collision_mode] must be [code]true[/code] on the [GPUParticles3D]'s process material for collision to work. |
| 11 | [b]Note:[/b] Particle collision only affects [GPUParticles3D], not [CPUParticles3D]. |
| 12 | </description> |
| 13 | <tutorials> |
| 14 | </tutorials> |
| 15 | <methods> |
| 16 | <method name="get_heightfield_mask_value" qualifiers="const"> |
| 17 | <return type="bool" /> |
| 18 | <param index="0" name="layer_number" type="int" /> |
| 19 | <description> |
| 20 | Returns [code]true[/code] if the specified layer of the [member heightfield_mask] is enabled, given a [param layer_number] between [code]1[/code] and [code]20[/code], inclusive. |
| 21 | </description> |
| 22 | </method> |
| 23 | <method name="set_heightfield_mask_value"> |
| 24 | <return type="void" /> |
| 25 | <param index="0" name="layer_number" type="int" /> |
| 26 | <param index="1" name="value" type="bool" /> |
| 27 | <description> |
| 28 | Based on [param value], enables or disables the specified layer in the [member heightfield_mask], given a [param layer_number] between [code]1[/code] and [code]20[/code], inclusive. |
| 29 | </description> |
| 30 | </method> |
| 31 | </methods> |
| 32 | <members> |
| 33 | <member name="follow_camera_enabled" type="bool" setter="set_follow_camera_enabled" getter="is_follow_camera_enabled" default="false"> |
| 34 | If [code]true[/code], the [GPUParticlesCollisionHeightField3D] will follow the current camera in global space. The [GPUParticlesCollisionHeightField3D] does not need to be a child of the [Camera3D] node for this to work. |
| 35 | Following the camera has a performance cost, as it will force the heightmap to update whenever the camera moves. Consider lowering [member resolution] to improve performance if [member follow_camera_enabled] is [code]true[/code]. |
| 36 | </member> |
| 37 | <member name="heightfield_mask" type="int" setter="set_heightfield_mask" getter="get_heightfield_mask" default="1048575"> |
| 38 | The visual layers to account for when updating the heightmap. Only [MeshInstance3D]s whose [member VisualInstance3D.layers] match with this [member 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. |
| 39 | [b]Note:[/b] Since the [member 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 [member heightfield_mask] using a script allows you to toggle those reserved layers, which can be useful for editor plugins. |
| 40 | To adjust [member heightfield_mask] more easily using a script, use [method get_heightfield_mask_value] and [method set_heightfield_mask_value]. |
| 41 | </member> |
| 42 | <member name="resolution" type="int" setter="set_resolution" getter="get_resolution" enum="GPUParticlesCollisionHeightField3D.Resolution" default="2"> |
| 43 | Higher resolutions can represent small details more accurately in large scenes, at the cost of lower performance. If [member update_mode] is [constant UPDATE_MODE_ALWAYS], consider using the lowest resolution possible. |
| 44 | </member> |
| 45 | <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)"> |
| 46 | The collision heightmap's size in 3D units. To improve heightmap quality, [member size] should be set as small as possible while covering the parts of the scene you need. |
| 47 | </member> |
| 48 | <member name="update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="GPUParticlesCollisionHeightField3D.UpdateMode" default="0"> |
| 49 | The update policy to use for the generated heightmap. |
| 50 | </member> |
| 51 | </members> |
| 52 | <constants> |
| 53 | <constant name="RESOLUTION_256" value="0" enum="Resolution"> |
| 54 | Generate a 256×256 heightmap. Intended for small-scale scenes, or larger scenes with no distant particles. |
| 55 | </constant> |
| 56 | <constant name="RESOLUTION_512" value="1" enum="Resolution"> |
| 57 | Generate a 512×512 heightmap. Intended for medium-scale scenes, or larger scenes with no distant particles. |
| 58 | </constant> |
| 59 | <constant name="RESOLUTION_1024" value="2" enum="Resolution"> |
| 60 | Generate a 1024×1024 heightmap. Intended for large scenes with distant particles. |
| 61 | </constant> |
| 62 | <constant name="RESOLUTION_2048" value="3" enum="Resolution"> |
| 63 | Generate a 2048×2048 heightmap. Intended for very large scenes with distant particles. |
| 64 | </constant> |
| 65 | <constant name="RESOLUTION_4096" value="4" enum="Resolution"> |
| 66 | Generate a 4096×4096 heightmap. Intended for huge scenes with distant particles. |
| 67 | </constant> |
| 68 | <constant name="RESOLUTION_8192" value="5" enum="Resolution"> |
| 69 | Generate a 8192×8192 heightmap. Intended for gigantic scenes with distant particles. |
| 70 | </constant> |
| 71 | <constant name="RESOLUTION_MAX" value="6" enum="Resolution"> |
| 72 | Represents the size of the [enum Resolution] enum. |
| 73 | </constant> |
| 74 | <constant name="UPDATE_MODE_WHEN_MOVED" value="0" enum="UpdateMode"> |
| 75 | Only update the heightmap when the [GPUParticlesCollisionHeightField3D] node is moved, or when the camera moves if [member follow_camera_enabled] is [code]true[/code]. An update can be forced by slightly moving the [GPUParticlesCollisionHeightField3D] in any direction, or by calling [method RenderingServer.particles_collision_height_field_update]. |
| 76 | </constant> |
| 77 | <constant name="UPDATE_MODE_ALWAYS" value="1" enum="UpdateMode"> |
| 78 | 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. |
| 79 | </constant> |
| 80 | </constants> |
| 81 | </class> |