how to fix collisions when movement is too fast?

Basically, I have two objects. Both have Box Colliders and RigidBodys attached. The mass for each is 0.1. Collision Detection is set to Continuous Dynamic for the moving object and to Continuous for the objects with which it collides.

The first object is essentially a bar that the user can move with his finger. The second is basically a cylinder (kind of like a hockey puck). The first (bar) object has a script attached where MovePosition is called within FixedUpdate (based on the touch locations).

Problem is, if the user moves the bar too quickly, it basically travels right “through” the cylinder and doesn’t move it at all. If the user moves the bar slowly (or relatively slowly), collisions happen as expected.

Is there something I’m missing?

Any moving objects must be set to ContinuousDynamic, not Continuous, and any object they might hit should be set to Continuous.

You can use this strategy too

  1. Keep track 2 positions, Position at currentFrame (say call it Pa) and Positition at previousFrame (Pb)
  2. now, cast a ray starting from Pb to Pa
  3. if ray hits any collider, get the location of hit point ( P_hit)
  4. set Pa = P_hit, i.e move ur player back to P_hit because Pa is invalid (you cannot pass through collider)