How do I apply a force in a RigidBody2D?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JulioYagami

I have two RigidBody2D, one ball (character mode) and one block (static mode) and when the ball collides with the block, I want to apply a force in the opposite direction, causing it to bounce. If there is another simpler way to do this, please tell me.

Why use a RigidBody when you could use a KinematicBody for the ball, and a StaticBody for the blocks?

SIsilicon | 2018-12-01 13:10

:bust_in_silhouette: Reply From: p7f

I think what you need, if i did not missundertood, is to set the bounce property to non-zero value (this property can be set from inpector). if you want the ball to bounce in a perfectly “elastic” way, and never stop bouncing, put bounce in 1. If you want the bounce to be more “plastic” and the sucesive bounces to be decreased in magnitude, so put bounce to a lower value, like 0.3.
Does this help?