I need help with things to pick up

Godot Version

4.2.2

Question

how to implement pick-up items in C# in a 3D first-person game

obraz

I need the player to aim and press the interact button

you use ray cast then

1 Like

I already realized that I need to use raycast but I can’t write a script

something like this

if (IsColliding())
{
    var collider = GetCollider();
    if (collider is iCollectable collectable)
        collectable.Collect();
}

iCollectable name is suggest is interface

thanks