Skip to content

Commit

Permalink
add hover input events
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Sep 6, 2024
1 parent 9ac06c4 commit 36d8f53
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
6 changes: 0 additions & 6 deletions spatial/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ Scripts use the [component model](https://github.com/WebAssembly/component-model
[WIT](https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md) interfaces defined by The Wired.
Host environments can then implement these interfaces, allowing scripts to interact with the scene in a controlled manner.

### Input

TODO.

The Wired will handle user input through a system inspired by Stardust's [SUIS](https://docs.rs/stardust-xr-fusion/latest/stardust_xr_fusion/input/index.html).

## Worlds

Worlds are created at a user's [DWN](../social/#decentralized-web-nodes-dwns), following to the [world schema](../social/dwn/schemas/world.json).
Expand Down
23 changes: 9 additions & 14 deletions spatial/wit/wired-input/types.wit
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,26 @@ interface types {

/// A line with an origin and a direction.
record ray {
origin: vec3,
orientation: quat,
}

/// A single point of interaction, such as the tip of a stylus.
record tip {
origin: vec3,
orientation: quat,
radius: f32,
}

variant input-type {
variant input-data {
hand(hand),
ray(ray),
tip(tip),
}

variant input-action {
collision,
hover,
}

record input-event {
/// Unique id for the event.
id: u64,
/// The action that created the event.
action: input-action,
/// Spatial input data.
input: input-type,
/// Distance from the input method to the handler.
distance: f32,
/// How many handlers received the event before this one.
order: u32,
data: input-data,
}
}
2 changes: 1 addition & 1 deletion spatial/wit/wired-input/world.wit
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ interface handler {

/// Handle the next recieved input event.
/// Events only last for one tick.
handle-input: func() -> option<input-event>;
next: func() -> option<input-event>;
}
}

0 comments on commit 36d8f53

Please sign in to comment.