Path movement (circuit) help

BlitzPlus Forums/BlitzPlus Programming/Path movement (circuit) help

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

If you want a realistic effect, I would suggest looking at
bezier curves. You will find some example programs on the forums which do a nice job of showing them off. A bezier curve you to define a couple of points, and a couple of control points to guide your path as you go from one to the next. The control points can represent a force direction as well as the degree of force being exerted on the object travelling that path. A control point could represent inertia, another can act as acceleration or breaking. The resulting curve can be very realistic, and can be adjusted in mid course if the outcome appears to be leading to some sort of disaster. (If intertia threatens to put your car into the wall, you reduce acceleration or add breaking effort and try to get the curve to adjust accordingly).

Bezier curves are useful another way. Once you project what you want the object to do, you only need to reposition the object in a timely fashion until it is time to figure out what the next curve portion is going to look like. That means far less time spent in lengthly computations, and the likelihood of smoother play.

You can certainly work a rate of acceleration, rate of turn, inertia as it tends to keep you in motion along one path, etc., but the problem with those approaches is that they do not allow you to see ahead as to what will happen two or three or five computations from now. And so you do not have a game plan being inacted, If you calculate that far ahead, and find yourself in trouble, you also find two immediate problems confronting you: (1) At what point can you start making change to fix the problem, and (2) How can you make the shift from one course of action (such as accelerating) to another (such as hard breaking) appear natural?