Nevitro Posted February 21, 2013 Share Posted February 21, 2013 (edited) Ped killme = Player.GetTargetedPed();Matrix lol = GTA.Matrix.Translation(Game.CurrentCamera.Position.X, Game.CurrentCamera.Position.Y, Game.CurrentCamera.Position.Z); Vector3 YOU = GTA.Vector3.Project(killme.Position, 100, 100, Game.Resolution.Width, Game.Resolution.Height, 0.7F, 1.0F, lol); I do this wrong ... because the screen cordinates are bigger than 85 K... What i should do with "matrix lol" to get position of screen? Edited February 21, 2013 by Nevitro Link to comment Share on other sites More sharing options...
pedro2555 Posted February 28, 2013 Share Posted February 28, 2013 No replies on this, that's sad. What exactly do you mean by 'screen coordinates are bigger than 85 K' ? 85 K what ? This sounds very promising, I just don't get the problem your getting. Link to comment Share on other sites More sharing options...
Nevitro Posted February 28, 2013 Author Share Posted February 28, 2013 (edited) I want to get position of ped to the screen. It is called "project". Only one problem - i don't know what exactly is MATRIX. I found i should put there "world-view-project". Matrix of world, matrix of view and project. Only problem - how to do that? If i will fix that, many modders will use this [3D position to corditnation to 2D? how many new mods can be created! new huds! Messages on peds head!]. My older friends, IT teachers also don't know how to put there one matrix from three... [edit]Pedro, write, i see You are online i must sleep, but i really want to know how to do that... Edited February 28, 2013 by Nevitro Link to comment Share on other sites More sharing options...
pedro2555 Posted February 28, 2013 Share Posted February 28, 2013 I want to get position of ped to the screen. It is called "project". Only one problem - i don't know what exactly is MATRIX. I found i should put there "world-view-project". Matrix of world, matrix of view and project. Only problem - how to do that? If i will fix that, many modders will use this [3D position to corditnation to 2D? how many new mods can be created! new huds! Messages on peds head!]. My older friends, IT teachers also don't know how to put there one matrix from three... Ok then, I have pretty much the same problem. I'm not very familiar with 3D drawing. And yeah, it will open quite a few doors. Link to comment Share on other sites More sharing options...
Nevitro Posted February 28, 2013 Author Share Posted February 28, 2013 Ech... Only way to find really professional programmer ... Somebody must know how to make matrix. Now i just do 'fake' hud for peds body part Link to comment Share on other sites More sharing options...
pedro2555 Posted February 28, 2013 Share Posted February 28, 2013 Ech... Only way to find really professional programmer ... Somebody must know how to make matrix. Now i just do 'fake' hud for peds body part Look it yourself. I am actually a professional programmer, but I don't really need to know about 3d, like matrices, projections and what not, for my job. And actually I have very low formation levels, all my knowledge comes from experience. (I mostly work on web-based solutions btw). So yeah, pretty much anyone can get anywhere with programming. I do have a good book on 2d/3d drawing in C# lying around, but that was back in 1.0 or so, and scripthook uses code from SlimDx source, so it might not be very helpful for this case. So search around SlimDx, I know for sure, the Matrix and Vector classes on scripthook are an exact copy of the SlimDx code. Link to comment Share on other sites More sharing options...
nixolas1 Posted March 4, 2013 Share Posted March 4, 2013 You can check out the source in the Javelin Mod, http://www.gta4-mods.com/script/javelinsti...lock-v11-f19468 has some drawing on locked peds, this is what i found, you figure out what it is : This is the main stuff: Private Sub GraphicsEventHandler(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles mybase.PerFrameDrawing if bNormalMode then exit sub if game.iskeypressed(hkAimKey) andalso camAim.isactive andalso player.character.isalive then if exists(tmpTargetVeh) orelse exists(targetVeh) orelse (targetGround <> vector3.zero) orelse (tmpTargetGround <> vector3.zero) then dim pos as vector3 dim tmpColor as color if timeLocked >= 300 then if bJavelin andalso bNVOn then tmpColor = color.fromargb(150, 0, 255, 0) else tmpColor = color.fromargb(100, 255, 0, 0) end if else tmpColor = color.fromargb(100, 255, 255, 255) end if if exists(targetVeh) then pos = targetVeh.position elseif exists(tmpTargetVeh) then pos = tmpTargetVeh.position elseif targetGround <> vector3.zero then pos = targetGround else pos = tmpTargetGround end if dim float_temp_1 as double dim TO_RADIAN = 0.017453292519943295 float_temp_1 = Math.Atan2((pos.Y - Player.Character.Position.Y) , (pos.X - Player.Character.Position.X)) float_temp_1 = float_temp_1 - Game.CurrentCamera.Rotation.Z * TO_RADIAN float_temp_1 += 1.570796 float_temp_1 = (0.51 + 0.9f * (Math.Sin(float_temp_1))) * myWidth dim cam as camera = game.currentcamera dim dist as double = pos.distanceto(camAim.position) dim compPos as vector3 = (camAim.position + camAim.direction * dist) dim y as double = (((((compPos - pos).z)) / dist) + 0.47) * myHeight if bJavelin then drawLineAux(e, 0, y, 1680, y, 2, tmpColor) drawLineAux(e, float_temp_1, 0, float_temp_1, 1050, 2, tmpColor) else drawLineAux(e, float_temp_1 - 40, y, float_temp_1 + 40, y, 2, tmpColor) drawLineAux(e, float_temp_1, y - 40, float_temp_1, y + 40, 2, tmpColor) end if end if for drawing of lights on ped: tmpLightPos = l.v.GetOffsetPosition(li.offSet) + vector3.worldup * l.VOff * 1.5 - game.currentcamera.direction * (l.VOff / 2) if tmpLightPos.z - tmpLightPos.toground.z < 3 then tmpLightPos.z = tmpLightPos.toground.z + 3 'cpTarget.position = tmpTargetVeh.position + vector3.worldup * (tmpTargetVeh.model.getdimensions.z / 2) 'cpTarget.diameter = tmpTargetVeh.position.distanceto(player.character.position) / 100 private sub drawSpriteAux(byval e As GTA.GraphicsEventArgs, tex as texture, x as double, y as double, w as double, h as double, _ rot as double, col as color, optional square as boolean = false) if square then e.graphics.drawsprite(tex, x * width_Coef, y * height_Coef, w * width_Coef, h * width_Coef, rot, col) else e.graphics.drawsprite(tex, x * width_Coef, y * height_Coef, w * width_Coef, h * height_Coef, rot, col) end ifend subprivate sub drawLineAux(byval e As GTA.GraphicsEventArgs, xIni as double, yIni as double, xFin as double, yFin as double, _ w as double, col as color) e.graphics.drawline(xIni * width_Coef, yIni * height_Coef, xFin * width_Coef, yFin * height_Coef, w * width_Coef, col)end subprivate sub drawTextAux(byval e As GTA.GraphicsEventArgs, text as string, x as double, y as double, col as color) e.graphics.drawtext(text, x * width_Coef, y * height_Coef, col)end subprivate sub drawFrameAux(byval e As GTA.GraphicsEventArgs, x as double, y as double, w as double, h as double, lw as double, col as color) drawLineAux(e, x - (w / 2), y - (h / 2), x + (w / 2), y - (h / 2), 2, color.fromargb(150, 255, 255, 255)) drawLineAux(e, x - (w / 2), y + (h / 2), x + (w / 2), y + (h / 2), 2, color.fromargb(150, 255, 255, 255)) drawLineAux(e, x - (w / 2), y - (h / 2), x - (w / 2), y + (h / 2), 2, color.fromargb(150, 255, 255, 255)) drawLineAux(e, x + (w / 2), y - (h / 2), x + (w / 2), y + (h / 2), 2, color.fromargb(150, 255, 255, 255))end sub nice stuff will have to convert to c++ or some if you use that though... math should be the same. Link to comment Share on other sites More sharing options...
pedro2555 Posted March 4, 2013 Share Posted March 4, 2013 Good job. Link to comment Share on other sites More sharing options...
Nevitro Posted March 4, 2013 Author Share Posted March 4, 2013 (edited) EDIT: I have this, JulioNIB send me this in private message along time ago. It is good, but i didn't have time to convert this to c#... Edited March 4, 2013 by Nevitro 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