MTA 1.1.1 > Pawn, rotations are weird ?
#7

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
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)