Jump to content

malu05

Active Members
  • Posts

    297
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

malu05's Achievements

Universalist

Universalist (6/7)

0

Reputation

  1. With 32 bit processes i use: Func _ProcessGetLocation($iPID = @ScriptFullPath) If $iPID = 0 Then Return SetError(1, 0, -1) Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID) If $aProc[0] = 0 Then Return SetError(1, 0, -1) Local $vStruct = DllStructCreate('int[1024]') DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int*', 0) Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameEx', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'str', '', 'int', 2048) If StringLen($aReturn[3]) = 0 Then Return SetError(2, 0, '') Return $aReturn[3] EndFunc ;==>_ProcessGetLocation This will give me the full path of the .exe from the PID But this does not seem to work with 64bit executables.
  2. Binary("0x00000000"&"04000000"&"FCFF0000") gave a TCP read error on the server.
  3. Tried doing a htonl() on them aswell. But it still fails
  4. Im trying to get the Move.Me server to work with autoIT. The server does sucesfully recive the commands i send but don't regonize them. So i guess they are formated wrongly. According to the documentation (http://webassetsi.scea.com/pscomauth/gro...ebasset/moveme-network-protoco) page 7 It descripes the Table 2 Client Command Header and the Table 3 Client Command Payload. So if i want to initialize a connection with the server i need The Client Command: 0x0 The UDP port that the my client wants the server to send to: 65532 Size of the payload: 0x4 That would in rough terms be something like TCPSend(Binary("0x00000000"&"00000004"&"0000FFFC")) But that fails. Anyone got a idea how to format it correctly?
  5. Ok, solved. This makes the camera rotate horizontally around its own axis. $_ReturnEuler = Quaternion2Euler($_CurrentRotationX,$_CurrentRotationY,$_CurrentRotationZ,$_CurrentRotationW) $_ReturnHorizontal = SphericalRotation($_ReturnEuler[2],$_Altitude) $_ReturnQuat= Euler2Quaternion(270+$_ReturnHorizontal[1],0+$_ReturnHorizontal[0],$_ReturnEuler[2]+$_rotationDelta) Thanks for the help!
  6. Ok. I needed to redo the Thanks alot, thought i needed to redo it all to make it work with non-normalized quants. Now i just need to figure a way to keep my object/camera horizontal.
  7. well the thing is i don't quite understand them. I need them to rotate a camera. But say i want to rotate the camera left... in Euler i would just increment the Yaw. What would i do with Quaternions?
  8. hmmm yea... there is something wrong there. ConsoleWrite("!> $e1 = " & -($e1*$radToDeg) & @CRLF) ; 30 ConsoleWrite("!> $e2 = " & $e2*$radToDeg & @CRLF) ; 60 ConsoleWrite("!> $e3 = " & -($e3*$radToDeg) & @CRLF) ; 90 does a great job of on some of them but there is a 1 to 2 error on some of them
  9. I found this one, which is C++ http://www.gamedev.net/topic/166424-quat...o-euler/page__view__findpost__ But it doesnt seem to work correctly. $quat_x = 0.707106780551956 $quat_y = 0 $quat_z = 0 $quat_w = 0.707106781821139 $sqw = $quat_w * $quat_w; $sqx = $quat_x * $quat_x; $sqy = $quat_y * $quat_y; $sqz = $quat_z * $quat_z; $rotxrad = _atan2(2.0 * ( $quat_y * $quat_z + $quat_x * $quat_w ) , ( -$sqx - $sqy + $sqz + $sqw )); $rotyrad = asin(-2.0 * ( $quat_x * $quat_z - $quat_y * $quat_w )); $rotzrad = _atan2(2.0 * ( $quat_x * $quat_y + $quat_z * $quat_w ) , ( $sqx - $sqy - $sqz + $sqw )); ConsoleWrite($rotxrad*$radToDeg &@crlf &$rotyrad*$radToDeg &@crlf &$rotzrad*$radToDeg) it should return 0,0,90 but returns -89.9, 0, -0
  10. nice thanks alot!. Found this one aswell: $s1 = sin($heading/2); $c2 = cos($attitude/2); $s2 = sin($attitude/2); $c3 = cos($bank/2); $s3 = sin($bank/2); $c1c2 = $c1*$c2; $s1s2 = $s1*$s2; $w =$c1c2*$c3 - $s1s2*$s3; $x =$c1c2*$s3 + $s1s2*$c3; $y =$s1*$c2*$c3 + $c1*$s2*$s3; $z =$c1*$s2*$c3 - $s1*$c2*$s3; (its for radians) Can anyone help me reverse it?
  11. Im trying to make a function that can convert Quaternions to Euler and Euler to Quaternions. A bit like http://www.onlineconversion.com/quaternions.htm but just with the reverse function aswell. I tried using the wikipeida entry for it but since my understanding of highlevel math is kinda limited my formula $X = cos($yaw/2) * sin($pitch/2) * cos($roll/2) + sin($yaw/2) * cos($pitch/2) * sin($roll/2) $Y = sin($yaw/2) * cos($pitch/2) * cos($roll/2) - cos($yaw/2) * sin($pitch/2) * sin($roll/2) $Z = cos($yaw/2) * cos($pitch/2) * sin($roll/2) - sin($yaw/2) * sin($pitch/2) * cos($roll/2) $W = cos($yaw/2) * cos($pitch/2) * cos($roll/2) + sin($yaw/2) * sin($pitch/2) * sin($roll/2) turned out incorrect. Can anyone guide my towards something?
  12. Nice, really nice. Maybe '__thiscall' support aswell?
  13. Yea, i do agree that autoIt is not fit for this, but since its a part of my application i need it to be in the script and not use a external app to do the calculation. The method i posted in the first post works as intended and the interpolation is flawless for its purpose. But some of my users find the tangents a bit intimidating. So its not directly a matter of finding another "better" algorithm but rather to avoid having to use tangents if that would be using a algorithm that don't use them or simply pre-calculate the best suited tangents.
  14. Thanks for the reply. However as noted in my post my math skills is my problem here. When i google stuff like Paul Faget De Casteljau's Formes à Pôles i get a bunch of math mumbo jumbo that i really can't translate to anything. What i needed was a bit help getting the formula down in code format so i could understand it.
  15. My math sucks and i have to gather code from around the web to get my stuff working. Here is my 3D spline interpolation script. And it works just fine. The problem is that with this method i have to define the tangent for each point. #include <GUIConstantsEx.au3> #include <Misc.au3> #Include <WinAPI.au3> #include <Math.au3> dim $angles[3] $pi = 4 * ATan(1) ;equals 3.14159265358979 $radToDeg = 180 / $pi dim $_p0x = -8901.369140625 dim $_p0y = -113.60546875 dim $_p0z = 82.1371917724609 dim $_p1x = -8903.7734375 dim $_p1y = -113.341896057129 dim $_p1z = 83.5231399536133 dim $_p2x = -8902.8359375 dim $_p2y = -112.653060913086 dim $_p2z = 83.6386947631836 dim $_p3x = -8901.927734375 dim $_p3y = -112.125366210938 dim $_p3z = 83.6458740234375 dim $_p4x = "na" dim $_p4y = "na" dim $_p4z = "na" dim $_p5x = -8901.908203125 dim $_p5y = -119.156959533691 dim $_p5z = 83.7604446411133 dim $_p6x = -8899.4599609375 dim $_p6y = -120.456336975098 dim $_p6z = 83.8341217041016 local $P_ONE[3] = [$_p0x,$_p0y,$_p0z] local $P_TWO[3] = [$_p1x,$_p1y,$_p1z] local $P_TREE[3] = [$_p2x,$_p2y,$_p2z] local $P_FOUR[3] = [$_p3x,$_p3y,$_p3z] CubicPathing($P_ONE,$P_TWO,$P_TREE,$P_FOUR) local $P_Pre[3] = [$_p2x,$_p2y,$_p2z] local $P_ONE[3] = [$_p3x,$_p3y,$_p3z] local $P_TWO[3] = [$_p4x,$_p4y,$_p4z] local $P_TREE[3] = [$_p5x,$_p5y,$_p5z] local $P_FOUR[3] = [$_p6x,$_p6y,$_p6z] CubicPathing($P_ONE,$P_TWO,$P_TREE,$P_FOUR,$P_Pre) func CubicPathing($P_ONE,$P_TWO,$P_TREE,$P_FOUR,$P_PRE="na") local $p0x = $P_ONE[0] local $p0y = $P_ONE[1] local $p0z = $P_ONE[2] local $p1x = $P_TWO[0] local $p1y = $P_TWO[1] local $p1z = $P_TWO[2] local $p2x = $P_TREE[0] local $p2y = $P_TREE[1] local $p2z = $P_TREE[2] local $p3x = $P_FOUR[0] local $p3y = $P_FOUR[1] local $p3z = $P_FOUR[2] if $P_PRE = "na" Then ;nothing Else local $pPx = $P_PRE[0] local $pPy = $P_PRE[1] local $pPz = $P_PRE[2] $p1x = $p0x-($pPx-$p0x) $p1y = $p0y-($pPy-$p0y) $p1z = $p0z-($pPz-$p0z) EndIf for $i = 0 to 1.001 step +0.001 $_struc = "float posX;float posY;float posZ" $_strucT = DllStructCreate($_struc) DllStructSetData($_strucT,"posX",(1-$i)^3 * $p0x + 3*(1-$i)^2 * $i * $p1x + 3*(1-$i)* $i^2 * $p2x + $i^3 * $p3x) DllStructSetData($_strucT,"posY",(1-$i)^3 * $p0y + 3*(1-$i)^2 * $i * $p1y + 3*(1-$i)* $i^2 * $p2y + $i^3 * $p3y) DllStructSetData($_strucT,"posZ",(1-$i)^3 * $p0z + 3*(1-$i)^2 * $i * $p1z + 3*(1-$i)* $i^2 * $p2z + $i^3 * $p3z) ConsoleWrite(" X: " &DllStructGetData($_strucT,"posX")&" Y: " &DllStructGetData($_strucT,"posY")&" Z: " &DllStructGetData($_strucT,"posZ")&@crlf) Next EndFunc What i wanted to do is just having to define the points that the spline will go through Like so: This brings me back to my math problem. I can read though articles like this http://paulbourke.net/miscellaneous/interpolation/ but i don't really understand it so i don't really know how i can turn it into autoit code. Is there a easy way to calculate tangents for a smooth 3d interpolation or would anyone help me understand the article?
×
×
  • Create New...