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
CH16a, CH18a: done: acts and controllers carried out by the matcher on SOMA, and the takes running on a SOMA body (a joint found by its role on either rig: rig.rs soma_name, role_name; holds within 2 to 8 mm in the audit's six takes, the fingers not yet fitted to SOMA's hand)
shinyobjectzd2f6ec083182
diff --git a/docs/character.feature b/docs/character.featureindex 2a05163b..5e0c4299 100644--- a/docs/character.feature+++ b/docs/character.feature@@ -140,6 +140,28 @@ Feature: The character SDK as one system: SOMA bodies, Kimodo motion, generatedAnd a controller may ask for a step the library cannot play; the character does the nearest it can, and theask is logged for CH15+ @done+ Scenario: CH16a. Acts, and controllers that return them, carried out by the matcher on SOMA+ # 11-15. sdk/body's stage module: an act is go (to a point or through several, at a gait), wait, or look+ # (at a point, a named character, or nothing). `direct` plays a cast for some seconds: each character's+ # controller is asked when its acts run out (and at the start), told where it and every other character+ # is and the time; go and wait become the matcher's steps, look is laid on the pose by the look solver.+ # Controllers so far: `script` (a fixed list), `keepNear` (stay within a reach of another character,+ # looking at it), and `actsFrom`, which reads acts from outside data (a language model's JSON) and keeps+ # only those in the vocabulary. Shown with two SOMA bodies: one follows a script, the other's controller+ # was asked 16 times in 26 seconds and kept him near her. The same cast and seconds give the same frames.+ # Not in the vocabulary yet: face, take, put, throw, hand over, sit, rise, use, and do (a line of text+ # made into a clip, which waits on CH11). A controller's unmet ask is not logged yet (CH15).+ Then a script and a controller give acts in one vocabulary and the matcher carries them out++ @done+ Scenario: CH18a. The takes run on a SOMA body+ # 11-15. The Rust arms and hands (docs/hands.feature) find a joint by its role on either rig, so reach,+ # grab, carry and throw run on SOMA with no second copy. The audit's six takes on SOMA's skin: holds+ # within 2 to 8 mm and no body skin in a carried thing, as on the old rig; the fingers are not tuned to+ # SOMA's hand (hand skin 22 mm into a box, no pads on a cup, 41 to 47 mm into the table as a hand leaves).+ Then a take runs on SOMA, its fingers still to be fitted to SOMA's hand+Scenario: CH18. What a clip cannot know is added on top, and measured# docs/hands.feature (reach, grab, carry, throw, look), feet and seat contacts (character.md layer 4).Then hands, eyes and contacts are laid over the matched pose by IK, each reporting how far it moved the posediff --git a/systems/body/src/limits.rs b/systems/body/src/limits.rsindex c3b634ed..6912c523 100644--- a/systems/body/src/limits.rs+++ b/systems/body/src/limits.rs@@ -147,8 +147,9 @@ struct Axes {fn axes(skel: &Skeleton, i: usize) -> Option<Axes> {let j = &skel.joints[i];- let right = j.name.ends_with("_r");- let role = j.name.trim_end_matches("_l").trim_end_matches("_r");+ let named = crate::rig::role_name(&j.name);+ let right = named.ends_with("_r");+ let role = named.trim_end_matches("_l").trim_end_matches("_r");let row = LIMITS.iter().find(|r| r.0 == role)?;let mirror = |v: Vec3| if right { Vec3::new(-v.x, v.y, v.z) } else { v };let dir = |k: usize| (skel.joints[k].tail - skel.joints[k].head).normalize();diff --git a/systems/body/src/rig.rs b/systems/body/src/rig.rsindex d3b88f93..960b5d68 100644--- a/systems/body/src/rig.rs+++ b/systems/body/src/rig.rs@@ -109,8 +109,10 @@ impl Skeleton {Ok(skel)}+ /// A joint by its name, or by its role: the roles are spelt as the game_engine rig named its joints ("thigh_l",+ /// "spine_03", "index_02_r"), and on a SOMA body a role finds SOMA's joint for it (docs/character.feature CH1).pub fn joint(&self, name: &str) -> Option<usize> {- self.index.get(name).copied()+ self.index.get(name).copied().or_else(|| self.index.get(soma_name(name)?.as_str()).copied())}fn three(&self, names: [String; 3]) -> Option<[usize; 3]> {@@ -208,6 +210,29 @@ 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 } })}+/// 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) {+ 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) {+ 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 }))+}++/// a joint's role (as `Skeleton::joint` takes one) from its name on either rig+pub fn role_name(name: &str) -> String {+ crate::soma::raea_joint(name).unwrap_or_else(|| name.to_string())+}+/// A stand-in body of the rig's joints at an adult's proportions (1.81 m), so the solvers run with no character on/// disk: tests, examples, and a scene that hasn't loaded its body yet. A real character brings its own skeleton.json.pub fn mannequin() -> Skeleton {diff --git a/systems/grab/src/take.rs b/systems/grab/src/take.rsindex bd02ff06..e874fec5 100644--- a/systems/grab/src/take.rs+++ b/systems/grab/src/take.rs@@ -470,7 +470,7 @@ pub fn perform(skel: &Skeleton, base: &dyn Fn(f32) -> Pose, take: &Take, t: f32)// body has it: each hand's own arm by its own part, the rest of the body by the hand most onlet mut most = 0.0f32;// a joint of a side's arm or hand (its legs aren't)- let of_arm = |name: &str, side: &str| name.ends_with(side) && !["thigh", "calf", "foot", "ball"].iter().any(|leg| name.starts_with(leg));+ let of_arm = |name: &str, side: &str| raea_sys_body::rig::role_name(name).ends_with(side) && !["thigh", "calf", "foot", "ball"].iter().any(|leg| raea_sys_body::rig::role_name(name).starts_with(leg));let sides: Vec<String> = holds.iter().map(|h| format!("_{}", h.0.hold.side.sx())).collect();for (&(part, _, away, ..), side) in holds.iter().zip(&sides) {let w = smooth(span(t, part.start, part.start + 0.15)) * (1.0 - smooth(span(away, 0.45, 1.0)));