As a response to another question I asked here (https://math.stackexchange.com/questions/945593/2d-spaceship-movement-eta) someone suggested to use a bezier curve. This is not answering the question, but it can provide the effect I am looking for.
Scenario: I have a spaceship, which can be already moving, or standing still. I want to give it a point, and it will have to move towards this point in a natural way (the way natural born spaceships would do :) ). Using a bezier, with p1 and p4 being the source/target location, and p2 being related to the initial speed/direction of the ship and p3 being equal to p4, I have a pretty nice effect.
However, I want difficult things :)
I want the target to be able to be moving when my object is traveling towards it. I'm wondering if anyone has an idea on how to handle this.
ALSO: Beziers are calculated with an input value between 0 and 1 (eg. the time traveled). This means I need to know the total travel time beforehand. Can someone help me with this calculation aswell?
My idea so far:
- Approximate the beziers length.
- Using the start speed, a max-speed, acceleration speed and deceleration speed, calculate the time it would take to travel this distance in a straight line.
No idea how to do nr 2 though, or if it's even a good idea :) (bad at maths:P)
Hope someone can help..thanks in advance!