Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Circle Collider Vibrates on Edge Collider

Discussion in 'Physics' started by yigitozdemir, Dec 29, 2019.

  1. yigitozdemir

    yigitozdemir

    Joined:
    Sep 14, 2014
    Posts:
    5
    Hi Everyone,

    I am making a game (kind of bricks) and using edge collider objects as world bounds collider. I am increasing count of balls on each iteration, after 5 balls, balls start to vibrate when they contact with edge colliders. Vibrating means, they do not bounce directly when they contact with edge collider, they vibrate on x axis for some period while they are moving upwards on y axis.

    Ball physics: (friction is 0, bounciness is 1)
    upload_2019-12-29_14-11-53.png


    Wall physics: (friction is 0, bounciness is 0)
    upload_2019-12-29_14-12-39.png

    I am not updating transform of ball object, directly set a velocity to balls.


    Which point i am missing on this setup? Can you help me to solve this problem?

    Best,
     
  2. doarp

    doarp

    Joined:
    Sep 24, 2019
    Posts:
    147
    Perhaps your wall rigidbody should not be dynamic.
     
  3. yigitozdemir

    yigitozdemir

    Joined:
    Sep 14, 2014
    Posts:
    5
    Nope, i've tested after you suggest, result is completely same.
     
  4. yigitozdemir

    yigitozdemir

    Joined:
    Sep 14, 2014
    Posts:
    5
    Update:

    I've made several tests, problem is not about edge colliders only. As i saw it happens with other objects also.

    Once ball collides with other object, it's displayed on the contacts pane. In next frame, it bounces back from the brick, and then (the most weird part) it bounces back to the previous direction by itself, without contacting anything else.

    This problem does not happen with a few objects. It starts to happen after adding 6-7 ball objects spawned.

    Edit: After bouncing back after contact, velocity of the dynamic body is not changing. I think this is the main problem.
     
  5. yigitozdemir

    yigitozdemir

    Joined:
    Sep 14, 2014
    Posts:
    5
    I've recorded problem:

     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
    Whether or not it solves the problem, anything that isn't supposed to move should be static by either setting the Rigidbody2D type to Static or removing that component. Don't use constraints to emulate a static body when you can just make it static.

    So you seem to be suggesting that you're also not modifying these "balls" via script in anyway because you're describing the physics collision response as causing it. Is it true you're not modifying them? Want to make sure you're not modifying the velocity to maintain a certain speed as you may be making a mistake in the velocity direction perhaps.

    Can you perhaps host a simple reproduction project and I'll take a look for you as it's very odd behaviour that I've not come across before.