# The bouncing ball

This forum is currently in read-only mode.
0 favourites
• 3 posts
From the Asset Store
Bouncing ball
\$9.99 USD
Template for a bouncing ball game, fully documented in comments and video
• Hello dear Constructors!!

In my latest project I've recently run into an annoying problem. I'm creating a game revolving around a bouncing ball that is supposed to bounce across flat and angled surfaces. While the 'Bounce' action works fairly well to simulate the bounces, the direction the ball gets from the bounce seem to include some kind of random element. This since the ball bounces in differnt ways everytime I test it out even though the layout of the map remaines the same. In my project it is important that the ball bounces in the same way every time.

My first question is therefore, is there a way to "fix this", to force the ball to bounce the same way every time, or do I need to create this kind of physics myself?

If the only solution is to do it myself, how is the most effective (noncomplex) way to create this? before I've just inverted the yVelocity everytime the ball hits the ground, but on angled surfaces I need another formula (using vectors, angles?).

Any help is Greatly appreciated!!

Thx!

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• law of reflection states that:

the incident angle from the normal equals the reflected angle from the normal.

for perfectly elastic reflections (bounces) your going to need to find the normal of the surface at the point the ball hits. then your going to need to find the angle the ball hit that surface from relative to the normal, and your going to want to change the angle so that its that amount from the normal opposite from where it hit.

you should look into using the custom movement behavior, im not entirely sure but i think theres an easy way to do all this using it.

• This might interest you:

I noticed the same problem myself, and the only solution was to use the custom movement behaviour. The events are as straight forward, but you have more overall control.