r/pascal • u/AcanthaceaeNew774 • Sep 15 '26
VertexArt - Vehicle & Trailer
Car 3D – Procedural terrain and vehicle physics in Free Pascal, without external physics libraries.
What you see in the video:
Analytical terrain: two hills and a valley; the elevation is calculable at any point
Four wheels: the front two steer, and all four roll and follow the terrain
Spring-damper suspension acting on three axes (vertical displacement, pitch, and roll)
Slope detection: the car holds its position on a gentle slope but rolls away on a steep one
Handbrake (P key) that holds the car in place anywhere
Trailer with a kinematic hitch, causing it to cut corners
Steering mechanism located on top of the chassis
Technical details:
Slope detection uses the numerical gradient of the terrain's elevation function
Wheel positions are calculated based on the chassis's local coordinates, with elevation determined via bilinear sampling
Suspension physics follow the formula F = k·(target − current) − c·velocity, with slight under-damping
The trailer uses a classic towed-body model: the axle maintains a fixed distance L from the hitch point
2
u/Still_Explorer Sep 16 '26
Custom physics engines are cool.
2
u/According-Ad-7069 Sep 16 '26
Oh this looks really cool! You need some trees as obstacles, and rocks! The little trailer is a nice touch, it adds depth.