Player moving towards walls after collison

Im currently doing complete C# unity developer course and the project is obstacle course …when i bump in to an obstacle my player starts sliding towards the opposite direction of collison with out any input . i tried using physics material,increased mass etc but its of no use can anyone point out whats really happening. attached the screen caps of the script and unity. thank you

Hi Gogineni,

Welcome to our community! :slight_smile:

I’m sorry for the late reply. For some reason, I missed your thread. Do you still need help with this or have you already found a solution?

I assume that this behaviour is caused by the physics simulation. In your screenshot, the Material field of the BoxCollider says “Missing”. Did you intend to assign a material?

Also check the ground. Maybe it is missing a physic material as well. If there is no material, the friction is 0. 0 friction is basically “ice”. If you want a “rougher” ground, you need a physic material with a higher friction value than 0. And that material must be assigned to your ground collider.

I hope this helped. If not, please let me know. :slight_smile:

See also:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms