Crates.io | vmc |
lib.rs | vmc |
version | 0.5.1 |
created_at | 2023-08-11 02:56:56.179791+00 |
updated_at | 2025-04-14 08:03:58.117674+00 |
description | Implementation of Virtual Motion Capture protocol for virtual avatar tracking. |
homepage | |
repository | https://github.com/pykeio/vmc |
max_upload_size | |
id | 941537 |
size | 94,740 |
vmc
An asynchronous implementation of the Virtual Motion Capture Protocol in Rust.
See examples/
for more detailed examples.
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?;
}
}
use tokio_stream::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(())
}
❤️ This crate is based on async-osc
by Franz Heinzmann. Licensed under MIT License or Apache-2.0.