RigidBody does not bounce.

Godot Version

4.2.2

Question

Open menu

Expand search
Create post
Open inbox

User Avatar
Expand user menu
r/godot icon
Go to godot
r/godot
10 hr. ago
OulDreamer

RigidBody does not bounce.
tech support - open
I am making a game where you place objects in specific placements so that they together do something. The ball which I use ass an prototype just does not work always and just bounces sometimes.

(The code of the ball)

extends RigidBody2D

@onready var area_2d = $Area2D

var dragging = false

var of = Vector2(0,0)

@onready var button = $“…/Button”

func _integrate_forces( body_state ):

if is_using_custom_integrator() :

`body_state.set_linear_velocity( Vector2(0,0) )`

`body_state.set_angular_velocity( 0 )`

func _ready():

set_freeze_enabled(true)
func _on_button_pressed():

set_freeze_enabled(false)
func _on_area_2d_body_entered(body):

if "Floor" in body.name:

`linear_velocity.y = -linear_velocity.y/1.2`

func _process(_delta):

if dragging:

`position = get_global_mouse_position() - of`

func _on_button_button_down():

dragging = true

of = get_global_mouse_position() - global_position

set_freeze_enabled(true)
func _on_button_button_up():

dragging = false