fellow developers,
for days i have read pretty much everything i could find on bezier curves, splines and all kinds of curves and still no further ahead. Few threads on this forum touched on what I'm trying to do but not exactly.
here's what i would like to do in my app: get a sprite to follow a curved path at a predetermined speed. It's been done before similar to this http://www.firemint.com/flightcontrol/screenshots-peaceful.html
In my case, I have two scenarios:
1. the path the sprite should follow is defined by the user by dragging their finger across the iPhone's screen (exactly like in FlighControl. The app collects a bunch of points from the move event and then does a smoothing/interpolation magic to build a nice smooth curve points. The question is how the heck do i do that? I looked at some C functions but could not understand the parameters i should be using. I need something that takes an array of n (x,y) coordinates and create a new (larger) array with the points that make up the curve. Any pointers to such function/class?
2. the path the sprite should follow is predefined based on a staring and ending points like you're simulating someone kicking a soccer ball (no physics involved) towards the goal you're defending. They can can kick it any way they want from any position/depth in front of you to any position towards the goal you're defending. So I need a function that creates a curve (not sure what the mathematical term of it is) using a start and end point that looks like a natural 3d path. any suggestions?
btw, i haven't considered using a physics engine since i'm simulating a 3d movement in a 2d world.
hope the above is clear and looking forward to your feedback.
//g