Imagine you have a ball falling due to gravity. When it encounters a rotating “cube” object, then you would expect it to bounce off of the object. However, in my case if the cube is rotating fast, the ball goes through it, but if the cube is rotating slowly, the ball hits it and bounces away as expected.
I am using RotateAround() inside the Update() method to achieve the “cube” object’s rotation. I tried setting the ball’s collision detection to Discrete, Continuous, and Continuous Dynamic with no luck.
My goal is to make the ball bounce away no matter how fast the “cube” object is rotating.
Is there something else I should look into?
Thanks!
The problem is that you are changing the cube’s rotation, but the physics engine’s angular velocity is zero.
Your cube must have a rigidBody component attached if you want it to move and collide properly with other rigidBodies.
If you want to rotate your cube by changing its transform (instead of setting velocity / applying forces), you should make it kinematic, otherwise the collisions will be miscalculated (colliding with a cube that is displacing (teleporting) every frame, but it’s actual velocity is zero. There’s no actual impact.)
If you want your cube to interact in both ways (cube affected by the ball), then keep it non-kinematic, manipulate it by applying forces (never by setting transform) and optionally somehow lock it in place(by position freeze constraints or joints)