- Home /
Change bouncing angle with touching speed
Hello, i'm making a pong game, it's a natural physics bouncing based game
however, the bouncing angle of the ball on the paddle is always the same and causes a kind of a loop
my idea is:
3 colliders in paddle (Left, center, right)
the left collider bounces the ball in an angle of (-150 to -60) [random] the center collider bounces the ball in an angle of (-10 to 10) [random] the right collider bounces the ball in an angle of (60 to 150) [random]
the ball's angle changes to these no matter what was the previous angle so 3 scripts attached to 3 colliders this way;
var b : Rigidbody;
OnCollisionEnter () {
b.rigidbody... NOW WHAT? this is where i'm getting stuck
}
PS: i want the ball to keep the same speed
What do you suggest?
Thanks in advance xD
Answer by robertbu · May 27, 2013 at 05:54 AM
You don't have to do any coding for this. You just have to construct a paddle with angled sides. It would be best to do it in a 3D modeling program, but you could construct it out of three cubes parented to an empty game object. The movement script would go on the empty parent object.