Skip to content

Commit

Permalink
add wired-physics
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Jun 29, 2024
1 parent b9622a1 commit c59c050
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions spatial/wit/wired-gltf/deps/wired-physics
7 changes: 7 additions & 0 deletions spatial/wit/wired-gltf/world.wit
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -85,6 +86,12 @@ interface node {

mesh: func() -> option<mesh>;
set-mesh: func(value: option<borrow<mesh>>);

collider: func() -> option<collider>;
set-collider: func(value: option<borrow<collider>>);

rigid-body: func() -> option<rigid-body>;
set-rigid-body: func(value: option<borrow<rigid-body>>);
}

list-nodes: func() -> list<node>;
Expand Down
1 change: 1 addition & 0 deletions spatial/wit/wired-input/deps/wired-physics
1 change: 1 addition & 0 deletions spatial/wit/wired-physics/deps/wired-math
47 changes: 47 additions & 0 deletions spatial/wit/wired-physics/world.wit
Original file line number Diff line number Diff line change
@@ -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,
}
}

0 comments on commit c59c050

Please sign in to comment.