Replies: 5 comments
-
The API doesn't really have the concept of chunk sections... is it worth adding that just for this? Is there anywhere else in the API that could use chunk sections that would increase the use of such an API? Could you describe a little more about your usecase for this API? Like what are you doing that couldn't be accomplished with more method calls to check if air blocks exist at all locations in a volume? |
Beta Was this translation helpful? Give feedback.
-
My goal is to generate a physics collision shape for a chunk just-in-time for a rigid body, from an external physics engine, to be able to collide with the terrain. I want this process to be as fast as possible, since there might potentially be thousands of bodies intersecting hundreds or thousands of chunks. So I want to prune out chunk sections that don't have any blocks earlier on. In my opinion this is more about keeping consistency between Chunk and ChunkSnapshot, rather than introducing the concept of segments into the API. |
Beta Was this translation helpful? Give feedback.
-
I'm not opposed to it, mainly on the consistency basis. I think such a method should probably come with a helper method on Chunk & ChunkSnapshot to convert a y coordinate into a chunk section index, or maybe all section-related methods should just take a y coordinate to not really bother with section indices. |
Beta Was this translation helpful? Give feedback.
-
That makes sense, although I couldn't come up with a good name for a method which takes a Y coordinate as opposed to a segment coordinate ( |
Beta Was this translation helpful? Give feedback.
-
It can't be a static method because it has to have the world height, specifically the min height, so it'd have to be an instance method. But essentially that, yeah. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem?
Chunk
doesn't have aisSectionEmpty(int)
method to check if a 16x16x16 slice of that chunk is just filled with airDescribe the solution you'd like.
ChunkSnapshot
class has access toisSectionEmpty(int): boolean
, and internally it reads itsempty
field. This is populated by:could this
cs[i].hasOnlyAir()
be exposed to the Chunk API as well? I suggest keeping it the same method signature as forChunkSnapshot
Describe alternatives you've considered.
isSectionEmpty
of that, but that's very slow relative to just reading a field from the underlying chunk handle; why make a whole snapshot for it?Other
No response
Beta Was this translation helpful? Give feedback.
All reactions