Collison not working

Godot Version

4.3 stable

Question

its not codling with the bounding box
heres the code

extends CharacterBody2D

var SPEED = 30
#more is less
var friction := 0.015


func _physics_process(delta: float) -> void:
	if Input.is_action_just_released('r'):
		position = Vector2(100,100)
		velocity = Vector2(0,0)
	# Add the gravity
	
	
	if Input.is_action_pressed('down'):
		velocity += Vector2(0,SPEED)
	if Input.is_action_pressed('up'):
		velocity += Vector2(0,0-SPEED)	
	if Input.is_action_pressed('left'):
		velocity += Vector2(0-SPEED,0)
	if Input.is_action_pressed('right'):
		velocity += Vector2(SPEED,0)
	
	velocity = velocity-(velocity*friction)
	
	var collsion = move_and_collide(velocity*delta)
	if collsion:
		velocity = velocity.bounce(collsion.get_normal())
	
	move_and_slide()

link to debug project

You are calling move_and_collide and move_and_slide which is doubling your movement and probably bad for the physics engine.

I removed the move and collide still doesent work

Can you share your scene tree?


here it is

I made it the default code to show its a collision problem i think its a engine bug

Can you show your main scene tree?


here

Cool, so an Area2D does not stop colliding bodies like the CharacterBody2D, it can only register than something has entered or exited it’s area, the body_entered signal is great for this.

You might want to change the Area2D to a StaticBody2D.