[RESOLVED] Two rigidbodies not colliding (even with traditional fixes, e.g. raycasting, collision detection)

I’m new to Unity and trying to figure out what would seem to be a basic physics problem but it has me stumped, even after spending days researching various forums and boards.

I’m trying to prototype a simple foosball-type game where a rod with a paddle attached to it rotates (by player input) and knocks the ball away. But instead, the ball and paddle hardly interact at all.

The Inspector Details:

  • The rod is the parent, has a rigidbody and is set to kinematic. It contains a capsule collider. Collision detection is set to continuous speculative. (Yes, I’m aware it’s more costly for the physics… I’m just trying desperately to solve my problem).

  • The paddle is the child, has a rigidbody and is also set to kinematic. It contains a box collider. Collision detection is set to continuous speculative.

  • The ball has a rigidbody and is affected by gravity (and is obviously not kinematic). It contains a sphere collider. Collision detection is set to continuous. It also contains physics material for bounce.

The Scripting Details:

  • The rod contains the main controller script (moving left or right and rotating forwards or backwards) which is based on MovePosition/MoveRotation.

  • The paddle contains a script that’s supposed to add force to the ball on collision (though to be honest, I’m not sure what it’s doing).

  • All three gameobjects (i.e. rod, paddle, ball) contain Daniel Brauer’s DontGoThroughThings script that I found during my research but it doesn’t seem to be working in my case.

Here’s The Code:


What Am I Doing Wrong?

I’m at a dead end in terms of troubleshooting.

I thought maybe it’s a collision detection issue because the paddle is moving too fast. But can that still be the case with both the DontGoThroughThings script and Continuous (Speculative) collision detection applied to everything?

Alternatively, I thought I might be using the wrong code to move the player (I’m so new to Unity, I was using the transform.translate function to move the rod at first, LOL). But after researching, it seems like MovePosition or AddForce are the two best options for rigidbody objects.

Thanks in advance for any and all help!


I have the exact same issue. The DontGoThroughThings helped me with collision detection, but there is also a speed issue I think. With lover speeds, the to two objects interact more with each other. With higher speeds the two objects hardly interacts. I am using a rigidbodies and physics to fire a bullet, but it’s not working at high speeds. Raycasting is not a solution for me, because I need the bullet traveltime. I have also been searching for a solutions for days, but still no luck.

I finally solved the issue, for anyone who stumbles on this question later:

//There were TWO problems; one code-based, the other inspector-based.

//First, I scripted both input and movement in Update. The correct method is to write the input code in Update but write the movement code in FixedUpdate… because, physics. (Yes, I know the code below is awful… I’m still learning to program…).

Here’s a YouTube video explaining the concept:

The new code solved the issue of the rod itself not acting on the ball with physics. However, that did not solve the problem visualized in my original GIF of the paddle not interacting with the ball.

Which leads me to…

//Second, I had two rigidbodies on a compound collider (i.e. both the parent-rod and the child-paddle had rigidbodies). I had to remove the rigidbody on the child-paddle and now it interacts as expected with the ball in a physics-based manner.

Here’s the Unity documentation discussing this issue: