I think "curve" here refers to the curvature of the road, rather than an interpolation curve.sorry, i'm not so familiar with mathematics terminology, whats the difference between the curvature of the road and an interpolation curve. i have read other tutorial now regrading mode 7, it explain the mathematics under hood this kind of game. it seems this subject is away complicated more it looks.
To change the way the track is drawn based on the where the car is, you could try:i believe this what update() is doing. it advances the camera view position by certain amount it either moves forward (vertically) or moves aside (horizontally). before the projection. the projection is the final step before drawing it in screen.
1) offsetting (horizontal) positions before projection (if you're projecting depth), or
2) offsetting all position by a set amount (or just moving the view for the track).
The easing part of that tutorial is about transition from straight road to fully cornered road.yes .. you are absolutely right. i figured it out after posting my question.
The code line in your original post is to determine the player's horizontal position on the road.here where i'm stuck now. when i added this code line to update() function it start jarring and it won't do what it supposes to do. in javascript every thing works fine but in c++ all sorts of abnormality are happening every time.
thanks Hapax for your timeYou're welcome.
sorry, i'm not so familiar with mathematics terminology, whats the difference between the curvature of the road and an interpolation curveLinear interpolation is finding points between two other points in the straight line between those points.
here where i'm stuck now. when i added this code line to update() function it start jarring and it won't do what it supposes to do. in javascript every thing works fine but in c++ all sorts of abnormality are happening every time.I'm not sure exactly what problem you are experiencing. "Jarring", "won't do what it's supposed to do", and "all sorts of abnormality are happening" are not very descriptive, unfortunately.
Finally, in order to avoid jarring transitions when crossing segment boundaries we must ensure dx is initialized with an interpolated value for the current base segments curve.
Linear interpolation is finding points between two other points in the straight line between those points.
Curves can be used for interpolation instead of a straight line and this is often used for easing.
Examples: http://easings.net/
If it isn't working as expected, you need to make sure that every variable used in that calculation is at the value you expect it to be. Try outputting them (I'd recommend real-time updates for these so you'll probably need some sf::Texts. I tend to use the titlebar for quick feedback information) if you can't 'watch' them using your debugger.yes, thats exactly i have missed. most of time i relied on console window by using std::cout, but the problems were the framerate dropped badly. fortunately, i figured it out where is the problem cause the "jarring"
Could it be linked to this (in that linked article):i was reading this over and over. i couldn't know what the problem. every thing seems Okay. until i started debug the code line by line which finally found where i have missed. it was silly typo mistake in code, i was getting wrong array index every frame. i have fixed it.QuoteFinally, in order to avoid jarring transitions when crossing segment boundaries we must ensure dx is initialized with an interpolated value for the current base segments curve.