A body pressed against a tree trunk slides along it on the ground, with no tick turning it back #23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/3931-walking-into-a-tree-trunk-stutters-press"
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: #3931
Walking into a trunk's faceted proxy no longer creeps sideways and then snaps back. The body slides round the trunk, uphill or down, island trees included, and stays on walkable ground. Only a walk aimed straight into a flat facet stops against it, on a slope as on flat ground.
For the check in the app: walk into and around trees on the hills, firs and island trees, from every side. A walk within a fraction of a degree of straight into a facet stops there; at master the slope pushed such a walk sideways along the trunk, a few millimetres a tick.
The branch merges master
d962aee(#3930's trunks cut and reseated), and every figure below is on that map.Why it stuttered
What changes
src/physics/collision.sx, the world format. A corner is inner only where every edge meeting at its point is inner. A contact at any other corner takes the gap's direction. The world file carries these corners in the inner byte, so the format goes to version 6 and the next bake rewrites it.Sweeps report what they touched.
Contact,SweepHitandSolidHitcarry aFeature: the face, an outer edge with its direction, or a corner. For a sphere or capsule body, a point along its core counts as an edge and an end as a corner.src/sim/player.sx.The drop (
settle, throughdropped) slides down a wall it meets, a face or an edge leaning withinUPRIGHT(5°) of upright, unless it already stands on ground. Faces leaning further are left as before, so walking off a bank of 60° to 82° does not surge.The level move becomes
slideAcross, and it keeps every wall it has met. The rest of the move goes the longest of these ways that goes into no wall met, or stops:The result does not depend on which wall is met first. A move counts up to
ACROSS_WALLS(8) contacts, since climbing meets the terrain's triangles and a trunk's face and edge one by one.stepAcrosstakes whichever of the move across and the step up goes farther along the move, not just farther.Climbing the ground matters where a trunk leans out over the head, as island trees' proxies do. There the step up's rise meets the overhang at once, and the move across has to carry the body. Slid along the slope's contour, a walk uphill was turned along the slope, away from the way round the trunk, and then stopped against the trunk.
Evidence
tests/sim_trunks.sx(about 10 s) walks a body into trunk proxies:It requires that no tick turns the motion back by more than 120° (moves of at least 1 mm), that every tick stands on the ground, and that no walk stops, that is, ends with 30 ticks each moving under 0.1 mm. Each slanted walk at the island-shaped frustum must also end past the trunk. The head-on walks there slide along the crease at 0.28 to 1.17 mm a tick. The test also pins the drop's limits:
UPRIGHTfrom above: with it at 0.15, 0.2 or 0.3 rad the test fails (at 0.15, sprinting off the 0.5 m 82° bank at 1 rad moves 4.1 mm farther; at 0.2 and 0.3, walking off the 0.5 m 80° bank at 1 rad moves 3.0 cm farther), and at 0.6 the 60° and 70° banks fail too.With 8fbb9e0's
src/, the stop checks fail:With 018b8ff's
src/on the merged map, rebaked, the frustum, capsule, step-edge, fir, forest and island-tree cases fail too (for example "the first map's trunks: … 44 of 444 do" turn back, "261 of 444 do not" stand every tick).tests/physics_queries.sxgains two cases:018b8ff);The task's aggregate probe walks into every fifth tree, 2172 walks, plus the same walks turned away as a control. A walk stops when each of its last 30 of 90 ticks moves under 0.1 mm.
d962aeed962aeeOf the 6 walks into trunks that stop at this head, 4 stop at master too. The other 2 walk along a world axis to within 0.075° of straight into a fir's facet. At master they moved 0.078 m and 0.109 m over their last 30 ticks, because the slope's contour pushed them sideways along the trunk 2.6 and 3.6 mm a tick. At
8fbb9e0, 91 walks into trunks and 17 turned away stopped, 53 and 5 of them walking on at master.The island trees from review run 1882, at this head:
8fbb9e0stops it from tick 21; master went 25 mm a tick downhill along the trunk, then on.8fbb9e0stops it.The task's
trunk_one.sx. The body now slides round the trunk's west side: dx −30, −32, −28, −21, −20, −20, −14 mm a tick while climbing, then on north. At master it repeats +6.3 mm then −29.4 mm every 6 ticks.sak-gate full(gate run 942) passed 37 of 37 on2b7c0ac.Every existing test passes unchanged.
tests/physics_seeded.sxonly gains the newfeaturefield in theSweepHitit builds. Copies of 12 sim, walk and first-map tests were made to print every figure they check, 2,107 in all. Against8fbb9e0, 2 differ:Mutants. Each was run against the sim tests,
first_map_worldandwalk. These fail at least one:UPRIGHTat 0.05, 0.15, 0.2, 0.3 or 0.6;ACROSS_WALLS4;Five pass every test. Over the aggregate each still gives 0 snaps, 0 pushed back, 0 off the ground and the same stops:
ACROSS_WALLS6, and a contact facing straight up or down stopping the move: no walk changes;stepAcrossby level distance changes 1406 walks, and choosing the longest way by its length rather than its level length changes 137.A body pressed against a tree trunk slides along it smoothly, with no snap backto A body pressed against a tree trunk slides along it on the ground, with no tick turning it back