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

This topic is 1827 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

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.

Edited by birdkingz

##### Share on other sites
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).

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 20
• 15
• 10
• 9
• 11
• ### Forum Statistics

• Total Topics
634097
• Total Posts
3015512
×