Moguri / blend2bam

A CLI tool to convert Blender blend files to Panda3D BAM files
MIT License
66 stars 17 forks source link

Compound physics bodies not supported #55

Open Clockwork-Muse opened 3 years ago

Clockwork-Muse commented 3 years ago

Blender 2.91+ supports compound physics bodies: image

During blender sim: image

... but the converter doesn't recognize the type:

Unknown collision shape (COMPOUND) for object (Cube)
Could not create collision shape for object (Cube)

Panda node tree:

ModelRoot Scene T:(pos 0 -2 1) S:(LightAttrib)
  PandaNode Cube
    GeomNode Cube (1 geoms: S:(CullFaceAttrib MaterialAttrib TextureAttrib))
    PandaNode Cube.001 T:m(pos 0.225866 0 0)
      BulletRigidBodyNode Cube.001 (1 shapes) active mass=1
        GeomNode Cube.001 (1 geoms: S:(MaterialAttrib TextureAttrib))
    PandaNode Torus T:m(pos 0 0.207598 0)
      BulletRigidBodyNode Torus (1 shapes) active mass=1
        GeomNode Torus (1 geoms: S:(MaterialAttrib TextureAttrib))

... and because of that, the object falls apart: image

Sample blender file

rdb commented 3 years ago

For the record, in Panda, a compound shape is made by simply attaching multiple CollisionSolid objects to the same CollisionNode, so it should be supportable.

Moguri commented 3 years ago

Compound shapes are also supported by the glTF extension being used for collision shapes. In other words, this should be a pretty straightforward add. However, both blend2bam and panda3d-gltf would need to be updated.

Clockwork-Muse commented 3 years ago

For the record, in Panda, a compound shape is made by simply attaching multiple CollisionSolid objects to the same CollisionNode, so it should be supportable.

I'm aware (and of the way to do it in Bullet), but it means I have to write the code to do it until the exporters are updated.