- Home /
How to move objects so that they bounce when something hits them?
Here is the video my problem. I do not understand how to correctly move objects so that they bounce when something hits them. In my case the object just pass through the block that hits them. I've tried moving the capsules both with position.transform and with Transform.Translate, but the problem stay the same.
Answer by sacredgeometry · Dec 01, 2021 at 06:41 AM
I suggest you learn about RidgedBodies and Colliders:
https://docs.unity3d.com/Manual/class-Rigidbody.html https://docs.unity3d.com/Manual/CollidersOverview.html
Thank you, but after adding rigid bodies to all the objects it still does not work as indented video
Please check the Colliders Overview that was linked in the Answer. You will find a collision matrix at the bottom. Make sure that you have a case with a checkbox in the matrix. Also please make sure that you use
GetComponent<Rigidbody>().MovePosition( someVector);
and
GetComponent<Rigidbody>().MoveRotation(someQuaternion);
to move and rotate your rigidbodys. Otherwise the physics engine might not detect that your rigidbodies have to be checked for collisions.