Jump to content

llRezObject 2 axis rotation.


Samuel Saito
 Share

You are about to reply to a thread that has been inactive for 4736 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Well, I'm having a bugger of a time doing a 2 axis rotation on rez.

Rezzer is 0 rotation, and I can't figure out how to do a set 15deg X rotation, along with a variable stepped Z rotation. (Prim is a flexi, and I want it 'pointing' downward)

IE <0,165, 0/30/60/90>

No, not an animation, just a chain of prims following a rotation alignment.

I either get only 1 axis rotation, or just a mess.

Played with most of the functions, I think.

 

Any help would be appreciated.

 

Thank you.

Link to comment
Share on other sites

If I have properly understood you -- and I am not sure that I have, but I'm taking you to mean you want the stiff edge of the flexy at the bottom, with face 0 (if it's a box) uppermost and at a 15 degree angle, then I would start with something like this:

 

integer start_param = 9;rotation rot;string object;vector offset = <1.0,0.0,1.0>; //1 metre in front of the rezzer and 1 abovevector vector_rot=<15.0,0.0,0.0>; default{    state_entry()    {       rot = llEuler2Rot(vector_rot*DEG_TO_RAD);       object = llGetInventoryName(INVENTORY_OBJECT,0);    }    touch_start(integer total_number)    {       llRezAtRoot(object,llGetPos()+offset*llGetRot(),ZERO_VECTOR, rot * llGetRot(),start_param);    }}

 and then adjust the z component of vector_rot to alter the rezzed object's rotation round its local z axis.

Link to comment
Share on other sites

I'm really not sure what you're trying to do.   I though you meant you wanted to rez several prims, one at a time, increasing the rotation on the local z axis each time you rez one.   If that's what you're doing, you just have the script alter the z component of vector_rot each time you rez one.  But it looks like I misundertood.

Link to comment
Share on other sites

No, you were dead on. I'm just somewhat suprised that it must be done in two steps (create/modify), instead of doing it in the single creation step.

 

Doing a 2nd modify step was feeling like a hack to me, so I spent alot of time trying to figure out how to do it on creation :(

Link to comment
Share on other sites

It is all done in the llRezAt Root step, as Innula wrote the script.  The only part she left for you to add was incrementing the vector rot each time you click to rez a new prim. 

ETA: Here's a sample function. Call it in the touch_start event of Innula's script, right after the llRezAtRoot function, so that it increments rot and offset each time you touch the rezzer.

newrot(){    vector_rot.z += 30.0;    rot = llEuler2Rot(vector_rot*DEG_TO_RAD);    offset.y += 0.5;}   

 

Link to comment
Share on other sites

Ok, I see what's happening, and I think I read about this behavior.

 

It -IS- doing both rotations, but it's doing the Z rotation first, then the X, the result is that the object is rotated, then placed at 15 degress. So i've got an array of objects at 15 degress in the same orientation.

 

I want the 15 degrees, then a Z rotate. So I have an array of objects at 15 degress but in a increasing rotation.

Actually, this is what I'm looking for.

ciarray.png

 

Link to comment
Share on other sites

A bit of poking round in the archives took me to this thread, where I found Void's solution and adapted it to give me this:

default{	touch_start(integer num){		float baseNumChairs = 8; //-- for example, float because we'll need fractional angles		vector baseOffset = <1, 0, 0.5>; //-- distance chair is rezzed from center of table		rotation baseInterval = llEuler2Rot( <0, 0, TWO_PI / baseNumChairs> );// inteval in degrees for the next chair		integer counter = (integer)baseNumChairs;		rotation currentRot = llEuler2Rot(<0.0,15.0,0.0>*DEG_TO_RAD)*llGetRot();		vector currentOffset = baseOffset * currentRot;		do{			llRezAtRoot( "Object",llGetPos()+ currentOffset, ZERO_VECTOR, currentRot, counter );			currentOffset *= baseInterval;			currentRot *= baseInterval;		}while (--counter);	}}

 With a bit of tweaking it should do what you want, I think

angled rotations_001.png

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4736 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...