Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to spawn objects at mouse postition?

I'm working on a 3d game and I would like to let the player choose the location of the "waypoints" in which an helicopter or sth will navigate. Can someone please explain to me how you turn mouse position into world space? I've tried using ScreenToWorldPoint but the coordinates are completely wrong.


  • WarpWarp Member
    edited May 2020

    Can you show us your script/situation? ScreenToWorldPoint works, it probably just wasnt implemented correctly.

    Vector3 mousepos = Camera.main.ScreenToWorldPoint (Input.mousePosition);

    is generally how its done. After that you can just instantiate it at mousePos. Make sure your camera is tagged "maincamera" aswell.

Sign In or Register to comment.