Basically what I'm doing is having a ball you can pick up and drop on a ramp. When you pick up the first ball, the second ball follows close behind, and when you drop the first ball on to the ramp the second ball drops on to the ramp as well, rolling down and launching off. The second ball continues to follow the first through the air.

How could I go about getting the second ball to follow the first, while still keeping the rolling-gravity effect?


  • \$\begingroup\$ Should it flollow like a ghost with identical movement or with own physical movement? \$\endgroup\$
    – jonas
    Commented Apr 17, 2012 at 7:05
  • 1
    \$\begingroup\$ Basically, I want it to follow as if it was "holding on" to the second ball. Think of it in human terms: A helicopter lifts one human, and another human grabs on to the first human's leg. \$\endgroup\$ Commented Apr 17, 2012 at 19:14
  • \$\begingroup\$ In this case the spring-joint solution mentioned by Gajet is most probably the way to go. \$\endgroup\$
    – jonas
    Commented Apr 18, 2012 at 10:13

2 Answers 2


I'm not sure but maybe you can connect both balls with an spring. if you don't want those two to change their distance you can put a very high value for spring constant. although this way the second ball also will effect on the first ball movement.

  • \$\begingroup\$ This is how I'd start to go at it. \$\endgroup\$
    – Esa
    Commented Apr 17, 2012 at 5:04
  • \$\begingroup\$ This spring idea may very well work, I'll have to test some variables and adding/removing the spring joint via code, we'll see if it does. \$\endgroup\$ Commented Apr 17, 2012 at 19:34
  • \$\begingroup\$ Thanks a ton! This worked, by adding and removing a springjoint I can make one follow the other, and still be affected by physics. \$\endgroup\$ Commented Apr 17, 2012 at 20:12

As I understand it you want the second ball to follow in the same path as the first ball while you carry the ball around, and then after that be affected by physics.

In this case you want to store the positions of the first ball in a list/queue and simply set the second balls position to these coordinates (ignoring physic responses) at a set distance, or set time, behind it.

For instance:

var path = new List<Tuple<TimeSpan, Vector3>>();
path.Add(Tuple.Create(gameTime.TotalGameTime, ball1.Position));

Then using Vector3.Lerp to set the position of the second ball, either calculating so its a certain time behind, or add up the distance in the path and find the position that is a certain distance behind the first ball.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .