Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

Matrix Vector [position of object into screen]


Nevitro
 Share

Recommended Posts

 

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 by Nevitro
Link to comment
Share on other sites

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

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 sad.gif i must sleep, but i really want to know how to do that...

Edited by Nevitro
Link to comment
Share on other sites

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

Ech... sad.gif

Only way to find really professional programmer ... Somebody must know how to make matrix. Now i just do 'fake' hud for peds body part sad.gif

Link to comment
Share on other sites

Ech... sad.gif

Only way to find really professional programmer ... Somebody must know how to make matrix. Now i just do 'fake' hud for peds body part sad.gif

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

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 tounge.gif :

 

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 tounge.gif

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

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 by Nevitro
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.