How to implement curve movement from a source to a target?

Started by
0 comments, last by alvaro 10 years, 3 months ago

Hi,

I'm trying to simulate a movement where multiple pieces of object will move towards a target by following a curve path.

Here's a picture that I've drawn for case illustration purpose

Example_zpscd51c4fa.jpg

The "moving curve" that defined in the picture isn't prefixed. What am I trying to do is as long as the object able to move towards the target while having itself in a curvy path then is fine for me.

To give u better details of the final output:

Player will tap on the Big Coin object, after that the Big Coin object will split into multiple small coins and all the small coins will fly towards the player. An example of games that implemented this method is Cloud Patrol on iOS.

Seeking for Perfection
Advertisement
Two ideas:

(1) Treat your coins as particles with position and velocity, and place them under the influence of a strong attracting force towards the player.

(2) Create two trajectories for each coin: one that goes away from the original location in some random direction, and one that goes from the original location to the location of the player. At each step, compute the location of the coin under both trajectories and interpolate between them linear interpolation, where the weight of the first trajectory in the interpolation starts at 1 and goes to 0 following some curve (perhaps something like weight_of_the_first_trajectory = 1 - (time/transition_time)^2).

This topic is closed to new replies.

Advertisement