- Home /
Click to Move RigidBody Bouncing
Hi,
I'm trying to tidy up my controller script and I'll try and explain the issue best I can or I'll post a video if no luck. When I click my character to go down a flight of stairs (mesh collider to terrain collider at the bottom of the stairs), he bounces down, get's to the bottom and bounces back and forth until you click again to move him. What's included:
Physics.gravity = new Vector3(0,-285f,0);A rigidbody set up with X,Y,Z rotation frozen. A capsule colider around the main character. A piece of script on void (Start) setting the amount of gravity:
Raycast on input, location of transform from source to destination. Legacy animations using animation.crossfade from idle to run.
That' all there is to it.
What I have tried:
Removing Physics.Gravity and playing around with the Vector3 variables Changing the Mass, Angular Drag, Drag.. Adding a plane just on top of the stairs, (Cube element with Box collider)
Yes that's right, sorry either a mesh collider (Stairs) (As said tried a box collider too), or terrain collider when it get's stuck bouncing on the floor.
Not sure I understand the scenario 100%, but did you check for bounciness of physics materials?
Weird indeed. $$anonymous$$y guess would be the colliders are not neatly enough aligned, there might be a small part of the colliders colliding with your character, and since the rotation is frozen, it behaves weird. Try unfreezing the rotation, just to see how the behavior changes. Also, you might want to share the editor view with the colliders visible.
I'd love to say it is, checked exactly what you said.. played around with it for hours.. It happens on raised terrain as well, it's not limited to stairs.. I tried the character controller and it works ok, now I need to find out how to do click to move with a Character controller.
Answer by $$anonymous$$ · Oct 11, 2013 at 02:17 AM
I had to switch to a character controller which was harder than expected, there is a long and painful way to resolve it with a Rigidbody.
Answer by theUndeadEmo · Oct 09, 2013 at 04:25 PM
with the information you've provided so far i am going to assume your rigid body collider is intersecting with another collier. (when a collider that has a rigidbody on intersects/ goes inside a bit with another collider, the rigidbody attempts to push itself out)
Your answer
![](https://koobas.hobune.stream/wayback/20220613115620im_/https://answers.unity.com/themes/thub/images/avi.jpg)