Skip to content

Commit 43c5452

Browse files
committed
Improve HeightMapShape3D documentation
Fixes godotengine/godot-docs#7471
1 parent c0c1c68 commit 43c5452

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

doc/classes/HeightMapShape3D.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
A 3D height map shape used for physics collision.
55
</brief_description>
66
<description>
7-
A 3D heightmap shape, intended for use in physics. Usually used to provide a shape for a [CollisionShape3D]. This type is most commonly used for terrain with vertices placed in a fixed width grid. Due to the nature of the heightmap, it cannot be used to model overhangs or caves, which would require multiple vertices at the same vertical location. Holes can be punched through the collision by assigning [constant @GDScript.NAN] to the height of the desired vertices (this is supported in both GodotPhysics3D and Jolt Physics). You could then insert meshes with their own separate collision to provide overhangs, caves, and so on.
7+
A 3D heightmap shape, intended for use in physics to provide a shape for a [CollisionShape3D]. This type is most commonly used for terrain with vertices placed in a fixed width grid.
8+
The height map is represented as a 2D grid of height values, which represent the offset of grid points on the Y axis. Internally, each grid square is divided into two triangles. The grid is centered on the origin of the [HeightMapShape3D] node. Grid points are spaced 1 unit apart on the X and Z axes. If you need to use a different spacing, you can adjust the [member Node3D.scale] of the shape. However, keep in mind that nonuniform scales are not supported: you'll need to scale the Y axis by the same amount as the X and Z axes, which means the values in [member map_data] will need to be pre-scaled by the inverse of that scale.
9+
Due to the nature of the heightmap, it cannot be used to model overhangs or caves, which would require multiple vertices at the same vertical location. Holes can be punched through the collision by assigning [constant @GDScript.NAN] to the height of the desired vertices (this is supported in both GodotPhysics3D and Jolt Physics). You could then insert meshes with their own separate collision to provide overhangs, caves, and so on.
810
[b]Performance:[/b] [HeightMapShape3D] is faster to check collisions against than [ConcavePolygonShape3D], but it is significantly slower than primitive shapes like [BoxShape3D].
911
A heightmap collision shape can also be built by using an [Image] reference:
1012
[codeblocks]

0 commit comments

Comments
 (0)