Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Trouble with rotation

Kaylan Draken
Registered User
Join date: 2 Dec 2006
Posts: 127
08-17-2009 13:09
I am have trouble with rotation and hope some one of you can help.
Below is a function i build and it works it the root prim (single prim object) is placed in a angle of 0, 90, 180, 270 degrees but it don't work with other angles and i can't see why.

instead of llGetRootRotation i tried also llGetRot and llGetLocalRot.

The intension is that this function works with all rotations

AvatarSit(integer iNrAnim)
{
vector POSITION;
vector Rotdeg;

if (iNrAnim == 0) {POSITION = < 0.0, 0.0, 1.2>; Rotdeg = < 0, 0, 90 > ;}
else if (iNrAnim == 1) {POSITION = < 0.0, 0.0, 1.15>; Rotdeg = < 0, 0, 90 > ;}
else if (iNrAnim == 2) {POSITION = < 0.0, 0.0, 0.7>; Rotdeg = < 0, 0, 0 > ;}
else if (iNrAnim == 3) {POSITION = < 0.0, 0.0, 0.7>; Rotdeg = < 0, 0, 0 > ;}
else if (iNrAnim == 4) {POSITION = < 0.0, 0.0, 0.7>; Rotdeg = < 0, 0, 270 > ;}
else if (iNrAnim == 5) {POSITION = < 0.0, 0.0, 0.7>; Rotdeg = < 0, 0, 270 > ;}
else if (iNrAnim == 6) {POSITION = < 0.0, 0.0, 0.7>; Rotdeg = < 0, 0, 270 > ;}
else if (iNrAnim == 7) {POSITION = < 0.0, 0.0, 0.7>; Rotdeg = < 0, 0, 90 > ;}

if(llGetNumberOfPrims()> iPrimsDefault) // iPrimsDefault = 1
{
llStopAnimation("sit";);
llStopAnimation(SitAnim);
SitAnim=llGetInventoryName(INVENTORY_ANIMATION,iNrAnim);
llSetLinkPrimitiveParams(iPrimsDefault +1, [PRIM_POSITION, POSITION, PRIM_ROTATION, llGetRootRotation() * llEuler2Rot(Rotdeg *= DEG_TO_RAD)]);
llStartAnimation(SitAnim);
}
}
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-17-2009 15:40
Probably http://jira.secondlife.com/browse/SVC-93
Kaylan Draken
Registered User
Join date: 2 Dec 2006
Posts: 127
08-17-2009 23:40
Thanks Hewee,

I did read the SVC and see there is a workaround.

llSetPrimitiveParams([PRIM_ROTATION, rot/llGetRootRotation]);
or
llSetPrimtiiveParams([PRIM_ROTATION, (rot / llGetRootRotation) / llGetRootRotation);

but i have a question about this, which rotation do they mean with rot?
is rot the rotation of the root or child?

in my case is it the Towel or the Person laying on it :)

hope i have tonight time to look at it, have to work now before my boss see that
i am not working :)
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-18-2009 01:28
It would be the rotation of the child relative to the region coordinate system.
Kaylan Draken
Registered User
Join date: 2 Dec 2006
Posts: 127
08-18-2009 12:15
Thanks Hewee :)

Looks i solved it the problem was i mulitply with llGetRootRotation instead i had to divide with it.

the code line is now:
llSetLinkPrimitiveParams(iPrimsDefault +1, [PRIM_POSITION, POSITION, PRIM_ROTATION, (llEuler2Rot(Rotdeg *= DEG_TO_RAD)/llGetRootRotation())]);

Very very Thanks :)