- Home /
Make object stick to the ground in 2D
Hey guys, I'm working on a little problem and can't find a decent solution.
I'm having this little cart moving on this slope and I want it to stick to the ground at all times and follow the path using physics (player can walk into it and I don't want him to fall off the track, just like carts on rails).
What would be the best way to approach this?
asd.png
(139.7 kB)
Comment
Answer by tanoshimi · May 17, 2016 at 05:49 AM
So your cart has one axis of movement - x, which represents its horizontal position along the terrain. Its y (and presumably z) values are determined by sampling the height (and depth) of the terrain at that point.