1

I have a platform (box) which is of the type b2_kinematicBody and is moving with a linearVelocity. Than I have a ball which is a b2_dynamicBody.

When the ball lands on the platform it stays on the same position and doesn't move along with the platform. enter image description here

Check this small video I made which shows the problem ----->>> https://vimeo.com/109238152

Already increased friction on both objects but no result. I can currently think of only one solution which is to make a joint between these two overytime they have contact. Is this the right solution?

Thx in advance Kris

PS: tested with latest version of box2d in c++

Community
  • 1
  • 1
Kris
  • 68
  • 4
  • Very strange. Obviously the friction is having an effect because the ball changes direction of rotation. But it changes the wrong way. It should end up rotating counter-clockwise. Are you drawing the ball graphic correctly? Is this an isolated case that only happens with this exact sequence of events, or does it happen even when the ball is dropped straight down? This is what I would expect to see, if the speed and rotation were just right, then the ball could stop: http://youtu.be/rApgHVm13J0 – iforce2d Oct 17 '14 at 16:26
  • Hey, Thx for the quick response and the video. You're right I switch the cos and sin while drawing the angle line. Asides I also think I found the problem why the ball is always moving off the platform. It's probably because it's a perfect circle with no friction? When I change it to a box it stays on the platform. Greets – Kris Oct 17 '14 at 17:15

1 Answers1

1

If you are talking about why it always rolls off the platform, it could be because it has no rolling friction (not to be confused with surface friction) to cause it to stop. Rolling friction is why a tire that is pumped up very hard will roll for longer than a tire that is a little bit flat - energy is used up in squashing the rubber as it turns around. Fixtures in Box2D are perfectly rigid, which is not possible in the real world. So this circle is like a steel train wheel rolling on a steel train track, except even less friction than that.

Try setting an angular damping value of about 0.5 for the circle body. That may be a little too much, but it should give you the idea. You may find that a high angular damping slows it down too much while in the air, which looks unnatural. If so, you could dynamically adjust the angular damping depending on whether or not it is touching something.

iforce2d
  • 8,194
  • 3
  • 29
  • 40