gltf-extensions icon indicating copy to clipboard operation
gltf-extensions copied to clipboard

OMI_physics_gravity

Open aaronfranke opened this issue 2 months ago • 0 comments

This PR adds a new extension OMI_physics_gravity, and also adds a .prettierrc.json file.

Preview: https://github.com/aaronfranke/gltf-extensions/tree/OMI_physics_gravity/extensions/2.0/OMI_physics_gravity

Implementation: https://github.com/omigroup/omi-godot/pull/5

This extension allows specifying gravity volumes on trigger glTF nodes and specifying the global world gravity at the document level.

Global world gravity is always directional. A document-level extension may define the magnitude and direction of the global world gravity. Only one or zero instanced glTF files should have the document-level extension. The intention is to use the document-level extension only on the main "map" glTF. If multiple glTF files have the document-level gravity extension, use the most recently instanced glTF model's gravity (when instancing, override the previous gravity).

For a per-node gravity volume, the OMI_physics_gravity extension MUST be defined on an OMI_physics_body node that has a trigger property and does not have motion or collider properties. The shape of where the gravity influence is experienced is defined by the trigger shapes. The details of which way the gravity points can be specified in a variety of types, which are described in more detail in the README and schemas.

Whether or not a rigid body is influenced by a gravity volume is determined by the priority/replace/stop settings of each gravity volume the body is inside of. The priority integer determines the order in which gravity volumes are calculated, with higher values being calculated first, and the global world gravity is always calculated last. The replace boolean controls whether or not to keep gravity already calculated so far from higher priority nodes. The stop boolean controls whether or not to continue calculating gravity from any lower priority nodes and the global world gravity.

aaronfranke avatar Apr 05 '24 04:04 aaronfranke