0 votes

hi guys, i'm stuck.
I'm creating a sort of first-person 3d fps, where I move the camera son wasd and the view with the mouse (I also inserted a crosshairin the camera), I have the main scene and inside it I have the final scene (the map) and the scene player (the camera object is located here).
when I point a certain object with the crosshair I would like to display an output (like a printf) but I can't.
I have seen that I should use the signals but I cannot understand how, also with the mouse pointer I can do it but with the crosshair not

in Engine by (12 points)

1 Answer

0 votes

You could add a raycast node at the player's eye and in the _process or _physics_proccess you would do this:

var raycast = $Path/To/Raycast/Node

func _physics_process():
  if raycast.is_colliding():
    var object = raycast.get_collider()
by (278 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.