Bounce Behavior

STILL IN DRAFT

GDevelop makes it easy to simulate real bouncing in a game. Bounce behavior can be applied to any object that may be involved in a collision. Because the behavior considers the angle and speed of forces applied to the object, the bounce response will feel realistic to the player.

An example of bounce behavior can be seen below, where the bounce behavior has been applied to the ball in this breakout game. placeholder only; replace with better example

Bounce behavior is not installed automatically, but it can be easily accessed by searching new behaviors,. To apply a bounce behavior to an object:

  • Right-click the object in the Objects Editor and select Edit object.
  • Click the Behaviors tab.
  • Click + to add a behavior to the object.
  • Click Search new behaviors.
  • Select Bounce and click Install in project.
  • Select Bounce from the Add a new behavior to the object window.
  • Click Apply.

What's the logic behind the behavior?

The behavior looks at the object's position and velocity at the time of the collision. It adds a force in the direction of the normal vector between the collided object and the object, and then adds the difference between the normal vector and the previous angle of movement.