Godot Version 4.4
Question
EDIT:
so My code is now
extends CharacterBody3D
func _physics_process(delta: float) -> void:
# position += transform.basis * Vector3(0,0,-speed) * delta
var speed = transform.basis * Vector3(0,0,-50) * delta
self.velocity += speed
for i in get_slide_collision_count():
var collision = get_slide_collision(i)
if collision.Health:
collision.Health -= 1
move_and_slide()
However I get Invalid access to property or key 'Health' on a base object of type 'KinematicCollision3D'.
what does it mean?
ORIGINAL:
Bit of a silly Question here, but I couldn’t find a way to do it, I’m making a bullet and I want to check what it collides with (obviously)
so my setup rn is:
CharacterBody3d
__CollsionShape3d
__MeshInstance3d
and my Script is
extends CharacterBody3D
var speed = 50
@onready var timer: Timer = $DespawnTimer
func _process(delta: float) -> void:
position += transform.basis * Vector3(0,0,-speed) * delta
I want to add logic to check for the collider and let me access it (change exported Health variable)