Align the wheels of a 2D car to the ground

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By loremdolor

How would you align the wheels of a 2D car to a terrain (Collision Polygon, Path/Follow or anything else) without using physics? I want the car to stick to the ground and move it along it from code. I want to calculate the gravity, wind resistance, etc. by myself.

I’m able to align with the ground the front wheel (with a kinetic body or pathfollow) but I can’t find a way to make the back wheel to follow it at a fixed distance when the wheels are on 2 different slopes.

Any idea? Thanks!

enter image description here

You need a physics joint to link them. Godot has DampedSpringJoint2D, GrooveJoint2D and PinJoint2D. I think one of the first two is what you need, but I never used them so I’m not sure.

Zylann | 2018-06-07 12:54

without physics

loremdolor | 2018-06-08 10:20