Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

891140 Posts in 33524 Topics- by 24768 Members - Latest Member: Stome

June 19, 2013, 01:43:53 AM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Quaternions - Error in Unity Docs?
Pages: [1]
Print
Author Topic: Quaternions - Error in Unity Docs?  (Read 462 times)
bateleur
Level 10
*****



View Profile
« on: June 16, 2011, 03:04:07 AM »

This is one of those threads I'm always really reluctant to post because I'll end up feeling really silly if I've got it wrong... but it's worth it just in case I can save someone else a week's worth of nightmarish debugging.

OK, so the Unity docs for the Quaternion * operator say:

Quote
Quaternion.operator * 
static operator * (lhs : Quaternion, rhs : Quaternion) : Quaternion

Description
Combines rotations lhs and rhs.

Rotating a point first with lhs and then with rhs is the same as rotating the point by the combined rotation. Note that rotations are not commutative: lhs * rhs does not equal to rhs * lhs.

I'm writing a fairly complicated game at the moment with lots of 3D transforms in it and having spent a week failing to get hinges working properly I eventually get a little suspicious and run this:

Code:
print("Test 1 - " + (rot1 * Vector3.up));
 print("Test 2 - " + (rot2 * Vector3.up));
 print("Test 3 - " + ((rot1 * rot2) * Vector3.up));
 print("Test 4 - " + (rot1 * (rot2 * Vector3.up)));
 print("Test 5 - " + (rot2 * (rot1 * Vector3.up)));

And the output looks like this:

Code:
Test 1 - (0.0, 1.0, 0.0)
Test 2 - (0.5, 0.8, -0.2)
Test 3 - (-0.2, 0.8, -0.5)
Test 4 - (-0.2, 0.8, -0.5)
Test 5 - (0.5, 0.8, -0.2)

So do I need more caffeine this morning, or is that actually the opposite of what the docs say? Huh?
Logged

increpare
Guest
« Reply #1 on: June 16, 2011, 04:33:19 AM »

Sure looks back to front... .
Logged
increpare
Guest
« Reply #2 on: June 16, 2011, 04:36:49 AM »

this seems to confirm your sanity.
Logged
bateleur
Level 10
*****



View Profile
« Reply #3 on: June 16, 2011, 05:07:23 AM »

Thanks for the link.

I wonder if I can get away with invoicing them for wasted dev time? Big Laff
Logged

increpare
Guest
« Reply #4 on: June 16, 2011, 05:51:52 AM »

Thanks for the link.

I wonder if I can get away with invoicing them for wasted dev time? Big Laff

Probably not.  You can log a bug report in the hope of saving others time, though.
Logged
bateleur
Level 10
*****



View Profile
« Reply #5 on: June 16, 2011, 06:07:25 AM »

You can log a bug report in the hope of saving others time, though.

Yes indeed. (Did that before posting here!)
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic