- Home /
How to make Sprite not Bounce on Collision (2D)
Hi everyone, i just started my experience with unity a few days ago and i got stuck with this problem that probably for the most of you is a stupid issue.
I'm actually using the 2D setup , trying to make a RPG game FFV like. I've created a Sprite object for the main character,with a 2D Box Collider and rigidbody (setting gravity scale to 0, so it doesn't fall down).
Now, when the sprite collides with another sprite, or a simple Quad Object with another box collider 2D (i've created a custom 2D Physics Material for this last one with 0 friction and 0 bounciness) it bounces back a little, i've tried to look around for long and can't find a way to make the sprite just stop walking with no bounceback.
Can someone help me working this out? Thanks in advance
(PS:I'm using a custom Character Controller 2D to move the character and i'm not making it use the physics for movement so i'm sure it doesn't interfere with the general physics)
Answer by messem · Sep 07, 2014 at 01:37 PM
Answer about Position Iterations helps in general, but if you have a very dynamic character - you can set him property in Rigidbody2d > Collision detection to Continuous instead of Discrete (but it could affect on your performance, because continuous consumes more resources).
Answer by timmahh · Apr 09, 2015 at 10:17 AM
I was having the same problem and I fixed it by putting my movement code in a FixedUpdate as opposed to just an Update.
Thank you SO much! I think I see why that worked too. I really should use Fixed more often.
I literally went through the pain of signing in to say thank you because you solved my problem chief
Answer by Spinnernicholas · Nov 26, 2013 at 10:59 PM
There are settings in the physics options in project settings for the minimum overlap required for a collision, lowering this might help.
Also, check the other settings.
(old) Make sure the you use the same custom Physics Material on your character as well as your terrain.
i don't know why, but for some reason it doesn't let me apply my custom physics material on the Sprite Renderer $$anonymous$$aterial, i can do that only on collider objects.
The are two types of materials, rendering and physics. You can't use a physics material on the spriterenderer because it needs a rendering material.
Thank you very much! but as i see a rendering material doesn't have "bounciness" property... i fixed the problem a little using FixedUpdate() function ins$$anonymous$$d of Update() so it doesnt keep bouncing if i keep the arrow pressed. but still i can see a small bounce on the first collision. I don't know where else can i find properties about this?
You miss understood me, rendering materials have absolutely nothing to do with physics. They only effect what is rendered.
Physics materials are only on colliders. Your character and your terrain should have colliders and all of the colliders need bounciness set to 0.
Character needs bounciness 0 as well as the terrain.
Answer by brentstrandy · Jan 01, 2014 at 05:46 AM
Go to your PhysicsSettings2D in Edit > Project Settings > Physics 2D. There is a field called Position Iterations... Change it to a higher number (maybe 5 or more). This should stop the bouncing.
Answer by Skelworath · Jan 17, 2014 at 03:44 PM
I'm not sure if I get this right, but if you want it to have a rigid body and not be affected by physics at all you can check the "Is Kinematic" box in the rigidbody2D feature.
Your answer
Follow this Question
Related Questions
Problem with rigidbodys and box collider 1 Answer
Trouble with OnCollisionEnter and Exit 1 Answer
Avoid Player bouncing when colliding with objects 3D 1 Answer
Why is the Rigidbody ignoring Colliders? 1 Answer
Collision Only being detected on one of the objects involved in the collision - C# 0 Answers