Ive been working with Tom (Lazy Chestnut) to nut some stuff out, but the big problem i have is that the ball a) bounces and b) decelerates. I dont believe there is any 'formula' for intercepting a decelerating object!
This is an interesting point. I would have thought bouncing could be fairly easily solved, depending on the sort of tools you are using. If you make vertical and horizontal velocities independant, make horizontal constant (well, you might want to add a small deceleration to account for air resistance, and a much larger deceleration if the ball is rolling along the ground). For the vertical velocity, it gets interesting. If I can assume that the sort of motion you are attemtping to achieve is similar to the modulus of a sine curve (I dont know how much maths you know, and it may well be more than me, working on a project like this, but in case you don't, a sine curve looks like
this. For the modulus, take all the bits below the x axis and reflect them so they are above, creating, if you like, the motion of a perfectly bouncy ball).
This is where it gets tricky. If you are able to program position (displacement) then a sin t curve (t = time) if fine, although you'd want some way to make it bounce lower each time. If you define x as the period of time between one bounce and the next (which would have to be calculated based on the power and trajectory of each individual shot) then you could say
If t <= x, put the time (t) into sint.
If x < t <= 2x [ie between the first bounce and the second] put t into 0.9sint
If 2x < t <= 3x, put t into 0.8sint.
And so on. x will be easy to calculate (unless I'm overlooking something) using a vertically applied UVATS equation. The 0.9s, 0.8s etc are just examples, and you would have to test for realism, but this would produce a fairly good bouncing motion.
If you can't define position, only velocity, you would need a cos t graph since velocity can be defined as the differential of displacement (dv/dt) and cos is the first differential of sine.
You problem with intercepting a decelerating object is trickier. I can't think of a way to tackle it off the top of my head, it all depends on how the programming works and I'm afraid I have no experience with it. My first thought that possibly a differential equation may be of use but it all depends how how it needs to be programmed.
Don't know of this is of any help to you, but it kept me interested and thinking so it's not a waste if you've already found a better way
