Expand description
An asynchronous implementation of the Virtual Motion Capture Protocol in Rust.
§Performer
use vmc::{ApplyBlendShapes, BlendShape, ModelState, StandardVRMBlendShape, State, Time};
#[tokio::main]
async fn main() -> vmc::Result<()> {
let socket = vmc::performer!("127.0.0.1:39539").await?;
loop {
socket.send(BlendShape::new(StandardVRMBlendShape::Joy, 1.0)).await?;
socket.send(ApplyBlendShapes).await?;
socket.send(State::new(ModelState::Loaded)).await?;
socket.send(Time::elapsed()).await?;
}
}
§Marionette
use futures_util::StreamExt;
use vmc::Message;
#[tokio::main]
async fn main() -> vmc::Result<()> {
let mut socket = vmc::marionette!("127.0.0.1:39539").await?;
while let Some(packet) = socket.next().await {
let (packet, _) = packet?;
for message in vmc::parse(packet)? {
match message {
Message::BoneTransform(transform) => {
println!(
"\tTransform bone: {} (pos {:?}; rot {:?})",
transform.bone, transform.position, transform.rotation
)
}
_ => {}
}
}
}
Ok(())
}
Re-exports§
pub extern crate rosc;
pub use self::message::ApplyBlendShapes;
pub use self::message::BlendShape;
pub use self::message::BoneTransform;
pub use self::message::DeviceTransform;
pub use self::message::Message;
pub use self::message::RootTransform;
pub use self::message::State;
pub use self::message::Time;
pub use self::message::parse;
Modules§
- message
- Submodule for Virtual Motion Capture-specific messages.
Macros§
- marionette
- Creates a new VMC Marionette. Marionettes receive motion data from a
performer
and render the avatar to a screen. - performer
- Creates a new VMC Performer. Performers process tracking, motion, and IK, and send bone transforms and other
information to a
marionette
.
Structs§
- Quat
- VMCSender
- A sender to send messages over a VMC socket.
- VMCSocket
- A UDP socket to send and receive VMC messages.
- Vec3
Enums§
- Calibration
Mode - Calibration
State - Device
Type - The type of device used in
crate::DeviceTransform
(HMD, controller, or independent tracker). - Error
- Model
State - Loading state of the virtual avatar on the sender’s side.
- StandardVR
M0Bone - Standard bones used by VRM 0.x.
- StandardVRM
Blend Shape - Standard blend shapes, in VRM 0.x format.
- Tracking
State - Quality of tracking.