Skip to content

Add cell_size to HeightMapShape3D #107617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft

Conversation

mthaddon
Copy link

@mthaddon mthaddon commented Jun 17, 2025

Closes godotengine/godot-proposals#3870 - adding a cell_size property to HeightMapShape3D.

@mthaddon
Copy link
Author

This seems to correctly size the debug outlines, but not the heightmapshape itself. I think it's because I'm doing this:

void HeightMapShape3D::_update_shape() {
    Dictionary d; 
    d["width"] = map_width;
    d["depth"] = map_depth; 
    d["heights"] = map_data;
    d["min_height"] = min_height;
    d["max_height"] = max_height;
    d["tile_size"] = tile_size;
    PhysicsServer3D::get_singleton()->shape_set_data(get_shape(), d);
    Shape3D::_update_shape();
}

I've added "tile_size" in here, but I think I'll need to update something in shape_set_data to actually do something with that.

@mthaddon
Copy link
Author

Ok, seems like https://github.com/godotengine/godot/blob/master/modules/godot_physics_3d/godot_shape_3d.cpp#L1675 is significant, will look into that

@mthaddon
Copy link
Author

mthaddon commented Jun 17, 2025

This still isn't working as expected. I'll keep looking at it, but if anyone more familiar with the code can point me in the right direction that'd be great 👍 Alternatively any pointers for how to see the location of the generated collision shape itself (not the debug outlines which already seem to be what we want) would be appreciated.

I thought I could just change the AABB size and the _get_point inline function in modules/godot_physics_3d/godot_shape_3d.{cpp,h}, but this doesn't seem to work.

@akien-mga akien-mga changed the title Add tile_size to HeightMapShape3D Add tile_size to HeightMapShape3D Jun 18, 2025
@akien-mga akien-mga changed the title Add tile_size to HeightMapShape3D Add cell_size to HeightMapShape3D Jun 18, 2025
@AThousandShips
Copy link
Member

AThousandShips commented Jun 19, 2025

Please avoid pushing several times in a row, make sure you've finished adding new changes before you push (Will run CI once you're done)

@mthaddon
Copy link
Author

I'm trying a different approach, which is to update map_data in place before passing it to the physics shape for rendering. Not working as expected yet, but wanted to push up changes while I keep working on it.

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

Successfully merging this pull request may close these issues.

Add a property which control tile size on HeightMapShape3D
2 participants