Give cross-body bars a true 3D axis and fix the goblet squat hold

The orbit was always a real camera orbit — figure and props share one
rigid rotation — but a bar's screen-space angle authored the wrong 3D
rod: the default horizontal encoded a rod along the body axis, so
barbells hovered fixed on screen and vanished at the head-on view
where they should span widest. Line props now take "axis": "z" (both
renderers in lockstep, fixture-pinned): the world left-right direction
projects through the camera pitch like the floor quad — end-on plates
in profile, full span face-on, swinging with the hands in between.
Applied to the ten cross-body bars; vertical handles were already
orbit-invariant.

Goblet Squat's hand pins sat so close to the shoulders that the
two-bone IK was degenerate, flipping between a chicken-wing and an
elbow-behind solve; re-pinned level with the shoulders so the elbows
tuck straight down through the whole rep.

Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
This commit is contained in:
2026-07-08 12:49:35 -04:00
parent 60927b5d1f
commit fd2deaa9c7
79 changed files with 190 additions and 143 deletions
@@ -178,6 +178,10 @@ struct MotionProp: Codable {
/// Fixed world angle (degrees, y-up). Default: bars are horizontal;
/// dumbbells/pads sit perpendicular to the lower bone.
let angle: Double?
/// True 3D axis, superseding `angle`: `"z"` marks a cross-body rod
/// (barbell, pull-up bar) whose projection foreshortens naturally
/// end-on in a profile view, full span face-on.
let axis: String?
let halfLen: Double?
let w: Double?
/// End-disc radius (dumbbell plates default 4.5; bars none).
+23 -9
View File
@@ -576,10 +576,13 @@ enum MotionSolver {
/// `anchor` the frame's root canvas anchor, and `rotation` the `propRotation`
/// between them. Joint positions come from `geo`; everything authored scene
/// points, cable anchors, bar angles, pad perpendiculars, roller offsets
/// resolves against `authored` and rotates. Kept 1:1 with the reference
/// renderer's `resolve_props` change them in lockstep.
/// resolves against `authored` and rotates. `pitch` is the camera elevation,
/// needed by `axis` props whose world-space direction projects through it
/// (like the floor quad). Kept 1:1 with the reference renderer's
/// `resolve_props` change them in lockstep.
static func resolveProps(_ props: [MotionProp], geo: FigureGeometry, authored: FigureGeometry,
anchor: CGPoint, rotation: Mat3?) -> (bg: [PropPrimitive], fg: [PropPrimitive]) {
anchor: CGPoint, rotation: Mat3?,
pitch: Double = MotionSolver.defaultPitch) -> (bg: [PropPrimitive], fg: [PropPrimitive]) {
/// Authored canvas point (+ depth toward the camera) drawn canvas.
func place(_ x: Double, _ y: Double, _ z: Double) -> CGPoint {
guard let rotation else { return CGPoint(x: x, y: y) }
@@ -654,13 +657,23 @@ enum MotionSolver {
}
guard let at = prop.at, let now = jointAnchor(geo, at),
let auth = jointAnchor(authored, at) else { continue }
let axis: CGVector
if prop.type == "bar" || prop.angle != nil {
axis = direction(prop.angle ?? 0) // fixed authored-view angle
let u: CGVector
if prop.axis == "z" {
// A cross-body rod (barbell, pull-up bar): its true 3D axis
// is the world left-right axis, projected through the camera
// elevation like the floor quad a small vertical sliver
// end-on in a profile view (the plates read nearly
// concentric, seen from slightly above), full span face-on,
// swinging with the figure in between, symmetric at 0 and 180.
let pr = pitch * .pi / 180
let axis = Vec3(0, -sin(pr), cos(pr))
let v = rotation?.apply(axis) ?? axis
u = CGVector(dx: v.x, dy: -v.y)
} else if prop.type == "bar" || prop.angle != nil {
u = swing(direction(prop.angle ?? 0)) // fixed authored-view angle, foreshortens under orbit
} else {
axis = CGVector(dx: -auth.direction.dy, dy: auth.direction.dx)
u = swing(CGVector(dx: -auth.direction.dy, dy: auth.direction.dx))
}
let u = swing(axis) // foreshortens under orbit
let h = prop.halfLen ?? defaults.halfLen
let a = CGPoint(x: now.point.x - u.dx * h, y: now.point.y - u.dy * h)
let b = CGPoint(x: now.point.x + u.dx * h, y: now.point.y + u.dy * h)
@@ -764,7 +777,8 @@ struct MotionTimeline {
guard !props.isEmpty else { return geo }
let rotation = MotionSolver.propRotation(pitch: pitch, yawOffset: yawOffset)
(geo.propsBackground, geo.propsForeground) = MotionSolver.resolveProps(
props, geo: geo, authored: authored, anchor: frame.rootPos, rotation: rotation)
props, geo: geo, authored: authored, anchor: frame.rootPos, rotation: rotation,
pitch: pitch)
return geo
}
}