- Home /
How to make an object still when it comes into contact with the ground?
Hi, I am new to unity. I'm having trouble programming the app, I don't know how to make the object / box rest when it hits the ground. Can you help me? Please
[1]: /storage/temp/177127-20210307-1632.png
Answer by wolfenswan · Mar 07, 2021 at 11:03 AM
Setting a rigidbody's velocity to Vector3.zero (or Vector2.zero, if 2D) stops all current motion.
If the object is regaining velocity due to phyics (e.g. it's on a slope) then increasing the friction of the object's material might help.
Answer by GeroNL · Mar 07, 2021 at 09:57 AM
hello, try to use charactercontroller / rigidbody for player, and rigidbody for the rest object.
OK, but can you help me to freeze position x and y when the box hits the ground and follows the ground moving from left to right?
Check if you have colliders on both the box and the ground.
How is the box moving ? Do you have a rigidbody attached to it ? Do you have a custom script attached to it ?
Yes, in the box and ground there is a collider. I gave rigidbody to the box so that it could fall down and touch the ground. Yes there is a custom script there
Try to Use CharacterController then, it is better for character movement, or you can see the different of it, Pros and cons of it, and use depend what are you want for your player.
Your answer
![](https://koobas.hobune.stream/wayback/20220613030333im_/https://answers.unity.com/themes/thub/images/avi.jpg)