|
Twisted Tardis
Registered User
Join date: 10 Nov 2005
Posts: 4
|
12-12-2005 06:27
I have a 10 prim object. I am tring to rotate that object on the horizontal axis to various positions, for example north, south, west, etc. The problem is trying to rotate the object without skewing it.
So, for example if I manually edit the object and orient it to face north I see the orientation is <203.2, 46.6, 31.5>. If I then try something like llLookAt(<0,90 * DEG_TO_RAD, 0>, 1.0, 1.0) to look east, this will not work because if I again edit the object and manually move it to point east I see the rotation is <136.2, 12.6, 140.3>.
I guess the easiest way to say it is that the local axises do not line up with the world axises so any movement on a single axis will skew it.
I just can't figure out how to calculate the vector I should use when my objects upright orientation is not <0,0,0>. Any ideas?
|
|
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
|
12-12-2005 10:02
One cheap trick that's commonly used to get around this situation is to add another prim with <0,0,0> rotation, rotate your object to its "upright" rotation, and link the object to this extra prim with the extra prim as the root. Make the extra prim transparent, and now all it does is "anchor" your link set to standard rotations.
|
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
12-12-2005 10:13
From: Twisted Tardis I just can't figure out how to calculate the vector I should use when my objects upright orientation is not <0,0,0>. Any ideas? Assuming I'm not on crack, original_vector / llGetRot() should do the trick.
|
|
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
|
12-12-2005 10:29
This is the offset rotation code I use if it's of any use: offsetRot(vector rotPoint, rotation rotAngle) { rotation new_rot = llGetRot() * rotAngle; llSetRot(new_rot); vector currentPos = llGetPos(); vector newPos = rotPoint + ((currentPos - rotPoint) * rotAngle); llSetPos(newPos); } I should probably change it to use llSetPrimitiveParams but I'm lazy.
|
|
Twisted Tardis
Registered User
Join date: 10 Nov 2005
Posts: 4
|
12-13-2005 09:55
From: Lex Neva One cheap trick that's commonly used to get around this situation is to add another prim with <0,0,0> rotation, rotate your object to its "upright" rotation, and link the object to this extra prim with the extra prim as the root. Make the extra prim transparent, and now all it does is "anchor" your link set to standard rotations. That's a darned good idea and easy to impliment. Thanks for the tip!
|