Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
HG16: the role and SOMA names kept in one table (rig.rs TRUNK, LIMB), read both ways
shinyobjectz2ebe989c0583
diff --git a/systems/body/src/rig.rs b/systems/body/src/rig.rsindex 960b5d68..cb709250 100644--- a/systems/body/src/rig.rs+++ b/systems/body/src/rig.rs@@ -210,22 +210,23 @@ pub fn hand_rest(skel: &Skeleton, s: Side) -> Option<HandRest> {Some(HandRest { along, palm, mid: middle + palm * if skin > 0.0 { skin } else { 0.012 } })}+/// the trunk's joints, and a limb's without their side: each role (the game_engine rig's name) and SOMA's name+pub const TRUNK: [(&str, &str); 6] = [("pelvis", "Hips"), ("spine_01", "Spine1"), ("spine_02", "Spine2"), ("spine_03", "Chest"), ("neck_01", "Neck1"), ("head", "Head")];+pub const LIMB: [(&str, &str); 8] = [("clavicle", "Shoulder"), ("upperarm", "Arm"), ("lowerarm", "ForeArm"), ("hand", "Hand"), ("thigh", "Leg"), ("calf", "Shin"), ("foot", "Foot"), ("ball", "ToeBase")];+/// SOMA's name for a joint named by its role: the trunk by name, limbs and fingers by side. A finger's 01, 02, 03/// are SOMA's 2, 3, 4 (its 1 is the bone in the palm); the thumb's are 1, 2, 3. The other way is soma.rs `raea_joint`.pub fn soma_name(role: &str) -> Option<String> {- let trunk = [("pelvis", "Hips"), ("spine_01", "Spine1"), ("spine_02", "Spine2"), ("spine_03", "Chest"), ("neck_01", "Neck1"), ("head", "Head")];- if let Some(t) = trunk.iter().find(|t| t.0 == role) {+ if let Some(t) = TRUNK.iter().find(|t| t.0 == role) {return Some(t.1.to_string());}let (base, side) = role.strip_suffix("_l").map(|b| (b, "Left")).or_else(|| role.strip_suffix("_r").map(|b| (b, "Right")))?;- let limb = [("clavicle", "Shoulder"), ("upperarm", "Arm"), ("lowerarm", "ForeArm"), ("hand", "Hand"), ("thigh", "Leg"), ("calf", "Shin"), ("foot", "Foot"), ("ball", "ToeBase")];- if let Some(l) = limb.iter().find(|l| l.0 == base) {+ if let Some(l) = LIMB.iter().find(|l| l.0 == base) {return Some(format!("{side}{}", l.1));}let (finger, k) = base.split_once("_0")?;- let k: usize = k.parse().ok()?;- let name = format!("{}{}", finger[..1].to_uppercase(), &finger[1..]);- ["Thumb", "Index", "Middle", "Ring", "Pinky"].contains(&name.as_str()).then(|| format!("{side}Hand{name}{}", if name == "Thumb" { k } else { k + 1 }))+ let (k, thumb) = (k.parse::<usize>().ok()?, finger == "thumb");+ ["thumb", "index", "middle", "ring", "pinky"].contains(&finger).then(|| format!("{side}Hand{}{}{}", finger[..1].to_uppercase(), &finger[1..], if thumb { k } else { k + 1 }))}/// a joint's role (as `Skeleton::joint` takes one) from its name on either rigdiff --git a/systems/body/src/soma.rs b/systems/body/src/soma.rsindex 9d8ab428..78c3fdf0 100644--- a/systems/body/src/soma.rs+++ b/systems/body/src/soma.rs@@ -11,7 +11,7 @@ use glam::{Mat3, Quat, Vec3};use crate::arm::settle_hinge;use crate::fit::{Mark, fit};-use crate::rig::{Pose, Side, Skeleton};+use crate::rig::{LIMB, Pose, Side, Skeleton, TRUNK};/// where the middle of SOMA's eyes is from its head joint in its bind pose (somaskel's T-pose), centimetresconst SOMA_EYES: Vec3 = Vec3::new(0.0, 5.371, 7.573);@@ -19,14 +19,12 @@ const SOMA_EYES: Vec3 = Vec3::new(0.0, 5.371, 7.573);/// raea's joint for a SOMA joint: the trunk and head by name, limbs and fingers by side. A SOMA finger's 2, 3, 4 are/// raea's 01, 02, 03 (its 1 is the metacarpal, which raea's hand has none of); the thumb's are 1, 2, 3.pub fn raea_joint(soma: &str) -> Option<String> {- let trunk = [("Hips", "pelvis"), ("Spine1", "spine_01"), ("Spine2", "spine_02"), ("Chest", "spine_03"), ("Neck1", "neck_01"), ("Head", "head")];- if let Some(t) = trunk.iter().find(|t| t.0 == soma) {- return Some(t.1.to_string());+ if let Some(t) = TRUNK.iter().find(|t| t.1 == soma) {+ return Some(t.0.to_string());}let (side, rest) = soma.strip_prefix("Left").map(|r| ("l", r)).or_else(|| soma.strip_prefix("Right").map(|r| ("r", r)))?;- let limb = [("Shoulder", "clavicle"), ("Arm", "upperarm"), ("ForeArm", "lowerarm"), ("Hand", "hand"), ("Leg", "thigh"), ("Shin", "calf"), ("Foot", "foot"), ("ToeBase", "ball")];- if let Some(l) = limb.iter().find(|l| l.0 == rest) {- return Some(format!("{}_{side}", l.1));+ if let Some(l) = LIMB.iter().find(|l| l.1 == rest) {+ return Some(format!("{}_{side}", l.0));}let finger = rest.strip_prefix("Hand")?;let (name, n) = finger.split_at(finger.len().checked_sub(1)?);