• Create Account

# Bending of track in a racing game

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

1 reply to this topic

### #1caiusg  Members   -  Reputation: 110

Like
0Likes
Like

Posted 12 September 2013 - 05:07 PM

Hi!

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.

Thank you!

### #2NickW  Members   -  Reputation: 224

Like
0Likes
Like

Posted 13 September 2013 - 07:23 PM

The surface normal vector of the track should be roughly opposite of whatever forces are acting on the player's car

f = mass * gravity + centripetal force

surface normal =  -f / | f |

centripetal force = bspline 2nd derivative * speed of the player * mass

You'll probably need to do some smoothing so that the twists in the 2nd derivative don't make the track look chopped up.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS