ysj4 Posted October 24, 2021 Share Posted October 24, 2021 (edited) local wX, wY = getScreenFromWorldPosition(bX, bY, bZ + 0.35) local sX, sY = math.floor(wX), math.floor(wY) bX, bY, bZ its a pedBone position problem its a with wX idk why Edited October 24, 2021 by ysj4 Link to comment
The_GTA Posted October 24, 2021 Share Posted October 24, 2021 Hello ysj4, did you know that if (bX, bY, bZ + 0.35) are outside of your GTA SA game client screen then the getScreenFromWorldPosition function does return false? If you want to know about a more generic way to get a blip position in the camera-orriented direction then take a look at this thread in which I responded last year: The reason for this issue is very simple: you cannot see any world position on your screen that is outside of your game client window. Thus you should not expect the getScreenFromWorldPosition function to return anything that you cannot see! Link to comment
ysj4 Posted October 24, 2021 Author Share Posted October 24, 2021 12 minutes ago, The_GTA said: Hello ysj4, did you know that if (bX, bY, bZ + 0.35) are outside of your GTA SA game client screen then the getScreenFromWorldPosition function does return false? If you want to know about a more generic way to get a blip position in the camera-orriented direction then take a look at this thread in which I responded last year: The reason for this issue is very simple: you cannot see any world position on your screen that is outside of your game client window. Thus you should not expect the getScreenFromWorldPosition function to return anything that you cannot see! yeah but my problem with getScreenFromWorldPosition its for nametags and when my character get teleported far away then i got that problem Link to comment
The_GTA Posted October 24, 2021 Share Posted October 24, 2021 (edited) 30 minutes ago, ysj4 said: yeah but my problem with getScreenFromWorldPosition its for nametags and when my character get teleported far away then i got that problem How about you don't draw nametags that are not visible on screen? Since the 3D projection is a frustum which has a bottom plane (far-clip) too far players do not get a screen position either. Or just use the function I have linked for you. It does not return false in the far-clip case. HINT: you need to enable OOP in your MTA resource to use the get_screen_coordinates function! HINT: the get_screen_coordinates function does return relative values; you have to multiply them with the screen dimensions to get pixel values. Edited October 24, 2021 by The_GTA 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now