Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Parent Rotation?

Lillani Lowell
Registered User
Join date: 5 Apr 2006
Posts: 171
06-18-2006 04:03
I've been trying to make myself a multi-prim door which will rotate properly around its local Z axis, regardless of any X or Y rotations (think of angled doors).

I've done this with child prims, no matter what the rotation of X and Y the local Z rotation works perfectly and the object spins around its local axis, but when I try rotating a whole object...... it will not do a local rotation around the parent Z axis and always seems to rotate around the global Z axis instead. This, of course, leads to odd rotations. When the door is upright, it does a perfect hinge rotation, the problem weighs in when the door is "angled" on any arbitrary X or Y axis.

Assume the door is also on a 30 degree angle on the X axis, and this is the rotation to do the Z rotation.

float fn_fRotation = 45;

rotation fnRotateZ;
rotation fnNewRotation;

fnRotateZ = llEuler2Rot( <0, 0, fn_fRotation * DEG_TO_RAD> );
fnNewRotation = llGetRot() * fnRotateZ;

llSetRot( fnNewRotation );

3D math and rotations are from my strong suit, but I've tried a few variations of this, including llGetLocalRot, llSetLocalRot, etc. Nothing seems to have any affect on the rotation and the door will (swing) around the global Z instead of the hinge's local Z.

I know I'm missing something simple, but I don't know what.
Lillani Lowell
Registered User
Join date: 5 Apr 2006
Posts: 171
06-18-2006 04:13
Err, nevermind.

I just had a brain spike when I hit the post button, lol.

I've got it. :)
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
06-18-2006 04:21
Try swapping the order of the rotations you're multiplying. Dammit you got there too fast ;p
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG