HotThoth
|
  |
 |
| Joined: 24 Aug 2010 |
| Total Posts: 1176 |
|
|
| 02 Jul 2012 12:35 PM |
Remember, the function you're talking about is "ToEulerAnglesXYZ" (so it matches CFrame.Angles == CFrame.FromEulerAnglesXYZ), which means that the rotations are applied in X-->Y-->Z ordering. It looks like you are using a different ordering for your function, which means when you try to apply more than one rotation at once, you'll get differences with what you're expecting.
Aside from that, the gist of the function looks right, though. But unfortunately, a different ordering means all of your variables are kinda scrambled around from the ordering you'd want (i.e. for your outside "if" statements, you'd probably want to use m02 instead).
- HotThoth |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 02 Jul 2012 02:33 PM |
@HotThoth
I did figure out that ROBLOX seems to have a different order than was is traditional. Simple, though, the x and y just need to be flipped. |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 02 Jul 2012 04:22 PM |
"I wish ida did more work to find the names of things... "
In case you did not realize, there _are no_ names for it to find. Any names of local variables and members and what not are just a convenience for you, the programmer: they don't actually exist anywhere in a compiled executable. |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 02 Jul 2012 05:53 PM |
> Well, actually it contains the backvector, but negate that and you got lookvector
What? Surely lookVector is just
(cf - cf.p) * Vector3.new(0, 0, 1)
In which case the components themselves must be in the matrix (not negated). |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 03 Jul 2012 01:16 PM |
"What? Surely lookVector is just (cf - cf.p) * Vector3.new(0, 0, 1)"
Like Oysi pointed out, there's no need to do that. All that does is require a bunch of extra multiplies and adds, most of which will be x*0 and x+0. You can just directly extract the basis vectors from the components. |
|
|
| Report Abuse |
|
|