Bending of track in a racing game
Posted
by
caius
on Game Development
See other posts from Game Development
or by caius
Published on 2013-09-12T22:56:47Z
Indexed on
2013/10/20
22:13 UTC
Read the original article
Hit count: 241
I am trying to create a small racing game in which the track would be modeled using a BSpline curve for the path's center line and directional vectors to define the 'bending' of the track at each point.
My problem is that I don't know how to calculate the correct bending / slope of the curve, in such a way that it would be optimal or at least visually nice for a car to 'bend in the corner'.
My idea was to use the direction of the 2nd derivatives of the curve, however while this approach looks fine for most of the track, there are points in which the 2nd derivative makes sharp 'twists' / very quick 180 degree flips. I also read about 'knots' of bsplines, but I don't know if such 'twist' in 2nd derivatives is a knot or knots are something else.
Can you tell me that using a BSpline: 1. How could I calculate a visually nice bending of a track for a racing game? 2. Is it possible to do this by using some simple calculations of centripertal force / gravity? 3. Is it possible to do this by using 1st, 2nd and 3rd derivatives of the BSpline curve?
I am not looking for the 'physically correct' bending angle for the track, I would just like to create something which is visually pleasing in a simple game.
I am using a framework which has a built-in class for BSpline, including support for 1st, 2nd and 3rd derivatives of the curve.
© Game Development or respective owner