Expand description
§vmc
An asynchronous implementation of the Virtual Motion Capture Protocol in Rust.
While this crate is intended specifically for Virtual Motion Capture, it can also be used as an implementation of
the Open Sound Control protocol which VMC is based on; see crate::osc
.
§Examples
See examples/
for more detailed examples.
§Performer
use vmc::{
VMCApplyBlendShapes, VMCBlendShape, VMCModelState, VMCResult, VMCStandardVRMBlendShape, VMCState, VMCTime
};
#[tokio::main]
async fn main() -> VMCResult<()> {
let socket = vmc::performer!("127.0.0.1:39539").await?;
loop {
socket.send(VMCBlendShape::new(VMCStandardVRMBlendShape::Joy, 1.0)).await?;
socket.send(VMCApplyBlendShapes).await?;
socket.send(VMCState::new(VMCModelState::Loaded)).await?;
socket.send(VMCTime::elapsed()).await?;
}
}
§Marionette
use tokio_stream::StreamExt;
use vmc::{VMCMessage, VMCResult};
#[tokio::main]
async fn main() -> VMCResult<()> {
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 {
VMCMessage::BoneTransform(transform) => {
println!(
"\tTransform bone: {} (pos {:?}; rot {:?})",
transform.bone, transform.position, transform.rotation
)
}
_ => {}
}
}
}
Ok(())
}
§License
❤️ This package is based on rosc
by Andreas Linz and
async-osc
by Franz Heinzmann. Licensed under MIT License or Apache-2.0.
Re-exports§
pub use self::message::ApplyBlendShapes as VMCApplyBlendShapes;
pub use self::message::BlendShape as VMCBlendShape;
pub use self::message::BoneTransform as VMCBoneTransform;
pub use self::message::CalibrationMode as VMCCalibrationMode;
pub use self::message::CalibrationState as VMCCalibrationState;
pub use self::message::DeviceTransform as VMCDeviceTransform;
pub use self::message::DeviceType as VMCDeviceType;
pub use self::message::ModelState as VMCModelState;
pub use self::message::RootTransform as VMCRootTransform;
pub use self::message::StandardVRM0Bone as VMCStandardVRM0Bone;
pub use self::message::StandardVRMBlendShape as VMCStandardVRMBlendShape;
pub use self::message::State as VMCState;
pub use self::message::Time as VMCTime;
pub use self::message::TrackingState as VMCTrackingState;
pub use self::message::VMCMessage;
pub use self::message::parse;
pub use self::osc::IntoOSCArgs;
pub use self::osc::IntoOSCMessage;
pub use self::osc::IntoOSCPacket;
pub use self::osc::OSCPacket;
pub use self::osc::OSCType;
Modules§
- Submodule for Virtual Motion Capture-specific messages.
- Implements OSC types and packet encoding/decoding.
Macros§
- Creates a new VMC Marionette. Marionettes receive motion data from a
performer
and render the avatar to a screen. - Creates a new VMC Performer. Performers process tracking, motion, and IK, and send bone transforms and other information to a
marionette
.
Structs§
- A quaternion representing an orientation.
- A sender to send messages over a VMC socket.
- A UDP socket to send and receive VMC messages.
- A 3-dimensional vector.
- A 3-dimensional vector.
Enums§
- Euler rotation sequences.