Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Combining llRot2 Fwd/Left/Up

Adenoraque Quinn
Registered User
Join date: 3 Dec 2005
Posts: 3
12-07-2005 07:33
Bear with me on this description. I know exactly what I want, but I tend to confuse...

Basically, I have a child prim who's position and rotation need to change at once, and local to the position/rotation of the object itself. I can do position movement and rotation at once using llSetPrimitiveParams() with PRIM_POSITION and PRIM_ROTATION.

However, to make each of those changes local, I've had to do some messy things. Anyways I got rotations to work just fine, but using the llRot2 Fwd/Left/Up functions in combination for positioning is giving me the hardest time. When I used just llRot2Up on a test, it worked well. When I add the other two, my results seemed random. Perhaps I shouldn't be adding them? I don't know.. but I know if I want my final product unbreakable and rotated as a whole while still able to function.. I need to use these llRot2 functions.

Please, I know I could settle for simple local position movements but I want the best. I can do those simple movement on my own, but I know if the object gets rotated certain ways, it will break. I just need help with llRot2 functions in combination. Thank you very much.
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
12-07-2005 07:58
Hmm, I'm not sure exactly what you're trying to do (code snippets might help!)

But won't llSetRot(llEuler2Rot(<x,y,z>;)) suffice? I find that works for most of my needs when trying to rotate a certain amount on each axis.
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
12-07-2005 08:02
I find it much easier to use the vector * rotation operator when I want to specify arbitrary vectors that are relative to the local (rotated) axis of the object.

llRot2Fwd(llGetRot()) is equivelant to <1, 0, 0> * llGetRot(). Im not exactly sure what you want to do though - if you want the object to move so that its position is +1 meter on every axis, try <1, 1, 1> * llGetRot(). Or if you simply want the object to go in that direction but only travel one meter in total use llVecNorm(<1, 1, 1>;) * llGetRot().
==Chris
Adenoraque Quinn
Registered User
Join date: 3 Dec 2005
Posts: 3
12-07-2005 10:10
Okay,
CODE

llSetPrimitiveParams([
PRIM_ROTATION, llEuler2Rot(<270,67.5,292.5>*DEG_TO_RAD)/( (ZERO_ROTATION / llGetLocalRot()) * llGetRot()),
PRIM_POSITION, (llRot2Fwd(llGetLocalRot())*(-0.03))+(llRot2Left(llGetLocalRot())*(-0.013))+(llRot2Up(llGetLocalRot())*0.158)
]);

llSleep(3);

llSetPrimitiveParams([
PRIM_ROTATION, llEuler2Rot(<180,0,0>*DEG_TO_RAD)/( (ZERO_ROTATION / llGetLocalRot()) * llGetRot()),
PRIM_POSITION, (llRot2Fwd(llGetLocalRot())*0)+(llRot2Left(llGetLocalRot())*0)+(llRot2Up(llGetLocalRot())*0.115)
]);


im multiplying the llRot2 functions by offsets from the root prim. The angles are also offsets from the root prim. That's what seemed logical to me, but I know I did something wrong.

This is what I'm rotating:

http://pegasus.cc.ucf.edu/~an162020/rot_slices.gif

Thats three pics of the same movement, to give a better idea. Each pizza slice shape there is the same prim at each end position it would be after a rotation. This is a tapered, flat, and cut cylinder. So, the center of it is the tip of it. But I want it to seem like its rotating about the middle of its curved edge. I've had this model for a long time, unlinked. It's a total mess full of listeners and hinges. It broke easily as well. So.. I hope that makes things more clear.
Adenoraque Quinn
Registered User
Join date: 3 Dec 2005
Posts: 3
12-08-2005 00:37
I changed all the llRot2 functions to a <x,y,z>*llGetLocalRot() but i get exactly the same problem. : /
Adenoraque Quinn
Registered User
Join date: 3 Dec 2005
Posts: 3
Figured it out
12-08-2005 05:03
Dividing my displacement vectors like this:

(<x,y,z> / ( (ZERO_ROTATION / llGetLocalRot()) * llGetRot()))

did the trick! I have no idea what the logic is behind that.. looks like there might be another way to write that.. but wow what a relief. I've been on this forever...