GithubHelp home page GithubHelp logo

vitri-ent / vmc Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 75 KB

Rust implementation of Virtual Motion Capture protocol

Home Page: https://docs.rs/vmc

License: Apache License 2.0

Rust 100.00%
vmc virtual-motion-capture vrm

vmc's Introduction

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.

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.

vmc's People

Contributors

decahedron1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.