[SOLVED] Make an object reach the same height everytime

I want to make a ball reach the same height everytime the ball bounces on a bouncer (see image). The current situation is that the height the ball can reach is defined by how hard the ball bounces on a bouncer (so how fast the speed on the y-as is when the ball is falling down). I use physics 2. Any solution?
Screenshot%20(49)

If you want custom fixed height, it’s not a bounce anymore, it’s a jump.
So, set restitution to zero, and add a force at angle 270° on collision.

1 Like

The problem is the gravity. When the ball bounces higher, gravitational energy rises. The player can use a brake on the ball. So when the players use the brake, the ball will go less high. Due to this the gravitational energy decreases. The ball will then jump higher on the next bounce. Do you have any solution for this?

You can make:
If brake key pressed then
add weight to the ball.
And
If is collision with platform
change weight to normal

1 Like

I tried it, but unfortunately it didn’t work out. Somehow I need to define the gravitational force on the ball just before the ball bounces and then deliver an opposite force depending on this gravitational force. How can I define the gravitational force on an object in Gdevelop?

If you have another solution, please share it with me. Thanks in advance.

What about setting the “Linear Velocity Y” manually to a fixed value on collision with the bouncer?

Something like this:

1 Like

Of course, thank you! This is a lot easier than using forces. Thanks!

1 Like