Car physics on spline

Hi,

I want to create a 2d spline and a car following this spline.
The speed of the car is controlled by the player.

If the car is too fast in the curves I want it to slide out of the curve. (like real car physics)
Has anyone an idea how I can implement this?

Actually I don’t want to create the whole spline system.
I prefer to buy a matching asset from the asset store.

Any ideas?

I would hate to say, Use real car physics. There is a car in the standard assets that you could use as a base. It would be a cross between AI and user controlled I am guessing, and you would have to get the desired AI direction from the spline. If the player goes to fast, then he would spin out around corners. The AI would then try to compensate by trying to steer back towards the last waypoint.

As far as the spline system, you could buy it, but you will still have to convert that spline into waypoints. It isn’t very hard to create splines 2d or 3d.

https://www.google.com/imgres?imgurl=https://upload.wikimedia.org/wikipedia/commons/3/3d/B%2525C3%2525A9zier_2_big.gif&imgrefurl=https://en.wikipedia.org/wiki/B%25C3%25A9zier_curve&h=150&w=360&tbnid=HHeXFfEztkPNEM:&docid=_5ib_IfJGbf7GM&ei=z_qYVomGLZasjwOAtJigBQ&tbm=isch&ved=0ahUKEwjJqdHI_KvKAhUW1mMKHQAaBlQQMwgdKAAwAA

1 Like

You could check out MegaShapes, it has a couple of components in it for moving rigid bodies and objects along splines, even comes with a car driving around a short track example, it might do what you need or with a little scripting, I already use the spline system in it for controlling my cars along spline paths, very easy just use the API to find the point on the curve and apply a steering angle to the car system to steer towards it.

1 Like