- Home /
2D pong, bouncer - ball movement, friction, bounciness, speed [screenshot]
Hey guys,
So I'm posting this for my son who is making his first Unity game - 2D Pong!
Everything works so far, he's got keyboard control for 2 paddles, the ball bounces around the box and the paddles. Now he's trying to work on the physics of the ball itself and running into some problems.
He's using a 2D bouncer, set the friction to 0 and is varying the bounciness of the ball between a value of 1 - 2. The ball quickly gains momentum, never slows down and goes out of control. We've been experimenting with the value of friction as well but no luck.
Can someone just point us in the right direction here? Just trying to make the ball feel like a regular pong game. Is there a better way to do this? Can we control the speed via coding in one of the C# scripts?
Thanks in advance!
Answer by Killerbro389 · Jun 17, 2017 at 05:30 AM
Yes you can control the speed. I am not a very experienced coder but if you can, add a max speed variable and make it, well, be the highest speed the ball can move. It' complicated; just set a max speed for the ball in the script.
Answer by todanielchow · Jun 17, 2017 at 05:38 AM
Thank you, that is a great idea and makes a lot of sense... I'll pass this along to my son.