• Advertisement
Sign in to follow this  

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

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

If you intended to correct an error in the post then please contact us.

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

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.

Edited by birdkingz

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement