Jump to content
Sign in to follow this  
Mathieu Basiat

llRez problems with Rotation

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

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

Recommended Posts

I'm having issues rezzing an object, in that it always rezzes 90 degree away from where i want it.

 

the rez code is:

 

 llRezAtRoot("Cone", llGetPos() + (<-2,0,1 > * llGetRot()), ZERO_VECTOR,(llEuler2Rot(<315,0,270> * DEG_TO_RAD) * llGetRot()), 0);

 The cone is just a cone set to 0,0,0 rotation, with the rotation set in the rez script it should be pointing away from the cub, not parallel

 

anyone run into this problem? driving me batty!

 

Share this post


Link to post
Share on other sites

I've been puzzling over your question for 20 minutes qnd I can't figure out the geometry that you expect.  The cone should be pointing "away from the cub?" I assume you mean "cube".  -- What cube? And which direction is "away"?  Which direction is "parallel"?  There is no unique direction that is parallel to a cube. 

Relative to the cube's local X, Y, Z axes, where do you want the cone's +Z axis to point?

Share this post


Link to post
Share on other sites

I'm having difficulty visualising it, too.  

If you mean you want the cone to rez behind the rezzer with its base pointing towards the rezzer and its point pointing away from it, I think what you need is 

 llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT,0),llGetPos()+<-2.0,0.0,1.0>*llGetRot(),ZERO_VECTOR,llEuler2Rot(<0.0,270.0,0.0>*DEG_TO_RAD)*llGetRot(),0);

 but I'm not sure that is what you mean.

Share this post


Link to post
Share on other sites

<-2.0, 0.0, 1.0> == 2meters behind (the X-axis) and 1 meter above (the z axis) the position of  the rezzing prim. that would be 2m west, and 1m up if the rezzor is at zero rotation, otherwise it follows the rotation of the rezzor.

315, 0, 270 == rotate 270 on the z axis (no effect on the sahpe), o on the y, and 45deg tip toward north.

I think you wanted 0, 315, 0 (top towards west)....... at least that will get you the right facing..

 

in the future, if you zero align the prim you rez with you can position the prim that will be rezzed manually and rotate it to where you would like it to face, then read off it's alignment and subtract it's region position from the rezzors region position to get the offset

  • Like 1

Share this post


Link to post
Share on other sites

Sorry about the vague generalization as to where a wanted the rezzed prim to face.  The idea was the have the point face away from the rezzer, and 45 degrees up. While your code for 270 degrees away worked, inputting any variation to the angle did not, and in fact, rotated everything 90 degrees again.

The example I gave above was actually just a test, in the real object I am rezzing 5 things at non-90 degree angles.

 

Rez a cube. Go into local mode and paint the bottom x red ( the side the arrow is facing away from)

Rez a cone. Move the cone so that the base is aligned with the middle of the red face of the cube, and is still pointing upwards. Move the cone away from the cube and rotate it 45 degrees towards the horizon.

Here is a shot of how it may look:

 

Screen shot 2011-06-06 at 8.42.31 PM.png

 Now, copy the cone into inventory, rename it "Cone",  and drag it into the cube.

Add a script the the cube:

 

default{    state_entry()    {            }    touch_start(integer total_number)    {       llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT,0),llGetPos()+<-2.0,0.0,1.0>*llGetRot(),ZERO_VECTOR,llEuler2Rot(<315,0,270>*DEG_TO_RAD)*llGetRot(),0);           }}

 

Now touch the cube, rotate it 90 degrees and touch it again. The cone is rotated 90 degrees from where it should be.

If anyone is still having trouble visualizing it, I would be happy to send you an in-game example.

 

Here is the end result after 3 rotations/rezzes:

 

Screen shot 2011-06-06 at 8.55.13 PM.png

 

There is a problem similar to this with other games that use Quats:

http://www.google.com/search?client=safari&rls=en&q=Quaternions+90+degrees+off

 

but honestly I am sure it is something that I am doing

 

 

Share this post


Link to post
Share on other sites

Void was right about what you're trying to do, then.   Use the angle she suggested and your code should work.   

Made sure that the cube is rezzed at ZERO_ROTATION when you do the initial calculation -- from your picture, I don't think your cube can be -- it looks to me (since the screenshot shows the arrows in world, rather than local, rotation) as if you're starting with the cone positioned to the to the left of the cube, rather than behind it, from the cube's point of view.

I've just tried 

