- Home /
grouped edge colliders causing strange effects to physics 2d bodies
Hi, I am trying to make a 2D Physics platformer using Unity. I am generating level dynamically by instantiating the platform pieces which are placed very closly (which are tiny pieces with an edge collider.) I am trying to roll a Circular Sprite (with a Circle Collider & 2D Rigidbody ofc.) on this generated platform made of closely placed pieces. It all works fine when the Circle rolls slowly. As it picks speed. It starts bouncing (i m guessing at each joining point) - kinda like a bumpy road.
I have placed the platform pieces as close as visually possible.
All the pieces are at the same Y & Z co-ordinate.
I have even tried overlapping the pieces - still causes the same bounce.
If my path is straight (i.e. no curves) the roll works just fine. But I intend to have curved paths in my levels.
I intend to create a level editor as well - so using pre-defined levels wont help.
I am trying to get rid of the bouncy effect which appears as the Circle (wheel) moves forward.
Should I be using a different approach to generate the level? As in not using small pieces but some other technique?
Is there any way - If I can create a single collider for all pieces(even a polygon collider would be fine)? (Using a single collider and stretching it won't fullfill my needs- because The path may have curves as well, as illustrated in the image)
Should I avoid using the in built physics?
Any inputs would be greatly appreciated.
Hi. I'm facing the same issue only I'm using polygon colliders. It looked like the player was flickering in position. anyway, were you able to solve this? if yes, how?
Answer by kacyesp · Aug 28, 2014 at 08:00 AM
I had this same issue when I was making my own player controller a week ago. It bounces when it moves more quickly and is going down slopes, right?
It's just because you're adding a horizontal force to your object and not enough downward force when moving down slopes. So you move horizontally faster than you do downward, and depending on how much and when you're adding horizontal force, it can look like the object is bouncing. Hope that makes you understand your bug.
My solution was just to use the normal to the slope that the object is currently on to calculate how much horizontal and downward force is needed to make the object move parallel with the slope.
Your answer
Follow this Question
Related Questions
2D physics settings for solid 2D objects with polygon collider 0 Answers
Triggering platform animation on colliding with Button 0 Answers
Raycast 2D hits sprite with collider, but returns error when not hitting any collider 2 Answers
Drag Player Object using Physics 2D 0 Answers
Physics2D.OverlapCircleAll and method call cause a huge drop in animation frames 1 Answer