MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 01 Jul 2012 08:14 PM |
I've got a function (below) that extracts Euler angles from a part's CFrame matrix. It does this fine and perfect if only one angle is not 0. If it is rotated in more than one axis, then the function just doesn't return what I thought it should (which is the Euler angles).
function GetAngles(m) -- ''m'' is the given matrix (CFrame) local sx, sy, sz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = m:components() if m10 > .998 then x = math.atan2(m02, m22) y = math.pi/2 z = 0 return math.deg(x), math.deg(y), math.deg(z) elseif m10 < -.998 then x = math.atan2(m02, m22) y = -math.pi/2 z = 0 return math.deg(x), math.deg(y), math.deg(z) end x = math.atan2(-m20, m00) y = math.atan2(-m12, m11) z = math.asin(m10) return math.deg(x), math.deg(y), math.deg(z) end
HotThoth please. |
|
|
| Report Abuse |
|
|
|
| 01 Jul 2012 08:18 PM |
| Try stackoverflow. They're way better than here. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 01 Jul 2012 08:54 PM |
| Mkay...now how do I use that? |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
|
| 01 Jul 2012 09:37 PM |
| NOTICE: If you want to do it right, look inside RobloxApp.exe. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 01 Jul 2012 11:28 PM |
@Oysi
What I'm trying to do is stop myself from giggling at your post. Because it sounds so low... |
|
|
| Report Abuse |
|
|
|
| 01 Jul 2012 11:37 PM |
| Why not just use the lookvector property? I would think you could extract the angles from the triangles it makes with the axis. |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
LPGhatguy
|
  |
 |
| Joined: 27 Jun 2008 |
| Total Posts: 4725 |
|
|
| 02 Jul 2012 01:47 AM |
| Can't you just use the `toEulerAnglesXYZ` method? Or are you opposed to that? Or are you just trying to get the math behind? |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 02 Jul 2012 08:11 AM |
I'm just trying to figure out the math behind it all. Just because I can.
I've got it to work for when one angle is changed...but multiple... -.- |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2012 08:18 AM |
| Like I said, it's in RobloxApp.exe. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 02 Jul 2012 08:23 AM |
| So find it. Because I have no idea how to look through the functions in that thing. |
|
|
| Report Abuse |
|
|
| |
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 02 Jul 2012 08:36 AM |
| It isn't in the App......I looked. |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2012 08:37 AM |
You have to use something like Ollydbg or IDA Pro, just navigate to the address(remove sub_).
That's the actual subroutine for toEulerAnglesXYZ(). |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
| |
|
|
| 02 Jul 2012 08:43 AM |
It's not a resource, it's a C function, and therefore you can only go through it via a debugger.
You might want to actually step through it instruction by instruction as well, I'm not entirely sure what it's doing. @_@ |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 02 Jul 2012 08:44 AM |
| Yeah...lots of analyzing going on. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 02 Jul 2012 08:52 AM |
"and break do else elseif end false for function if in local nil not or repeat return then true until while"
Look...I found the list of all highlighted keywords... |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2012 08:54 AM |
| Shindeed, many interesting things reside within the application. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 02 Jul 2012 10:55 AM |
| Yeah...I give up. The functions are all in the rdata folder which is compressed in the .exe file. I don't know how to correctly read this rdata, or if you even can. |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2012 11:19 AM |
mov eax, off_DE1504 sub esp, 0Ch push esi mov esi, [esp+10h+arg_0] push eax push 1 push esi call sub_832E50 add esp, 0Ch lea ecx, [esp+10h+var_4] push ecx lea edx, [esp+14h+var_8] push edx lea ecx, [esp+18h+var_C] push ecx mov ecx, eax call sub_62C6C0 fld [esp+10h+var_C] sub esp, 8 fstp [esp+18h+var_18] push esi ; int call sub_8316F0 fld [esp+1Ch+var_8] add esp, 4 fstp [esp+18h+var_18] push esi ; int call sub_8316F0 fld [esp+1Ch+var_4] add esp, 4 fstp [esp+18h+var_18] push esi ; int call sub_8316F0 add esp, 0Ch mov eax, 3 pop esi add esp, 0Ch retn |
|
|
| Report Abuse |
|
|
|
| 02 Jul 2012 11:19 AM |
var_18= qword ptr -18h var_C= dword ptr -0Ch var_8= dword ptr -8 var_4= dword ptr -4 arg_0= dword ptr 4 |
|
|
| Report Abuse |
|
|
booing
|
  |
| Joined: 04 May 2009 |
| Total Posts: 6594 |
|
|
| 02 Jul 2012 11:55 AM |
I wish ida did more work to find the names of things... Either that or I'm a stupid idiot who hasn't used it enough and whines because I know assemby and can code in it but not read it >:( |
|
|
| Report Abuse |
|
|