stephengold / Libbulletjme

A JNI interface to Bullet Physics and V-HACD
https://stephengold.github.io/Libbulletjme/lbj-en/English/overview.html
Other
84 stars 10 forks source link

[Question] Which collision form should I use? #31

Closed CrazyWords1 closed 3 months ago

CrazyWords1 commented 3 months ago

I need some advice.

I use bullet for my minecraft server, models use the original format which is written in .json, models consist of cubes (box).

What form of collision do you recommend? I suppose CompoundCollisionShape[...BoxCollisionShapes], can I be right?

There are usually 10 to 1000 cubes in these models.

P.S ( I will provide a screenshot and .json file of the test model for you )

MODEL File -> pyramid.json изображение

stephengold commented 3 months ago

The Minecraft worlds I've seen were composed of thousands of equal-sized, axis-aligned, cubes arranged in a grid.

You describe a model composed of 10-to-1000 cubes or boxes. However, "cube" is a special case of "box", not a synonym, so immediately there's some confusion and uncertainty.

The shape depicted consists of 8 boxes (not 10-to-1000, not cubes) of varying sizes (not equal-sized) and varying orientations (not axis-aligned). My confusion intensifies.

Because the discrepancies between my understanding of Minecraft, your words, and your picture, I'm not 100% confident I understand you're asking about.

For the pyramid depicted, a compound of 8 box collision shapes, such as you supposed, seems a good choice. The other collision shape to consider (assuming the pyramid does not move) would be MeshCollisionShape. Without testing them both in a realistic setting, I can't predict which shape would perform better.

For worlds composed of thousands of equal-sized, axis-aligned, cubes arranged in a grid, further optimizations are possible.

CrazyWords1 commented 3 months ago

I made a mistake when I equated cubes with “boxes.” I realize I may have misled you, let me try to explain what I mean.

The world of minecraft itself is really made up of “cubes”, they are all the same size.

Also, in minecraft there is a possibility to add your own entities (models), they consist of “boxes”, these boxes with different turns, and sizes. The model described in pyramid.json, is not a block in the usual sense of Minecraft, it is an additional model (entity) that can be spawned in the game world.

When I talked about 10 - 1000 cubes, I meant the boxes that usually make up a model (like pyramid.json).

stephengold commented 3 months ago

Does the pyramid entity move, or is it fixed in place?

CrazyWords1 commented 3 months ago

Yes, in my case, entities can moves

stephengold commented 3 months ago

For the entity depicted, a compound of 8 box collision shapes, such as you supposed, seems the best choice.

CrazyWords1 commented 3 months ago

For the entity depicted, a compound of 8 box collision shapes, such as you supposed, seems the best choice.

Thanks for your replies, it was a pleasure to chat, I think this issue can be closed