godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add a property which control tile size on `HeightMapShape3D` #3870

Open Chaosus opened 2 years ago

Chaosus commented 2 years ago

Describe the project you are working on

RTS

Describe the problem or limitation you are having in your project

I want to have control over the size of the tile on the physical mesh generated by HeighMapShape3D.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add a simple tile_size property to it.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

I'm not entirely sure whether it is easy to do because it should correctly interact with a Physics engine.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No

Is there a reason why this should be core and not an add-on in the asset library?

It's an enhancement for the core physic class.

mohsenph69 commented 1 year ago

Any news about this yet

Calinou commented 1 year ago

Any news about this yet

To my knowledge, nobody has looked into implementing this yet. It's probably not very difficult, but note that 4.1 is currently in feature freeze.

HeightMapShape3D's code is here: https://github.com/godotengine/godot/blob/f2ce0b6741049b69efb455394b8a161f68a468a6/scene/resources/height_map_shape_3d.cpp#L12

mohsenph69 commented 1 year ago

I wish they add this feature right now Heightmap collision can be created like this: (width_of_heightmap - 1 = terrain_width) same thing for height but if you have a terrain with 1px per 2 meter it is not make any sense to create a collision shape with formula above The only solution now is to scale height-map collision shape which is not the best solution

The back-end code is in physics server https://github.com/godotengine/godot/blob/f2ce0b6741049b69efb455394b8a161f68a468a6/servers/physics_3d/godot_shape_3d.h I look at it but I am not sure what is happening It could have something with static const int BOUNDS_CHUNK_SIZE = 16; But I am not sure