How to find 3D mouse location w.r.t scene origin

Hi All,

I want to get mouse location w.r.t scene origin. Currently I get discussions on internet regarding raycasting , which gets the mouse clicking point on object(tries to pick up the object) . Here I don’t have any object to find intersection. I just want to know my mouse location in world coordinate . Lets, say If I create a cube and changing its position to the location of my mouse , the cube will move with mouse.

Can anyone please help me with this.

Thanks.

You need to understand, that the projection of a 3D-coordinate onto a 2D-screen pixel is an unambiguous transformation (information is lost in the process), while doing the reverse (inferring a 3D-position from a 2D-screen coordinate can’t undo the information loss that’s been incurred before. Meaning: there’s an infinite amount (along the cast ray) of 3D-coordinates, which correspond to the same screen pixel.

1 Like