Skip to content

Conversation

@ttencate
Copy link
Contributor

@ttencate ttencate commented Oct 28, 2025

@ttencate ttencate requested a review from a team as a code owner October 28, 2025 11:52
@AThousandShips AThousandShips requested a review from a team October 28, 2025 12:25
@AThousandShips AThousandShips added enhancement documentation cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release labels Oct 28, 2025
@AThousandShips AThousandShips added this to the 4.x milestone Oct 28, 2025
Copy link
Member

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really solve the issue at hand? It still doesn't quite explain "how to use it", but it is a much better description of how it actually works.

<description>
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.
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.
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coincidentally I had to talk about "nonuniform" just a few hours ago.

Just as an addendum, we wrote "non-uniform" vastly more often than "nonuniform" (that is, not at all). Both are synonyms and apparently "nonuniform" is becoming more common, but I wouldn't drop the hyphen for the sake of clarity here.

Similarly, I see no one can make their mind on whether it's "height map" or "heightmap", the latter of which is more common and I'd keep using for consistency with the very next sentence.

Suggested change
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.
The heightmap 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 different spacing, you can adjust the [member Node3D.scale] of the shape. However, keep in mind that non-uniform 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.

I would suggest moving anything following "_If you need to use different spacing, you can adjust [...]" to a separate note below the description. This whole line currently goes from describing the heightmap shape to a whole different tangent.
Speaking of the tip itself, we do not recommend to to scale collision shapes, so I'm not sure if this advice is sound, myself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to be stubborn and change it to "height map" consistently because the class name is HeightMapShape3D, not HeightmapShape3D.

Citing the Jolt PR #99895:

Godot Physics supports scaling the transform of collision shapes, shape queries, as well as static and kinematic bodies, meaning StaticBody3D, CharacterBody3D, AnimatableBody3D and frozen RigidBody3D. It does not however support scaling simulated/dynamic bodies, such as a non-frozen RigidBody3D, and will effectively discard any such scaling, instead treating it as (1, 1, 1).

Jolt does however support scaling everywhere, and I've tried my best to utilize that, which means that RigidBody3D will support scaling when using Jolt, despite the warning shown on the node currently.

Jolt also supports non-uniform scaling, so long as the inherent primitive shape is preserved. For example, you can scale a cylinder along its height axis but not along its other axes. You will however currently see warnings on the shape node when doing this, due to Godot Physics not supporting this.

I've updated the advice to account for this.

@ttencate
Copy link
Contributor Author

Does this really solve the issue at hand? It still doesn't quite explain "how to use it", but it is a much better description of how it actually works.

Removed the "fixed".

@ttencate ttencate force-pushed the docs/height_map_shape_3d branch from 43c5452 to 2256670 Compare October 28, 2025 14:11
Copy link
Member

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need an extra opinion on the "height map" change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release documentation enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants