Pushed balls and barrels roll, then stop, and a barrel the player walks into starts rolling as they meet it #27
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/3980-balls-and-barrels-never-stop-rolling-not"
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: #3980
Contacts now resist a body turning on what it rests on, as Box2D v3's
rollingResistancedoes: an angular impulse that stops the two bodies' relative spin, bounded by a rolling resistance times the radius rolled on times the contact's normal impulse. It is warm-started and solved in the relax pass between the normal impulses and the friction. Box2D resists only the roll, the one axis a plane has; this also resists the spin about the normal, or a ball stopped from rolling whirls in place and never sleeps. The first map's barrels weigh 20 kg, so a player walking into one sets it rolling at once.rollingResistance, by defaultROLLING_RESISTANCE, 0.15. Blender's rigid bodies have no such setting, so the bake has nothing to read and the default applies. 0.15 is a hard ball's or wheel's on grass, which is the first map's ground. A body that stops on ground flatter than 8.5° stays there, and on steeper ground it rolls down.PARALLEL(sin 2.9°, the tolerance by which the contacts judge a cylinder's side parallel to a segment). On its rim, between that and its cap lying flat (its axis along the normal as closely), a Cylinder rolls on its radius about its own axis alone: the contact resists the two bodies' relative spin along that axis only, so the cylinder still rolls to a stop on its rims and tips about its rim freely. Lying flat on its cap it rolls on none, as a Box and a Convex Hull do, so crates, stacks and players' pushes are untouched. Where one of two bodies touches by its rim, the contact resists the spin about that body's axis; two touching by their rims resist the spin about their axes when those are parallel, and none when they cross.first_map.blendand infirst_map_bodies.py's masses. In a dump of every RNA property of the.blend, before and after, only the five barrels'rigid_body.massdiffers. The bake's render file is byte-identical, and its world file differs in exactly the five barrels' mass bytes.Two of the task's bounds, and its clause on starting a barrel, could not all hold. This PR makes these choices:
Measured with the first map's barrel and cannon ball and their baked damping, on level ground of 2 m cells:
5af4834they are 20.1 and 21.7 m on after 10 s, still rolling.5af4834it takes 0.65 s. The player walks on into it for 3 s and stops, and the barrel rests 7.4 m from where they stopped; at5af4834it rests 19.2 m away.3af784a, from 3.5° up it rolled on to the gully's end.3af784a, where the log's side made the contact resist every axis by the log's radius, it stayed on its rim.3af784a, whose rims rolled on none, 4.39 m, 149 asleep.taskpolicy -b, three rounds each, interleaved: worst tick 0.49–0.50 ms, median 0.13 ms, against 0.50–0.51 ms and 0.42 ms at master2f937ab. The dummies' capsules sleep sooner. In full gate run 993 at this head, which passed all 44 tests: worst tick 0.50 ms, median 0.13 ms.This merges master
2f937ab, #3935's skeleton dummies.first_map.blend.mdconflicted on its Props and Dummies lines; it keeps master's Dummies line and this branch's 20 kg Props line. Master did not changefirst_map.blend, so it merges as this branch's.tests/dummy_draws.sx's free skeleton falls for 240 ticks, its 12 capsules now resisted rolling, and settles in another pose: as before, on its side with its head to the right, its limbs placed a little differently. Its golden,tests/pixels/dummy-metal.png, is regenerated, and no other golden changes.What else moves, by a diff of every figure the physics and sim tests print against master
2f937ab: only round bodies' figures change, each within its bound. physics_stack, physics_contacts, physics_queries, physics_shapes, physics_determinism, solids and sim_bodies print the same figures, and the slides and bounces are unchanged. Against3af784a, rolling on the rims about the cylinder's axis moves onlybarrels.sx's figures: the valleys, the barrel on the crate (its axis at −0.000063 against −0.000114) and the barrel whirled on its rim (2.36 mm deep against 2.52 mm); the other thirteen physics and sim tests print the same figures, anddummy-metal.pngdoes not move again.Tests:
tests/barrels.sxandtests/physics_bodies.sxcheck rolling by its arithmetic with the rolling resistance: slipping, then rolling to rest, and rolling down slopes. They also check that a ball spun in place stops, and that a ball rolling on another body slows as it does on the map.barrels.sxgives the barrel and the cannon ball 4 m/s each, and releases each on the 10° slope.barrels.sxtilts a standing barrel 0.05 rad short of its balance, and one 0.05 rad past it standing on its other end; the first falls back onto its end and the second onto its side. It tilts a barrel 0.05 rad past its balance on a 200 kg crate and on a log lying on the map, and it falls onto its side on each. A barrel lying across a valley whose sides rise 2°, 4° or 10°, touching each by its rim, rolls along it and comes to rest where rolling takes it on level ground. Two barrels whose rims touch corner to corner resist each other's turning by c r about their common axis when their axes are parallel, and resist none when they cross.barrels.sxlays a barrel on its side, where its contact resists every axis, and pivots it up about one end's rim, so that the rim presses on the ground as it rises. The contact on its rim, which carries the side's rolling impulse from the tick before (both are its contact with the same triangle), holds its rolling impulse along the barrel's axis.physics_bodies.sxrolls a ball along a slab, along a wide disc lying flat on its cap, and along the top of a log lying on its side, each resting on the map; it slows at 5/7 c g times the greater of the two radii over its own.tests/sim_push.sxwalks the player into the first map's barrel, as the bake reads it. The barrel must pass nine tenths of the walking speed within 0.3 s of first contact, and must come to rest within 8 m of where the player stops.5af4834the 4 m/s, slope, start and walk cases fail. The start case also fails at this branch's first commit, whose barrels still weigh 60 kg (0.78 s). Ata0bc735, before the rim rule, the tilted standing barrels and the barrel on the crate stay on their rims and fail. At3af784a, whose rims rolled on none, the barrels across the 4° and 10° valleys roll 3.18 m on, not asleep, against 0.96 m, and the barrel on the log stays on its rim.barrels.sxorphysics_bodies.sx: the rim rolling on none (3af784a's rule) or on its radius about every axis (a0bc735's); the solve resisting every axis whatever the contact's axis; the map's or the pair's contact dropping the axis; the cap rolling on its radius about its axis or about every axis; the pair taking the greater radius's axis and, on a tie, the side's; the pair taking A's axis alone; two rims taking A's axis, or rolling on none when parallel; the pair taking the lesser radius; the side never judged, or judged within 0.7 or without the absolute value; the axis taken along local X; and no rolling solve. The rim's stop keeping the part of its carried impulse off the axis fails the pivoted barrel's case, up to 0.029 N·m·s off the axis over its 37 ticks on the rim: every substep's warm start applies that part again, so for as long as the rim presses it holds the barrel against tipping about the rim. These survive, each rolling every case as the head does: the side judged within 0.01 rather thanPARALLEL, and the cap within 0.3, since a cylinder on its rim and one on its side or its cap roll alike in every case here; and the rim's stop computed from the whole turning mass and then projected on the axis. On the map that is the same stop, since the cylinder's axis is a principal axis of its inertia; between two bodies it differs a little, since the axis need not be a principal axis of the other body's.Round bodies meet a rolling resistance, so pushed balls and barrels roll, then stopto Pushed balls and barrels roll, then stop, and a barrel the player walks into starts rolling as they meet it