Godot Version
4.3 Stable
Question
Watch the video for context ^^^
Code for the bullet:
extends CharacterBody2D
# These variables are set by the player scene
@export var speed: float
@export var pos: Vector2
@export var rot: float
@onready var hitbox: Node = $BulletHitbox
@onready var timer: Node = $Timer
var collision: Object
func _ready():
global_position = pos
global_rotation = rot
timer.start()
func _physics_process(delta):
if collision:
hitbox.disabled = true
return
velocity = Vector2(speed, 0).rotated(rot)
collision = move_and_collide(velocity * delta)
func _on_timer_timeout():
queue_free()
Is there any way to “fill” the hitboxes and avoid the bullets going through the insides of the hitboxes?