julionib Posted January 12, 2013 Share Posted January 12, 2013 anyone know if there is an method to, based on an 3D object (vehicle for example), draw one texture in the 2D screen position? i have an plane in front of the player, i wanna draw an texture (e.graphics.drawSprite) in the position of that object on the screen, like an target identifier system Link to comment Share on other sites More sharing options...
AgentWD40 Posted January 12, 2013 Share Posted January 12, 2013 (edited) i might have a solution, check your inbox Edited January 12, 2013 by hardsty1e Link to comment Share on other sites More sharing options...
julionib Posted January 12, 2013 Author Share Posted January 12, 2013 thx man Link to comment Share on other sites More sharing options...
lindsayslorach Posted January 16, 2013 Share Posted January 16, 2013 Might we be able to know hardsty1e's suggestion/solution? Link to comment Share on other sites More sharing options...
AgentWD40 Posted January 16, 2013 Share Posted January 16, 2013 (edited) you can learn off julionib's Air Combat IV mod that he just released open source http://www.gta4-mods.com/script/air-combat-iv-v10-f19199 Edited January 16, 2013 by hardsty1e Link to comment Share on other sites More sharing options...
julionib Posted January 17, 2013 Author Share Posted January 17, 2013 Might we be able to know hardsty1e's suggestion/solution? hehe, sorry unfortunatelly i cant find a good way to establish and distance proportion calc to make this fit exactly where thee object is, the Y value works fine, but the X dont, using the idea to find the Y we can do the same to the X value, using distancet between object and camera and calculating the X variation, the problem its determine when the camera its on the left/right of the object to decide if the X offset its negative or not this is the code: if jetList©.jet.isonscreen andalso (jetList©.jet.position.distanceto(myJet.position) > 350) then dim float_temp_1 as double dim TO_RADIAN = 0.017453292519943295 float_temp_1 = Math.Atan2((jetList©.jet.Position.Y - Player.Character.Position.Y) , (jetList©.jet.Position.X - Player.Character.Position.X)) float_temp_1 = float_temp_1 - Game.CurrentCamera.Rotation.Z * TO_RADIAN float_temp_1 += 1.570796 dim cam as camera = game.currentcamera dim dist as double = jetList©.jet.position.distanceto(cam.position) dim compPos as vector3 = (cam.position + cam.direction * dist) dim y as double = (((compPos - jetList©.jet.position).z)) / dist if jetList©.is_hunter then GTA.Native.Function.Call("DRAW_RECT", 0.5f + 0.6f * (Math.Sin(float_temp_1)), y + 0.55, 0.01, 0.02, 255, 0, 0, 100) elseif jetList©.is_fugitive then GTA.Native.Function.Call("DRAW_RECT", 0.5f + 0.6f * (Math.Sin(float_temp_1)), y + 0.55, 0.01, 0.02, 200, 200, 0, 100) else GTA.Native.Function.Call("DRAW_RECT", 0.5f + 0.6f * (Math.Sin(float_temp_1)), y + 0.55, 0.01, 0.02, 100, 100, 100, 100) end if end if Link to comment Share on other sites More sharing options...
julionib Posted January 17, 2013 Author Share Posted January 17, 2013 obs: i used this to identify the enemy jets when they dont appear in the screen (thx to game limitation ^^) the inital idea was use it as an missile lock draw on the enemy jet Link to comment Share on other sites More sharing options...
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