Skip to content

armgit / raea

Public Imported from GitHub
0

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.

HG14: the hand's clearance from solids and its back-off from a hold ease in (both had a corner that showed as a kink in the arm's speed); the audit prints every joint jump over POPS degrees a second. The box take's worst jump 419 to 328

shinyobjectz31876c7d1c6a
diff --git a/systems/grab/src/take.rs b/systems/grab/src/take.rs
index a439aba2..bd02ff06 100644
--- a/systems/grab/src/take.rs
+++ b/systems/grab/src/take.rs
@@ -355,7 +355,7 @@ pub fn perform(skel: &Skeleton, base: &dyn Fn(f32) -> Pose, take: &Take, t: f32)
let (at, turn) = level;
// the wrist's path: from where the body has it, in onto the hold from off the surface and over what is in the
// way; and when letting go, back off the surface and out to where the body has it
- let (u, off) = if away > 0.0 { (1.0 - away, (normal * 0.08 + follow) * (away * 4.0).min(1.0)) } else { (into, normal * 0.1 * (1.0 - into)) };
+ let (u, off) = if away > 0.0 { (1.0 - away, (normal * 0.08 + follow) * smooth(away * 4.0)) } else { (into, normal * 0.1 * (1.0 - into)) };
let arc = Vec3::Y * 0.06 * (std::f32::consts::PI * u).sin();
let end = w0.rot[arm[2]].slerp(turn, smooth(span(u, 0.0, 0.8)));
// (the hand's skin keeps 2 cm off solids while it travels, its fingers opening; on its hold, 4 mm)
diff --git a/systems/grab/src/trunk.rs b/systems/grab/src/trunk.rs
index 8dbe3de1..e86fad15 100644
--- a/systems/grab/src/trunk.rs
+++ b/systems/grab/src/trunk.rs
@@ -107,7 +107,8 @@ pub fn clear(wrist: Vec3, turn: Quat, hand: &(Vec<Vec3>, f32), solids: &[Thing])
}
}
let Some((d, normal)) = worst else { break };
- at -= normal * d;
+ // (eased in over the first centimetre, so the hand is turned aside without a kink)
+ at += normal * (d * d / (0.01 - d));
}
at
}
diff --git a/systems/grab/tests/use.rs b/systems/grab/tests/use.rs
index 5ac843bd..54c755fc 100644
--- a/systems/grab/tests/use.rs
+++ b/systems/grab/tests/use.rs
@@ -85,7 +85,7 @@ fn a_throw_is_wound_up_and_followed_through() {
// the hand goes out after it before coming back
let hand = s.arm(Side::R).unwrap()[2];
let reach = |t: f32| s.fk(&perform(&s, &base, &take, t).pose).pos[hand].dot(velocity.normalize());
- assert!(reach(2.12) > reach(2.0) + 0.03, "the hand follows through {} m", reach(2.12) - reach(2.0));
+ assert!(reach(2.2) > reach(2.0) + 0.03, "the hand follows through {} m", reach(2.2) - reach(2.0));
assert_eq!(perform(&s, &base, &take, 2.6).pose, s.rest());
}
diff --git a/tools/hands-audit/src/main.rs b/tools/hands-audit/src/main.rs
index 4241d8cc..1defe6c9 100644
--- a/tools/hands-audit/src/main.rs
+++ b/tools/hands-audit/src/main.rs
@@ -108,7 +108,7 @@ fn audit(skel: &Skeleton, name: &str, base: &dyn Fn(f32) -> Pose, take: &Take, u
let k = (j >= fingers_from) as usize;
w.speed[k] = w.speed[k].max(speed);
if i > 1 {
- if (speed - rate[j]).abs() > 600.0 && std::env::var("POPS").is_ok() {
+ if (speed - rate[j]).abs() > std::env::var("POPS").ok().and_then(|x| x.parse::<f32>().ok()).unwrap_or(f32::MAX) {
eprintln!(" pop {name}: {} at {t:.3} s: {:.0} to {speed:.0} deg/s ({:?})", skel.joints[j].name, rate[j], f.phase);
}
w.jump[k] = w.jump[k].max((speed - rate[j]).abs());