armory3d / armory

3D Engine with Blender Integration
https://armory3d.org
zlib License
3.05k stars 317 forks source link

Overhead when static rigid bodies are overlapping #2043

Open knowledgenude opened 3 years ago

knowledgenude commented 3 years ago

I think they should not collide between, except if they are triggers. I think this behavior is not good because will not be possible to create primitive shapes for more complex objects. Collision groups may help here for now.

  1. Press play: static-rb-test.zip;
  2. Alt + G to set all cubes to the same place;
  3. Press play again;
  4. Physics is dead.

Maybe this is related to the physics "bug" here: https://forums.armory3d.org/t/snorkel-explorer-an-educational-interactive-experience-and-my-first-armory-release/4237/2

QuantumCoderQC commented 3 years ago

@knowledgenude Thanks for bringing this up. The issue you mentioned occurs when all the rigid bodies are exactly in the same position and overlap completely. Then, yes the physics breaks. When all the rigid bodies are partially overlapping, the game runs but lags. This is because of the way the bullet solver solves the rigid body collisions. In the case of Armory3D, we use btDbvtBroadphase solver. More info about the solvers can be found at Bullet Physics Official Manual on pages 17-18.

As for combining multiple rigid body primitives, there is a special type of rigidbody called btCompundShape. This allows you to efficiently combine multiple RB's to create one large rigid body. This is not implemented yet in Armory yet though.

That said, I do agree that there could be some places where the integration or the implementation of Bullet Physics in Armory could be improved. However, it is a challenging task since not all Bullet's methods and types are available to both JS and HL targets.