Reading glTF extras (e.g. from Blender custom properties) to X3D metadata, support changing shape collision mode from Blender, documentation improvements

Posted on

  1. We now read glTF extras data to X3D nodes metadata.

    In practical terms, it means that you can set custom properties in Blender, and then read it back in CGE using MetadataString and similar properties on nodes.

    We read “extras” data from glTF primitives, materials, cameras and transformation nodes. If you use Blender, it means we can read “Custom Properties” from Blender objects, meshes, materials and cameras.

    More pointers how to read custom properties defined in Blender are here. Our demo-models contain examples of Blender models with custom properties, see in subdirectories blender/custom_properties/ and blender/custom_properties_2/. Finally, reworked examples/short_api_samples/metadata shows how to read and write metadata in CGE.

  2. Our metadata API was also a bit simplified. MetadataString can now be used easier (doesn’t have an index, use it like Node.MetadataString['my_name']), but we expose MetadataStringArray when you need an array (use it like Node.MetadataStringArray['my_name', 2]).

  3. Shape.collision field supports "NONE" value. In Pascal you would set it as MyShapeNode.Collision := scNone.

  4. We support a special custom property at Blender mesh: CastleCollision. It can have these values:

    • none — do not collide
    • box — collide as box
    • default — collide as precise triangles

    See the Shape.collision field linked above for more details.

    This way you can easily turn off collisions in Blender, or set collisions to use simple box for complicated shapes. Just set Blender custom property CastleCollision on a mesh.

    Demo usage in examples/fps_game/data/example_level level. The level defined there contains everything collidable + non-collidable water surface in one model, one glTF file, and the water is marked with CastleCollision=none.

  5. Improved Detecting Memory Leaks Using HeapTrc documentation (done long time ago by Eugene Loza, now merged with notes previously in optimization manual chapter ).

  6. Documented various X3D extensions added lately to have perfect glTF support:

Start the discussion at Castle Game Engine Forum