How to shoot a project from a set viewport coordinate

Godot Version

V 4.2.1

Question

I am trying to make a simple game where you launch physics objects at a target. I have a set camera that does not move facing a background. I am trying to figure out the best way to return my mouse coordinates on my viewport, and from there create an instance of a projectile that shoots from that coordinate. Can anyone help set me in the right direction? I'm pretty new to Godot and coding in general.

Assuming that this is a 3D project, there is a method for getting the position projected through the camera :slight_smile:
Here is the Documentation for it Camera3D:project_position

This is exactly what i’m looking for! I was planning to use: get_viewport().get_mouse_position(), in tandem with InputEventMouseButton to return the mouse coordinate every time the player does the input, but I think what you suggested will be a lot more specific! THANK YOU!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.