Rigidbody moving too fast for collision detection.

Hey guys, I’m trying to create a dynamic seesaw-like system for launching a ball. The shape in the middle rotates according to how the player drags their finger over the screen. The point will be to launch the ball in the air, but for now the core mechanic is not working. As soon as the player starts tilting the shape the other way, the ball just goes through it. I realize that the ball does not get any velocity at this point, so it’s basically going from standing still with a collider below it, to standing still with nothing below it, so naturally it starts falling.

My question is can you even do this kind of mechanic using Unity’s physics?

The ball just has a rigidbody and sphere collider. The shape has a rigidbody, mesh collider and the script that rotates it.

So far I have tried to do the following:

  • Tried every combination of collision detection for the ball and shape rigidbodies(Discrete/Continuous/Dynamic…).
  • Tried to change the value of the Fixed Timestep.
  • Tried to limit how much the shape can rotate in the span of a frame.

8673120--1168641--Untitled-2.gif

Looks like you’re setting the Transform rotation to instantly teleport the object to a new pose. Use MoveRotation.

If you are doing that already then I’m not sure.

Thanks for the reply! I Managed to fix the problem by using Rigidbody.AddTorque to move the shape, instead of modifying the rotation of the object. I suppose directly editing the rotation of the shape didn’t really “count” as a physics update, which makes sense.

1 Like

Using transform.position or transform.rotation to move or rotate objects around counts as teleporting them, basically. This doesn’t affect their velocity or angular velocity, so the physics engine doesn’t have a clue they’ve moved: they’ve just disappeared and instantly reappeared in a different position/orientation.

1 Like