How to get 2D pos from 3D pos (mouse system)
#1

Hy, anyone can help me? I want to make a mouse system calculated from CameraFrontVector's changes, but i don't know how to do the calculations...

Any functions? Or anything else?
Reply
#2

Could you explain a bit more about what you're trying to do?

Do you want to be able to click on the ground or on a player/vehicle or anything in 3D space?
Reply
#3

No i want to simply move the mouse... without any dialogs...
Reply
#4

I'm trying to make a textdraw-mouse with an TXD mouse...
Reply
#5

It is possible but it's complicated.
You need to get the player camera vector, I've checked the values it gives, when you look completely up, it gives 0.707106 (to the sky) and completely down (to the ground) it gives -0.964372 as Z coordinates. You need this to set the Y coordinates for the textdraw, on 0.707106 the mouse is at the edge above in the screen, and on -0.96 its at the edge below of the screen.

for the X coordinates of the textdraw you need to use the X and Y coordinates of the camera vector. This is more complicated because you can turn the camera all around, looking north gives X=0 and Y=1, East gives X=1 and Y =0, South is X=0 and Y=-1 and West gives X=-1 and Y = 0.

The calculation about checking in what direction it changed (to find the X for the textdraw) is quite complicated...
Reply
#6

Thank you i'll check your post at saturday...
Reply
#7

There's any function that help?
Reply
#8

Any func?
Reply
#9

GetPlayerCameraPos.
GetPlayerCameraFrontVector.
Reply
#10

i knew... but more? or codes?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)