Skip to content

Commit ec33701

Browse files
committed
HG16: joint limits for a SOMA body in Rust: the table measured over the library moved to SOMA (the body SDK's), with the elbow's fold read from the captures; the old rig keeps its own
1 parent 67f33b2 commit ec33701

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

‎systems/body/src/limits.rs‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,26 @@ const LIMITS: [Row; 13] = [
135135
),
136136
];
137137

138+
/// The same for a SOMA body, read from SOMA's rest pose (its bind: arms about 50 degrees under level, elbows nearly
139+
/// straight): re-measured over the capture library moved to SOMA (8,848 frames; the body SDK's table). SOMA's rest
140+
/// elbow says little of how it folds, so the way the hand goes as it folds is the captures' own.
141+
#[rustfmt::skip]
142+
const SOMA_LIMITS: [Row; 13] = [
143+
("spine_01", [-25.0, 55.0], [-20.0, 20.0], [-15.0, 15.0], Some(AHEAD), OUT),
144+
("spine_02", [-30.0, 100.0], [-30.0, 30.0], [-20.0, 20.0], Some(AHEAD), OUT),
145+
("spine_03", [-65.0, 50.0], [-30.0, 30.0], [-20.0, 20.0], Some(AHEAD), OUT),
146+
("neck_01", [-60.0, 55.0], [-40.0, 40.0], [-45.0, 45.0], Some(AHEAD), OUT),
147+
("head", [-45.0, 45.0], [-30.0, 30.0], [-45.0, 45.0], Some(AHEAD), OUT),
148+
("clavicle", [-45.0, 35.0], [-20.0, 75.0], [-40.0, 15.0], Some(AHEAD), UP),
149+
("upperarm", [-80.0, 150.0], [-70.0, 140.0], [-105.0, 80.0], Some(AHEAD), UP),
150+
("lowerarm", [-30.0, 115.0], [-25.0, 12.0], [-100.0, 70.0], Some(Vec3::new(-0.316, 0.287, 0.902)), UP),
151+
("hand", [-75.0, 60.0], [-50.0, 45.0], [-15.0, 25.0], Some(Vec3::NEG_Y), OUT),
152+
("thigh", [-50.0, 125.0], [-30.0, 65.0], [-60.0, 30.0], Some(AHEAD), OUT),
153+
("calf", [-17.0, 150.0], [-20.0, 8.0], [-15.0, 15.0], Some(Vec3::NEG_Z), OUT),
154+
("foot", [-42.0, 55.0], [-52.0, 25.0], [-25.0, 35.0], Some(UP), OUT),
155+
("ball", [-35.0, 88.0], [-55.0, 25.0], [-42.0, 40.0], Some(UP), OUT),
156+
];
157+
138158
/// a joint's axes at rest: its bone, the axes a turn about which is its flexion and its side bend, and the hand its
139159
/// twist is read by (+1 on the left and the midline)
140160
struct Axes {
@@ -150,7 +170,8 @@ fn axes(skel: &Skeleton, i: usize) -> Option<Axes> {
150170
let named = crate::rig::role_name(&j.name);
151171
let right = named.ends_with("_r");
152172
let role = named.trim_end_matches("_l").trim_end_matches("_r");
153-
let row = LIMITS.iter().find(|r| r.0 == role)?;
173+
// (a SOMA joint's name is not its role)
174+
let row = if named == j.name { &LIMITS } else { &SOMA_LIMITS }.iter().find(|r| r.0 == role)?;
154175
let mirror = |v: Vec3| if right { Vec3::new(-v.x, v.y, v.z) } else { v };
155176
let dir = |k: usize| (skel.joints[k].tail - skel.joints[k].head).normalize();
156177
let bone = dir(i);

0 commit comments

Comments
 (0)