Ball-and-socket and hinge joints with angle limits hold a capsule chain, and training dummies hang in the first map #22
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/3903-ball-and-socket-and-hinge-joints-with-an"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tracker: #3903
Step 4 of plan #3865. The one solver gains joints, and the first map gains two training dummies the player can knock about.
What it delivers
src/physics/joints.sx, solved insrc/physics/solver.sx). A joint joins two bodies, or a body and a fixed frame in the world, at a frame on each;addJointgives its index.JOINT_HERTZ,JOINT_DAMPING_RATIObeside the contact constants). Limits are speculative: while within, a limit lets the joint close at most its room in the substep.solvePass).atan2f, declaredexternas the stage declares it. Every angle between two axes isatan2(|a×b|, a·b), exact near 0, so noacosfis needed: anacosof a dot product that rounds to 1 while the cross product does not gave the cone a zero gradient and a NaN.src/physics/dynamics.sx,sweepGroups). Bodies joined through joints form a group; a hit ends the tick for the whole group at its earliest hit, each body going to its pose there and keeping its velocity less the gravity the rest of the tick added. A body with no joint is a group of its own, so every figure the existing physics and sim tests print reads as master's: verbose copies of 20 of them, run ingit archivearms of masterd962aeeand this head, printed the same 2 451 lines.src/sim/dummy.sx): 12 capsules, 75.5 kg, 1.81 m tall, 11 joints (neck 40°/±45°, spine 25°/±20°, shoulders 80°/±60°, hips 60°/±30°, elbows and knees hinged 0–140°), hung by the top of its head from a fixed point by one more ball-and-socket without limits. Its parts damp at 0.5, linear and angular: with a new Blender body's 0.04 and 0.1, a dummy a player walked into took 178 s to sleep again; at 0.5 it takes 14 s.hulken_dummyis true marks where a dummy hangs. The extract records it (intermediate version 7) and refuses one that is not an empty; the stage writes it into the world file (version 6) in hulken's axes; the server hangs a dummy at each after the world file's bodies, so the snapshot lists the world's bodies then each dummy's parts in the template's order.src/render/dummies.sx): the app builds a capsule mesh for each part and draws the dummies at the snapshot's poses with the body vertex stage, in one flat colour.assets/scenes/first_map_dummies.py, run once): a post-and-beam frame beside the props, on the clearing's level ground, two dummy markers 2.25 m above the ground under its beam, and a passable rope from each up to the beam, so a swinging dummy's head never meets the beam.first_map.blend.mdand the README record it.Tests
tests/physics_joints.sx: pendulum, swing cone (struck from rest and at 8 phases of a tick, each reaching the cone at 20 rad/s; an elliptic cone held along each axis), twist, hinge, hinged drop at 8 phases off the floor's diagonal, the 10-capsule chain dropped across a lone crate at 8 phases, joined bodies, waking, a joint joining islands, and determinism.tests/sim_dummy.sx: the hung dummy sleeps, a player walking into it swings it and it sleeps again, the snapshots list its parts after the world's bodies, and two servers send the same bytes.tests/dummy_draws.sx: the capsule meshes lie on their capsules and face out, and a hung dummy matches its golden,tests/pixels/dummy-metal.png.tests/bake_extract.py,tests/bake_stage.sxandtests/first_map_world.sxfor the markers.Figures at this head
The hinged pair lands at (1.3, −0.7), off the diagonal along which
flatGroundsplits its quad, so the sphere has one map manifold, as the task's 1D case has. Dropped at the origin, on the diagonal, it had two, one from each triangle, which doubled the map's stiffness: it sank 0.31 mm, opened 22.9–23.3 mm and rebounded 0.48–0.50 m. Off it, the figures match plan runs 1704 and 1711's models (19.5–20.4 mm, 0.395–0.429 m, 5.5 mm, landings 35–36 and 46–49 ticks on).The chain's figures match plan runs 1721 and 1727's models (1.18–1.80°, 1.44–2.10 mm, 1.27–1.35 s), and the swing cone's from-rest strike matches their 1.06° and 1.01°.
Mutants
Each rule's mutant, applied alone in a
git archivearm of the head, fails the cases named:sim_dummybake_extractbake_stagedummy_drawsThese survive every case, none of them among the rules the task holds to a mutant:
Merge
Master's
d962aee(#3930, the trees reseated on the first map) is merged in. The merge takes master'sfirst_map.blendand runsfirst_map_dummies.pyover it again; a Blender dump of objects, matrices, mesh hashes, materials and collections shows the run adds to master's.blendexactly what the branch added to its base's:Dummy 1,Dummy 2,Dummy FrameandDummy Ropes, theframe_woodandropematerials and theDummiescollection. The README takes master's paragraph with the dummies' script named after the props'.Gates
full, gate run 936, at7a25f3a: passed, 39 of 39 tests.full, gate run 923, ate5fdbcd, before the merge: passed, 39 of 39 tests.fast, gate run 922, at769ced1: passed.Agra's check in the app is still to do: the dummies hang beside the props and swing when walked into. A probe build of the app walked the player from the first spawn marker into the nearer dummy: its pelvis swung about 0.8 m, and it slept again 13 s after the player walked away.