MTA 1.1.1 > Pawn, rotations are weird ? -
gamer931215 - 06.08.2010
Hello, i am working on a .map to pawn converter, but i got a problem.
When i read the rotations out of the .map file it is like this:
Example:
Код:
<rotation>-1.660796 0.000000 0.000000</rotation>
If i turn that to to pawn code as rotation
My converted line:
pawn Код:
CreateObject,ID,x,y,z,-1.660796 0.000000 0.000000);
then the rotations are weird/not working. However the readed x,y,z are fine, only the rotations arent.
But if i convert it with convertFFS the rotations are completely different !
serverFFS:
pawn Код:
CreateObject(ID,x,y,z,0.00000000,0.00000000,-95.15660143);
Any idea how to get the right rotation for pawn ? i am working on a converter that ALSO converts checkpoints! The first converter that ever does that for so far i know. So i need to get this working
Re: MTA 1.1.1 > Pawn, rotations are weird ? -
d0 - 06.08.2010
the ones given after converting the map (@ convertFFS) are the correct ones.
pawn is degrees
and mta rotation is in radians
1 radians = 57.2957795 degrees
Re: MTA 1.1.1 > Pawn, rotations are weird ? -
gamer931215 - 06.08.2010
Quote:
Originally Posted by D0erfler
the ones given after converting the map (@ convertFFS) are the correct ones.
|
i know, but i am making my own converter!
so how i can transform the mta rotations to samp rotations, because there different
Re: MTA 1.1.1 > Pawn, rotations are weird ? -
d0 - 06.08.2010
Quote:
Originally Posted by gamer931215
i know, but i am making my own converter!
so how i can transform the mta rotations to samp rotations, because there different
|
read my edited post
Re: MTA 1.1.1 > Pawn, rotations are weird ? -
Kyosaur - 06.08.2010
Quote:
Originally Posted by gamer931215
i know, but i am making my own converter!
so how i can transform the mta rotations to samp rotations, because there different
|
Try multiplying by 180 and then dividing by pi, i believe thats how i did it in one of my previous apps the required MTA rotation converting.
EDIT:
pawn Код:
Private Function radians2degrees(ByVal radians As Double) As Double
Dim degrees As Double = Math.Round(radians * 180.0 / Math.PI, 6)
If radians = 0.0 Then
Return 0.0
End If
radians2degrees = degrees
End Function
Re: MTA 1.1.1 > Pawn, rotations are weird ? -
gamer931215 - 06.08.2010
Quote:
Originally Posted by D0erfler
read my edited post
|
Thanks i think it worked

, didnt knew before MTA used other rotations
Re: MTA 1.1.1 > Pawn, rotations are weird ? -
gamer931215 - 06.08.2010
Quote:
Originally Posted by Kyosaur
Try multiplying by 180 and then dividing by pi, i believe thats how i did it in one of my previous apps the required MTA rotation converting.
|
Well i have this at the moment, it seems to be working, only got now some trouble with x and y rotations again, but maybe thats my own fault so il check the script again. But i got now:
Код:
Public Function GetObjects(ByVal map As String)
Dim i As Integer
Dim temp As String
Dim result As String = "//objects:"
On Error GoTo stage2
For i = 1 To 999999999
temp = Split(map, "<object name=")(i)
Next
Exit Function
stage2:
i = i - 2
Dim a As Integer
For a = 0 To i
temp = Split(map, "<object name=")(a + 1)
temp = Split(temp, "</object>")(0)
Dim position As String
Dim rotation As String
Dim id As String
id = Split(temp, "<model>")(1)
id = Split(id, "</model>")(0)
position = Split(temp, "<position>")(1)
position = Split(position, "</position>")(0)
position = "," & Replace(position, Chr(32), ",") & ","
rotation = Split(temp, "<rotation>")(1)
rotation = Split(rotation, "</rotation>")(0)
rotation = Replace(rotation, Chr(32), ",")
Dim x As Decimal, y As Decimal, z As Decimal
x = Replace(((Split(rotation, ",")(0)) * 57.2957795), Chr(32), "")
y = Replace(((Split(rotation, ",")(1)) * 57.2957795), Chr(32), "")
z = Replace(((Split(rotation, ",")(2)) * 57.2957795), Chr(32), "")
rotation = x & "," & y & "," & z & ");"
result = result & vbCrLf & " CreateObject(" & id & position & rotation
Next
Return result
End Function
Re: MTA 1.1.1 > Pawn, rotations are weird ? -
Kyosaur - 06.08.2010
What exactly is wrong with the x and y? Im not really that good in VB, but i'll try to help lol.
btw if this is for mta 1.0, i dont think you need to convert lol. I built this a while back (loads .map files) and its been working without needing any conversions.
http://forum.sa-mp.com/showpost.php?...2&postcount=25
Re: MTA 1.1.1 > Pawn, rotations are weird ? -
gamer931215 - 06.08.2010
Quote:
Originally Posted by Kyosaur
What exactly is wrong with the x and y? Im not really that good in VB, but i'll try to help lol.
btw if this is for mta 1.0, i dont think you need to convert lol. I built this a while back (loads .map files) and its been working without needing any conversions.
http://forum.sa-mp.com/showpost.php?...2&postcount=25
|
I use MTA Race's map editor (v1.1.1) :P
Re: MTA 1.1.1 > Pawn, rotations are weird ? -
gamer931215 - 06.08.2010
Quote:
Originally Posted by Kyosaur
Try multiplying by 180 and then dividing by pi, i believe thats how i did it in one of my p(...)
|
Quote:
Originally Posted by ;781140
read my edited post
|
Thanks guys, had some trouble to get it to work, but i discovered that MTA saves the rotations inversed 0,o so instead of x,y,z they save it was z,y,x.
But got it working now !
(update, got also the checkpoint script working! it converts racecheckpoints too!)
EDIT:
Added you on the credits guys!
EDIT2:
App uploaded @
http://forum.sa-mp.com/showthread.ph...431#post781431
Re: MTA 1.1.1 > Pawn, rotations are weird ? -
GangsTa_ - 07.08.2010
Try Advanced Converter. I use it a lot.
http://depositfiles.com/files/ad3odtfob