RaceXtreme Posted June 14, 2011 Author Share Posted June 14, 2011 Off: One, two, three, four ... days and no post. Wow my topic got old fast! It means that there are a lot of guys scripting in MTA... oh nice thing... (: --- Hmmm.... Oh... i got understood, you just reduce the calculation... ;D Hmm, but in with situation this resource will be needed? Cus is much easier to work with the 2D values in a lot of situations ;D Link to comment
karlis Posted June 15, 2011 Share Posted June 15, 2011 it is needed when you need real distance between 2 3D object in map, or when you want to calculate rotation for some vector. Link to comment
RaceXtreme Posted June 15, 2011 Author Share Posted June 15, 2011 Hmmm, got the idea. Thx too much (: Oh, i relember now... do you know something about matrix? It hard to get a idea how it works? off: if im asking to much... say it for me!! Link to comment
karlis Posted June 16, 2011 Share Posted June 16, 2011 i suggest you cheking this http://en.wikipedia.org/wiki/Matrix_%28mathematics%29 Link to comment
RaceXtreme Posted June 16, 2011 Author Share Posted June 16, 2011 Hmmm, yea a BIT dificult ;P I think that this is verry used in the 3DS max. Do you have a idea how a loopgenerator works? I notice that it use a lot of trigonometric stuff. In the MTA Looop generator i just understood the angle calculation: angle = ((360/pieces)* newpi) -- oh i made something like that in a script file and it made a exactly 360 rotation with 30 objects. Awsome... ;P >But what about the position? I know that we use the x,y,z values, use the offset and radius. i know what everything means and how they will work, but noo idea how to make a calculation with positions, mainly ;P I will try to make a draw and after show you what i got ;D Link to comment
Wojak Posted June 16, 2011 Share Posted June 16, 2011 Oh, i relember now... do you know something about matrix? It hard to get a idea how it works? getElementMatrix function? it allow to calculate offset points bypassing alot of math, but it only works clientside for peds (including player) and vehicles function getOffsetPoints(element,x,y,z) local matrix = getElementMatrix ( element ) local offX =x * matrix[1][1] + y * matrix[2][1] + z * matrix[3][1] + 1 * matrix[4][1] local offY = x * matrix[1][2] + y * matrix[2][2] + z * matrix[3][2] + 1 * matrix[4][2] local offZ =x * matrix[1][3] + y * matrix[2][3] + z * matrix[3][3] + 1 * matrix[4][3] --Return the transformed point return offX, offY, offZ end using getOffsetPoints(vehicle,0,10,0) you will get a point located 10m in front of the vehicle no matter the rotation using getOffsetPoints(vehicle,0,0,5) you will get the point 5 m above using getOffsetPoints(vehicle,0,0,-5) you will get the point 5 m below Link to comment
RaceXtreme Posted June 16, 2011 Author Share Posted June 16, 2011 And what should be the 4th element? ;D Cus the 1 to 3 is the position one ^^ + 1 * matrix[4][1] + 1 * matrix[4][2] + 1 * matrix[4][3] Link to comment
Wojak Posted June 16, 2011 Share Posted June 16, 2011 i did not pay attention on math well enough to know that... (this code is 90% wiki exemple) but ive used it to: -recalculate speed vector acording to rotation -calculating the ring marker target, based on dummy element rotation -calculating the relative teleportation coordinates in my teleporteditor script, and it works just like i want - its good enough to me 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