mirror of
https://github.com/storytold/bevy-mocap.git
synced 2026-10-09 00:09:45 +00:00
add install instructions
This commit is contained in:
+1
-1
@@ -14,5 +14,5 @@ serde_json = "1"
|
||||
itertools = "0.12"
|
||||
|
||||
[dev-dependencies]
|
||||
bevy = { version = "0.12", default-features = true }
|
||||
bevy = { version = "0.12", default-features = true, features = ["file_watcher"]}
|
||||
bevy-inspector-egui = "0.22"
|
||||
|
||||
@@ -2,6 +2,20 @@
|
||||
|
||||
This is a project build for storyteller.ai, to provide support for importing ARKit data into bevy, and using it to drive shape keys.
|
||||
|
||||
## Install
|
||||
|
||||
Add this to your dependencies alongside bevy:
|
||||
```toml
|
||||
bevy = "0.12"
|
||||
bevy-facial-mocap = { git = "https://github.com/caladluin/bevy-facial-mocap" } #TODO - once ownership of the repo transfers, set this to the correct repository
|
||||
```
|
||||
|
||||
If you add the `file_watcher` feature to bevy, this also supports hot reloading:
|
||||
```toml
|
||||
bevy = { version = "0.12", default-features = true, features = ["file_watcher"]}
|
||||
```
|
||||
|
||||
|
||||
## Use
|
||||
|
||||
Import the asset loader:
|
||||
@@ -19,6 +33,7 @@ let mut player = AnimationPlayer::default();
|
||||
player.play(handle.clone()).repeat();
|
||||
```
|
||||
|
||||
|
||||
## Asset Preparation
|
||||
|
||||
To load a recording, you need 3 files:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"csv": "./20240205_shapekey_BevyImplementationFaceCap_5/shapekey_BevyImplementationFaceCap_5_ScottiPhone_cal.morph_anim.csv",
|
||||
"root_name": "pascal_Head",
|
||||
"fps": 60,
|
||||
"fps": 120,
|
||||
"mapping": "example_mapping.json"
|
||||
}
|
||||
+1
-11
@@ -275,7 +275,6 @@ impl CSVAnimation {
|
||||
let mut transform =
|
||||
Transform::from_rotation(Quat::from_euler(bevy::math::EulerRot::XYZ, 0., 0., 0.));
|
||||
|
||||
println!("TIME: {time}");
|
||||
for (mapping, csv_key) in mappings.iter() {
|
||||
let result = csv_morph_order
|
||||
.get(csv_key.as_str())
|
||||
@@ -283,7 +282,6 @@ impl CSVAnimation {
|
||||
.and_then(|i| data.morphs.get(i))
|
||||
.copied()
|
||||
.unwrap_or(0f32);
|
||||
println!("Mapping {csv_key} - {mapping:?} -> {result}");
|
||||
|
||||
let axis = match mapping.axis {
|
||||
Axis::X => Vec3::X,
|
||||
@@ -297,10 +295,7 @@ impl CSVAnimation {
|
||||
|
||||
let result = result * 180f32.to_radians() * scale + offset;
|
||||
|
||||
println!("Rotating {axis:?} by {result:?}");
|
||||
println!("From {}", transform.rotation.xyz());
|
||||
transform.rotate_axis(axis, result);
|
||||
println!("To {}", transform.rotation.xyz());
|
||||
}
|
||||
|
||||
keyframes.push(transform.rotation)
|
||||
@@ -751,7 +746,6 @@ mod tests {
|
||||
]
|
||||
.iter()
|
||||
.map(|(key, value)| {
|
||||
println!("Attempting to convert {key}");
|
||||
(serde_json::from_str(key).unwrap(), value.to_string())
|
||||
})
|
||||
.collect(),
|
||||
@@ -805,11 +799,7 @@ mod tests {
|
||||
};
|
||||
|
||||
assert_eq!(keyframes.len(), 5);
|
||||
|
||||
println!(
|
||||
"Rotations: {:?}",
|
||||
keyframes.iter().map(|v| v.xyz()).collect::<Vec<_>>()
|
||||
);
|
||||
|
||||
assert!((keyframes[0].xyz() - Vec3::new(0., 0., 0.)).length() < 0.0001);
|
||||
assert!((keyframes[1].xyz() - Vec3::new(0.5, 0.5, -0.5)).length() < 0.01);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user