diff --git a/spatial/wit/wired-gltf/deps/wired-physics b/spatial/wit/wired-gltf/deps/wired-physics new file mode 120000 index 0000000..8caa253 --- /dev/null +++ b/spatial/wit/wired-gltf/deps/wired-physics @@ -0,0 +1 @@ +../../wired-physics/ \ No newline at end of file diff --git a/spatial/wit/wired-gltf/world.wit b/spatial/wit/wired-gltf/world.wit index 817b4ae..d62b947 100644 --- a/spatial/wit/wired-gltf/world.wit +++ b/spatial/wit/wired-gltf/world.wit @@ -66,6 +66,7 @@ interface mesh { interface node { use mesh.{mesh}; use wired:math/types.{transform}; + use wired:physics/types.{collider, rigid-body}; /// A reference to a node. resource node { @@ -85,6 +86,12 @@ interface node { mesh: func() -> option; set-mesh: func(value: option>); + + collider: func() -> option; + set-collider: func(value: option>); + + rigid-body: func() -> option; + set-rigid-body: func(value: option>); } list-nodes: func() -> list; diff --git a/spatial/wit/wired-input/deps/wired-physics b/spatial/wit/wired-input/deps/wired-physics new file mode 120000 index 0000000..8caa253 --- /dev/null +++ b/spatial/wit/wired-input/deps/wired-physics @@ -0,0 +1 @@ +../../wired-physics/ \ No newline at end of file diff --git a/spatial/wit/wired-physics/deps/wired-math b/spatial/wit/wired-physics/deps/wired-math new file mode 120000 index 0000000..967f496 --- /dev/null +++ b/spatial/wit/wired-physics/deps/wired-math @@ -0,0 +1 @@ +../../wired-math/ \ No newline at end of file diff --git a/spatial/wit/wired-physics/world.wit b/spatial/wit/wired-physics/world.wit new file mode 100644 index 0000000..64cd585 --- /dev/null +++ b/spatial/wit/wired-physics/world.wit @@ -0,0 +1,47 @@ +package wired:physics; + +world host { + import types; +} + +interface types { + use wired:math/types.{vec3}; + + resource collider { + constructor(shape: shape); + + density: func() -> f32; + set-density: func(value: f32); + } + + variant shape { + cuboid(cuboid), + sphere(sphere), + } + + record cuboid { + x-len: f32, + y-len: f32, + z-len: f32, + } + + record sphere { + radius: f32 + } + + resource rigid-body { + constructor(rigid-body-type: rigid-body-type); + + angvel: func() -> vec3; + set-angvel: func(value: vec3); + + linvel: func() -> vec3; + set-linvel: func(value: vec3); + } + + enum rigid-body-type { + dynamic, + fixed, + kinematic, + } +}