- Home /
Ping Pong Reflect
Hello, i have been looking at other scripts and posts about how to reflect or bounce a ball. All of them have done me no good, I have tested and tried to make a ping pong game but when the ball bounces it is slowed down (even with drag at 0 and no gravity) and bounces in a specified direction like x, y, or z and eventually just back and forth on one axis.
The desired effect I want is for when the ball hits the wall at a certain angle, I want it to bounce back at the same angle with twice the speed(or a variable i can control).
I am a beginner at programming with java, but I understand it well. I know C# but i dont want to use it in unity as it seems java is easier and I am beginning to get the hang of it.
Can someone please help me with the code I need or give me some advice at what combinations of code I can use to get the desired effect.
Thanks :D
Answer by Jesse Anders · Jan 27, 2011 at 06:53 AM
By 'ping pong' game, do you mean an actual 3-d game simulating the game of ping pong? Or do you mean something like Pong?
If the latter, I wouldn't bother using the built-in physics system; instead, I'd just implement everything from scratch, which will give you complete control of the behavior of the ball.
(Also, Java isn't a supported language in Unity; it's JavaScript that you're referring to.)
Answer by Alex Visan · Jan 27, 2011 at 02:56 PM
Oh yea, javascript.
Yes I want to like the game curve ball, ive figured out everything so far except the actual bouncing of the ball. How would i implement everything from scratch? Would it not be easier to let the physics engine take care of it, and just control the behavior of the way it bounces?
Your answer
![](https://koobas.hobune.stream/wayback/20220613101330im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Balls bounce off wall in different ways 1 Answer
Ball Bounce with Random Range 1 Answer
How do i make a Character/object bounce using Javascript? 2 Answers
How to show a scored goal? 1 Answer
How to bounce a ball based on mouse click position? 0 Answers