GpuParticlesCollisionHeightField3D
A real-time heightmap-shaped 3D particle collision shape affecting GPUParticles3D nodes.
A real-time heightmap-shaped 3D particle collision shape affecting GpuParticles3D nodes.
A real-time heightmap-shaped 3D particle collision shape affecting 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 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: ParticleProcessMaterial.CollisionMode must be true on the GpuParticles3D's process material for collision to work.
Note: Particle collision only affects GpuParticles3D, not CpuParticles3D.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
GpuParticlesCollisionHeightField3DConstructor
public GpuParticlesCollisionHeightField3D();Properties5
FollowCameraEnabledProperty
public bool FollowCameraEnabled { get; set; }Moves the capture region relative to its viewport current Camera3D in steps and requests updates on movement. Does not mean a new full field for every tiny camera motion.
HeightfieldMaskProperty
public uint HeightfieldMask { get; set; }Mesh render layers used to build the height field. Distinct from inherited CullMask selecting particle emitters and from physics layers. Account for capture update mode.
ResolutionProperty
public GpuParticlesCollisionHeightField3D.ResolutionEnum Resolution { get; set; }Higher resolutions can represent small details more accurately in large scenes, at the cost of lower performance. If GpuParticlesCollisionHeightField3D.UpdateMode is GpuParticlesCollisionHeightField3D.UpdateModeEnum.Always, consider using the lowest resolution possible.
SizeProperty
public Vector3 Size { get; set; }Full local capture-region dimensions, not half extents. Do not determine field resolution or guarantee representation of arbitrary 3D overhangs/tunnels.
UpdateModeProperty
public GpuParticlesCollisionHeightField3D.UpdateModeEnum UpdateMode { get; set; }Field update policy. WhenMoved refers to movement of this component; mesh motion alone does not guarantee refresh in that mode. Always requests ongoing updates with a cost.
Methods12
GetHeightfieldMaskuint
public uint GetHeightfieldMask();uintGetHeightfieldMaskValuebool
public bool GetHeightfieldMaskValue(int layerNumber);Returns true if the specified layer of the GpuParticlesCollisionHeightField3D.HeightfieldMask is enabled, given a layer_number between 1 and 20, inclusive.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
boolGetResolutionGpuParticlesCollisionHeightField3D.ResolutionEnum
public GpuParticlesCollisionHeightField3D.ResolutionEnum GetResolution();GpuParticlesCollisionHeightField3D.ResolutionEnumGetSizeVector3
public Vector3 GetSize();Vector3GetUpdateModeGpuParticlesCollisionHeightField3D.UpdateModeEnum
public GpuParticlesCollisionHeightField3D.UpdateModeEnum GetUpdateMode();GpuParticlesCollisionHeightField3D.UpdateModeEnumIsFollowCameraEnabledbool
public bool IsFollowCameraEnabled();boolSetFollowCameraEnabledvoid
public void SetFollowCameraEnabled(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetHeightfieldMaskvoid
public void SetHeightfieldMask(uint heightfieldMask);| Name | Type | Default |
|---|---|---|
heightfieldMask | uint | — |
SetHeightfieldMaskValuevoid
public void SetHeightfieldMaskValue(int layerNumber, bool value);Based on value, enables or disables the specified layer in the GpuParticlesCollisionHeightField3D.HeightfieldMask, given a layer_number between 1 and 20, inclusive.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
value | bool | — |
SetResolutionvoid
public void SetResolution(GpuParticlesCollisionHeightField3D.ResolutionEnum resolution);| Name | Type | Default |
|---|---|---|
resolution | GpuParticlesCollisionHeightField3D.ResolutionEnum | — |
SetSizevoid
public void SetSize(Vector3 size);| Name | Type | Default |
|---|---|---|
size | Vector3 | — |
SetUpdateModevoid
public void SetUpdateMode(GpuParticlesCollisionHeightField3D.UpdateModeEnum updateMode);| Name | Type | Default |
|---|---|---|
updateMode | GpuParticlesCollisionHeightField3D.UpdateModeEnum | — |
GpuParticlesCollisionHeightField3D.ResolutionEnum
| Value | Description |
|---|---|
Max = 6 | Represents the size of the |
Resolution1024 = 2 | Generate a 1024×1024 heightmap. Intended for large scenes with distant particles. |
Resolution2048 = 3 | Generate a 2048×2048 heightmap. Intended for very large scenes with distant particles. |
Resolution256 = 0 | Generate a 256×256 heightmap. Intended for small-scale scenes, or larger scenes with no distant particles. |
Resolution4096 = 4 | Generate a 4096×4096 heightmap. Intended for huge scenes with distant particles. |
Resolution512 = 1 | Generate a 512×512 heightmap. Intended for medium-scale scenes, or larger scenes with no distant particles. |
Resolution8192 = 5 | Generate a 8192×8192 heightmap. Intended for gigantic scenes with distant particles. |
GpuParticlesCollisionHeightField3D.UpdateModeEnum
| Value | Description |
|---|---|
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. |
WhenMoved = 0 | Only update the heightmap when the |