jeudi 6 mars 2014

[Help] Coding | ESP / ViewMatrix (understanding) VB topic




Hey all, I'm trying to code an external ESP Box in vb.net
Currently I'm getting my overlay working but I'm having some troubles with world to screen and maybe reading out viewmatrix information.

So heres my questions/problems:

viewMatrix is 64 bytes long if I'm right (4x4 matrix made of 16 floats only ?)
I'm having some troubles reading 64 bytes at once with vb.net
So for now I'm just reading out one by one, this sucks yea I know..
If anyone knows how to read 64 bytes at once and store value correctly using struct it'd be nice to explain ^^

Anyway supposing I'm correctly reading viewmatrix this is what I'm doing:


Code:


    Public Function PointProjectionTest(ByVal viewMatrix As testViewMatrix, _
                                ByVal point_x As Single, ByVal point_y As Single, ByVal point_z As Single, _
                                ByVal gameScreen_width As Integer, ByVal gameScreen_height As Integer)
        Dim coord As New Point
        Dim ww As Single = (viewMatrix.vm_13 * point_x) + (viewMatrix.vm_14 * point_y) + (viewMatrix.vm_15 * point_z) + (viewMatrix.vm_16)

        If ww < 0.01 Then
            Return False

        Else
            Dim invw As Single = 1 / ww

            Dim xx As Single = (viewMatrix.vm_1 * point_x) + (viewMatrix.vm_2 * point_y) + (viewMatrix.vm_3 + point_z) + (viewMatrix.vm_4 * invw)
            Dim yy As Single = (viewMatrix.vm_5 * point_x) + (viewMatrix.vm_6 * point_y) + (viewMatrix.vm_7 + point_z) + (viewMatrix.vm_8 * invw)
            coord.X = (xx + 1) * 0.5 * gameScreen_width
            coord.Y = (yy - 1) * -0.5 * gameScreen_height

            Return coord
        End If

    End Function


but this returns me awesome number like
X: 25616515 Y: -99122

Am i wrong when reading viewmatrix or is the worldtoscreen function not good?

Thanks in advance for any explanation :D

EDIT: My viewmatrix stuct is like this

Code:


    Public Structure testViewMatrix
        Public vm_1 As Single
        Public vm_2 As Single
        Public vm_3 As Single
        Public vm_4 As Single

        Public vm_5 As Single
        Public vm_6 As Single
        Public vm_7 As Single
        Public vm_8 As Single

        Public vm_9 As Single
        Public vm_10 As Single
        Public vm_11 As Single
        Public vm_12 As Single

        Public vm_13 As Single
        Public vm_14 As Single
        Public vm_15 As Single
        Public vm_16 As Single
    End Structure


I'm reading out
client+viewmatrix = vm_1
client+viewmatrix+4 = vm_2
etc. etc..





Aucun commentaire:

Enregistrer un commentaire