- Home /
Rigidbody bounces back on collision
Hello everyone, I have a scene with a player (capsule collider + rigidbody + camera + my movement script) and a cube (cube collider + rigidbody).
Every time that the player walks and join a collision with the cube it bounces back if the cube doesn't have space to move in the direction that is being pushed
Here is a video showing the bouncing https://youtu.be/zlB8ozMFozQ (when i go back im not pressing any button, its just the bounce)
I don't want this to happen, i just want that if the player is moving the cube and it has no space it just stops moving, that bouncing is annoying and i dont know how to remove it. Can someone help me?
Tganks in advance guys.
I have same issue my character bounces of the cube if it collides on it I'm moving player with Rigidbody but I still have same issue is there any other way to solve this problem
Answer by b4guw1x · Jun 28, 2021 at 12:49 PM
Did you try to increase the drag or increase the mass of the player?
yes I have tried to increase the mass and decrease the mass but how to increase the drag?
yes I just increased the drag and it works flawlessly it doesn't bounce any more drag is under the mass
Answer by Bicsi · Jun 28, 2021 at 10:52 PM
Without seeing your scripts, i think i have an idea of what is happening. This has nothing to do with any kind of bouncing mechanics from the rigidbody or any other component. If you wrote the script yourself, you should be able to find it quite quickly. To stop a rigidbody from forever adding a force when walking into a wall, you could add a directly opposite force to stop the character from accelerating forever. Without being certain, i think this opposite force is being added wrongly.
This could also be a case of the rigidbody of the cube acting weird when colliding with the wall. It could be shaking every so slighty, and adding a force back to your player. The Rigidbody physics can be very "wonky" at times.
Increasing the drag of your Rigidbody could greatly reduce this i believe, but it would not really make the problem disappear, just simply reduce the problem. But try looking at the rigidbody component. Right under the "Mass" you have "Drag" which rougly translates to the friction between your character and the ground. Perhaps also try increasing the masses of your objects to more realistic scales, such as 100 for the player and 10 for the cube. That could potentially also stop any weird physics studdering.
If this is not the solution, please do share a link to your script, so we can get a peek at the movement :-)
my planet movement it has more than only Rigidbody witch is on the end of the script. it also has the planetary gravity and move around the sphere witch works fine. also I tried few other aproches like:
transform.position = Vector3.MoveTowards(transform.position, target.position, step);
RigBody.velosity = newPossition
but they also bounce me of the planet. to make that script work you need to make big sphere and non rigidbody cube in front of you and when you hit the cube it starts bouncing also I don't want for cube to move I only want to stop moving when I hit cube
Your answer
Follow this Question
Related Questions
Disable bouncing effect 0 Answers
How to make objects non-penetrable, inelastic 0 Answers
Making Pong 1 Answer
RIGIDBODY HOW MAKE IT STOP BOUNCING HELP! 3 Answers
Changing physics properties of a gameobject through code. 1 Answer