MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 24 Jun 2012 06:00 PM |
So the typical matrix in ROBLOX is built like this:
m = CFrame.new( m00, m01, m02, m10, m11, m12, m20, m21, m22 )
And say I wanted to get the 3-dimension rotational value from this makeup, I assume the following work and avoiding singularities at the poles.
m = --given above local 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 x,y,z elseif m10 < -.998 then x = math.atan2(m02, m22) y = -math.pi/2 z = 0 return x,y,z end x = math.atan2(-m20, m00) y = math.atan2(-m12, m11) z = math.asin(m10)
This is all correct, right? |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
| |
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 24 Jun 2012 06:48 PM |
"There is no reason for you to get the angles from a CFrame."
Abuh, bu, bah!
Yes there is! I'm trying to do it for the sake of knowing how. Now does the example avoid gimbal lock? |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 24 Jun 2012 08:57 PM |
| Is that not what I am doing when checking if for the 1.0 pole. |
|
|
| Report Abuse |
|
|
lombardo2
|
  |
| Joined: 30 Nov 2008 |
| Total Posts: 1604 |
|
|
| 24 Jun 2012 09:13 PM |
| yeah, but CFrame:components() returns 12 values |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 24 Jun 2012 09:15 PM |
| So I'll just throw some x,y,z thing in there... |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 25 Jun 2012 12:45 PM |
| Is there anyone who can say yes, or no? |
|
|
| Report Abuse |
|
|
lombardo2
|
  |
| Joined: 30 Nov 2008 |
| Total Posts: 1604 |
|
|
| 25 Jun 2012 01:34 PM |
| I'm not experienced with matrices and rotation... so I can't say anything |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
| |
|
Combrad
|
  |
| Joined: 18 Jul 2009 |
| Total Posts: 11025 |
|
|
| 25 Jun 2012 03:26 PM |
Although this of no use to you. Thank you for explaining Gimbal lock. Explains why my CFrame tween script failed horribly.
Fixed that now though. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 25 Jun 2012 05:01 PM |
| Glad my problem was your fix...? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 25 Jun 2012 05:33 PM |
| Gimbal lock is when two euler axis's meet up with each other on the same axis. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 26 Jun 2012 06:21 AM |
....
Does my little script up there create rotational angles or not? |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 26 Jun 2012 08:42 AM |
| I'm with oysi here. Whether your script works or not, there's little value in doing it. Gimbal lock is a result representing a rotation with euler angles. Use quaternions or matrices, and the problem does not exist. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 26 Jun 2012 08:47 AM |
*sigh*
Never mind. I'll do this on my own as usual.
Useless forum. |
|
|
| Report Abuse |
|
|