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

Help with creating Pong Physics

Discussion in 'Physics' started by wergds, Jul 22, 2021.

  1. wergds

    wergds

    Joined:
    Jul 17, 2021
    Posts:
    1
    I just started Unity but I am trying to create the physics of the ball bouncing off the walls and paddles in Pong. The problem I am having is that the velocity of the ball is slowing down after each collision and bounce with the walls. The walls, ball, and paddles have no friction and the ball has a bounciness of 1.
    Any thoughts?
    Thanks in advance.
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,327
    You won't get perfect speed maintained, its just not that accurate. You can manipulate the speed (magnitude) of the velocity after a collision to ensure this is the case. I'm guessing this is 2D physics (you don't say) but it's also worth reducing the velocity threshold to ensure you always get elastic collisions in this scenario (you can edit this in the Project Settings > Physics 2D).