string cone;vector offset =<-2.0,0.0,1.0>;default{    state_entry()    {        cone=llGetInventoryName(INVENTORY_OBJECT,0);    }    touch_start(integer total_number)    {       llRezAtRoot(cone,llGetPos()+offset*llGetRot(),ZERO_VECTOR,llEuler2Rot(<0.0,315.0,0.0>*DEG_TO_RAD)*llGetRot(),0);    }}

 

in world and it works.   I'll drop you a copy of my test object

  • Like 1

Share this post


Link to post
Share on other sites

Yes, the initial rotation being zero makes sense as you are multiplying that by the rezzed objects rotation to get the final rotation, so if the initial rot is zero, the values for the rezzed objects are valid for that rotation.

 

Thanks, all!

Share this post


Link to post
Share on other sites

Yeah, it's always considerably easier to start with the rezzer at ZERO_ROTATION when you do your calculations.

If, for whatever reason, that's not possible, I do it this way:

 

vector rezzer_pos =<122.56290, 177.22310, 1750.81200>;  // the position of the rezzer when first you set it up -- read with llOwnerSay((string)llGetPos());in another scriptrotation rezzer_rot  =<0.00000, 0.70711, 0.00000, 0.70711>; //rotation of the rezzer, ditto -- read with llOwnerSay((string)llGetRot());in another scriptvector child_pos = <122.71410, 175.05910, 1750.81200>; // the position of the rezzed object at first set uprotation child_rot= <0.00000, 1.00000, 0.00000, 0.00000>;//rotation of rezzed objectvector offset;default{    state_entry()    {        offset = child_pos-rezzer_pos;        offset = offset/rezzer_rot;    }    touch_start(integer total_number)    {        llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT,0),        llGetPos()+offset*llGetRot(),        ZERO_VECTOR,        (child_rot/rezzer_rot)*llGetRot(),         99);    }}

 

Share this post


Link to post
Share on other sites

this is fantastic, but if i wanted to to have the rezzer move 2 meters after rezzing an object , can that be done with LLSetPos?

I have been trying to write a prim orginizer of sorts  and what I am trying to do / Rezz a prim, move 2 meters in a direction and rezz the next prim in it's inventory.

I have been able to rezz a prim and do a loop to move 2 meters , using your script i was able to get the loop to go in one direction, but modification of the script is required to change the direction of the rezzing objects.

 

 llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT,0), llGetPos()+offset*llGetRot(),  ZERO_VECTOR,(child_rot/rezzer_rot)*llGetRot(), 99);              

  llSetPos(llGetPos()+<-2,0,0>);

It appears to me, that somehow the script needs to read the rezzors rotation and align the directing of rezzing accordingly.

 

Any ideas?

Share this post


Link to post
Share on other sites

It would probably be easier if you started a new thread insterad of tagging onto this somewhat old one, where it's not likely to be seen.  Still.... you just want to rez something, move the rezzer and  rez something else?

llRezAtRoot("Something", llGetPos() + offset_vector*llGetRot(),ZERO_VECTOR, object_additional_rotation*llGetRot(),1);

llSetPos (new_position_vector);

llRezAtRoot("Something", llGetPos() + offset_vector*llGetRot(),ZERO_VECTOR, object_additional_rotation*llGetRot(),1);

Repeat as many times as you like.  The newly-rezzed object always has an offset from the rezzer = offset_vector, corrected by the rezzer's rotation.  It has its own local rotation, in this case equal to the rezzer's own rotation times an additional rotation, since that's what the problem specified. It's just that in the somewhat complex setup that the OP was asking about, the object_additional_rotation is (child_rot/rezzer_rot).

Share this post


Link to post
Share on other sites

actually I am try to change the rotation of the rezzer and have the rezzed objects rezzed in line and rotation of the rezzer

 

Example would be rezzing objects at z=0, move 2 meters, rezz object at z=0, etc...

rotate the rezzer 90 degrees , rezz object at z= 90, move 2 meters, rezz object at z=90

 

I am able to rezz at 0 , move 2 meters on a named loop, after rotating the rezzer however it still moves and rezzes at z=0

 

thanks for the help

Share this post


Link to post
Share on other sites

A little confusing....   When you write z = 0, do you mean zero degrees of rotation relative to the rezzer's rotation, or relative to regional rotation?

If you want to rotate the new object 90 degrees relative to the rezzer's current rotation, write

llEuler2Rot(<0.0,0.0,90.0>*DEG_TO_RAD)*llGetRot()

If you want the object to rez with a 90 degree rotation relative to the regional grid, write

llEuler2Rot(<0.0,0.0,90.0>*DEG_TO_RAD)

Share this post


Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 3230 days.

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...