Repository navigation
feat(fp): solid player car that shoves traffic and knocks props over - #16
Merged
Merged
Conversation
The player's car is now a rigid box on the ground plane (car_body.gd). Each frame it moves by the handling model's velocity in short substeps and resolves its deepest contacts: CollisionWorld's walls, posts and water edges (body_contacts.gd), other vehicles and street props. A closing contact pushes it out and gives an impulse at the contact point, so it bounces a little off what it hits head-on, scrapes along a wall it meets at a glance and spins when hit off-centre. drive_model.gd gains a spin the tyres damp out, and its stop-dead crash() is gone. obb2d.gd holds the oriented-box and circle contacts both bodies use. Cars it hits are knocked (traffic/shoves.gd): they slide and spin off with the momentum they were given, braking on their tyres, and stop against walls and other cars. A lane car brakes hard and waits, longer the harder it was hit, then steers back onto its lane and drives on; lane traffic stops for it meanwhile. A parked car knocked out of its slot rides up curbs, stays where it stops and is towed back once it has stood 30 s out of sight. TrafficFeature gains bodies_near and bump_car, and blockers_near lists only stopped vehicles while the player drives. Bins, benches, planters, mailboxes, bike racks and parking meters hit hard enough for their kind fall over (props feature, behind the "props" flag). CityView hides the batched prop and marks its collider down, and a copy of its meshes tumbles off (tumble.gd), rolls over its edges and comes to rest on a face, where it can be hit again; long props fall over a long side. Lamps, trees, bollards, hydrants and signs hold like walls. A fallen prop stands up again after 20 s out of sight. StreetDressing gains slots, set_down and kit_of, and CollisionWorld.invalidate drops a tile's cached colliders. GameBus gains car_impact and prop_knocked. The audio feature plays a light or heavy crash, louder with the closing speed, and a clatter or a clang for each prop knocked over, synthesized by tools/audio/synth_fp_sfx.py. fp_drive_test covers the crash report, a glancing scrape and shoving a lane car that then finds its lane again; fp_traffic_test the glance, shove and parked-car paths of shoves.gd; fp_props_test the tumble, thresholds, knocks, rest, kicks, respawn, rebuild, the car hitting props and a photo shot; fp_audio_test the impact sounds. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Automated reviewNo new findings on the 49 changed files (gdlint, complexity, TODO policy, dead code). Run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The player's car is solid now (user feedback: objects were not rigid and the car stopped dead on anything it touched).
scripts/fp/drive/car_body.gd, on the new sharedscripts/fp/obb2d.gdandscripts/fp/body_contacts.gd). The car moves in short substeps and resolves its deepest contacts with walls, posts, water edges, other vehicles and street props. It bounces a little off a head-on hit, scrapes along a wall it meets at a glance and spins when hit off-centre.drive_model.gdgains a knock spin damped by the tyres; the old stop-deadcrash()is gone.scripts/fp/traffic/shoves.gd). Cars the player hits slide and spin off with the momentum they got and stop against walls and other cars. A lane car brakes, waits (longer the harder it was hit), then steers back onto its lane; lane traffic stops for it meanwhile. A parked car knocked out of its slot stays where it stops and is towed back after 30 s out of sight.TrafficFeature.bodies_near/bump_carconnect the two bodies.scripts/fp/props/, flagprops). Bins, benches, planters, mailboxes, bike racks and parking meters hit hard enough fall: the batched prop is hidden, its collider marked down, and a mesh copy tumbles (tumble.gd), rolls over its edges and lies on a face (long props over a long side). Lamps, trees, bollards, hydrants and signs hold like walls. Fallen props stand up again after 20 s out of sight, at most 24 lie fallen at once.car_impactandprop_knocked; the audio feature playscrash_light/crash_heavy(louder with the closing speed) andprop_clatter/prop_clang, synthesized bytools/audio/synth_fp_sfx.py(4 WAVs, small).StreetDressingslots,set_down,kit_of;CityView.street_placements/set_street_prop_down/street_kit;CollisionWorld.invalidate;blockers_nearlists only stopped vehicles while driving.Docs:
docs/fp/ARCHITECTURE.md(E, I and driving rows, new props row, seams),docs/fp/S0-foundation.md(bus signals),docs/fp/slices/I-audio.md, README controls, regenerateddocs/api/.Tests
fp_drive_test: crash reported on the bus, glancing wall scrape, shoving a lane car that returns to its lane.fp_traffic_test: glance, shove and parked-car paths ofshoves.gd.fp_props_test(new): tumble comes to rest on a face (long props on a long side), listing, hold vs knock thresholds, rest, kicks, respawn, tile rebuild, the car hitting props, photo shot, teardown.fp_audio_test: impact sounds.Local:
pre-commit run --all-filesPASS,python tools/checks/run_all.pyPASS,tools/gate.sh fullPASS, photo tour (tools/gate.sh render --only fp_photo) checked by eye.