kripken / ammo.js

Direct port of the Bullet physics engine to JavaScript using Emscripten
Other
4.15k stars 558 forks source link

issue compound object #434

Closed suddenly4 closed 3 days ago

suddenly4 commented 3 days ago
  1. When moving a compound object that contains a cube, it changes its geometry and dimensions.

  2. The same problem if later, after adding to the world, when trying to completely replace compound objects (or update them - ".setWorldTransform(newTransform);") or separately child using the methods "compoundShape.removeChildShapeByIndex();" and adding a cube to a ready compound object using the method: "compoundShape.addChildShape (transform1, shape1);" in the end there will be the same thing, the cube due to some error loses its proportions of a solid body when it is in a compound, and there is also no way to adjust it separately, it is not affected by: ".setMargin( 0.05 );"

  3. There are no methods in the port: .getChildTransform()

example https://jsfiddle.net/suddenly4/f6dxveky/

suddenly4 commented 3 days ago

I understood what the matter was. When changing the transformation of the physical body, it was necessary to set the division by 2 again. Then the geometry will be adequate in the physical body of the composite object. ... let shape1 = new Ammo.btBoxShape(new Ammo.btVector3(5/2, 1/2, 1/2)); compoundShape.addChildShape (transform1, shape1);