Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Position and Rotations once again

Zekez Tatum
Registered User
Join date: 6 Oct 2006
Posts: 5
12-02-2007 00:29
This has probably been asked 100 times but I've searched and searched....been messing with this and I've completely confused myself.

Basically what I have happening is:

An object gets rezzed with RezObject with ZERO_ROTATION, ZERO_VECTOR. This object is going to be moved to different locations depending on a menu choice.

What I'm trying to do is move the object to where it needs to be, rotation and position set, then have it SAY the Vector and Rotation and save that to a notecard.

Then, the notecard gets read and when a choice is made it will goto that position and rotation.

I can get this to work if the base object is at Zero Rotation. However if I turn it, the positions and rotations get totally messed up. I need the rezzed objects position and rotation to stay relative to the base objects position and rotation.

This is an area I am totally weak at and have frustrated and confused myself to death.

Can any of the Rotation Wizards help me out please.....
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-02-2007 01:48
rezzes 'object' at 1m from the rezzor 'top' with the same rotation regardless of rotation
CODE

vector offset = <.0, .0, 1.0>;
llRezobject( "object",
llGetPos() + offset * llGetRot(),
ZERO_VECTOR,
llGetRot(),
42 );
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Zekez Tatum
Registered User
Join date: 6 Oct 2006
Posts: 5
12-02-2007 07:07
Okay, RezObject like above, then I want to move this object to a location and get the values to save to a notecard.

On Rez get the positon and Rotation
vector position = llGetPos();
rotation rot = llGetRot();

====================
After moving Rezzed object to new location and saving to a notecard
llSay(0,(string)((llGetPos() - position)/rot));
llSay(0,(string)(llGetRot());
====================
root = (position value from above read from notecard)
turn = (rotation value from above read from notecard)

llSetPrimitiveParams([
PRIM_POSITION, (position + (vector)root),
PRIM_ROTATION, (rotation)turn*rot
]);

Want the object to move to the position set, relative the however the base object is situated.
Zepar Zhukovsky
Leveraging Confusion
Join date: 24 Oct 2006
Posts: 66
12-02-2007 08:45
As far as I know, you can't write to a notecard from within a script. I'm assuming you mean manually write to a notecard. You probably want to look at the functions that convert from rotations to Euler vectors. http://wiki.secondlife.com/wiki/LlRot2Euler This might make it easier to visualize what's happening.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-02-2007 08:53
just get the rezzor to say it's location, and get the rezzed object to say it's position, subtract one from the other, that's your offset... as for the rotation, I can't remember the exact formula, but lazily, set the rezzor up at ZERO_ROTATION, and just get the rezzed objects rotation... then when you want to recall it in the script it'll be rezzed-obj-rot * llGetRot() (instead of just getRot)

as noted (and I assumed what you meant) the only way to save values to a notecard is to manually type (or paste) them into a notecard and save

EDIT: assuming you just want the object to rez in a certain position, instead of moving it after rezzing, you could use the values you are saving in your notecard to rez the item there to begin with... assuming it's within 10m of the object (if not you'll need to do it the original way, and use multiple moves or WarpPos)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Zekez Tatum
Registered User
Join date: 6 Oct 2006
Posts: 5
12-02-2007 09:34
I'm manually copying the values to a notecard.

I have it say in open chat the (position start - position moved) and says how much it rotated (rot start - rotation move)

I want the object to rez, then people sit on it, are given a menu of different poses to chose. Since animators use different sit targets I need the rezzed ball to move to a new position depending on the pose chosen.

So my assumption is for rotation I can just add the difference from above to rotate it. As for the position, I again just add it (position start + notecard)*llGetRot(). That doesn't work.

As I said rotations really are my weak point.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-02-2007 10:42
From: Zekez Tatum
I'm manually copying the values to a notecard.

I have it say in open chat the (position start - position moved) and says how much it rotated (rot start - rotation move)

I want the object to rez, then people sit on it, are given a menu of different poses to chose. Since animators use different sit targets I need the rezzed ball to move to a new position depending on the pose chosen.

So my assumption is for rotation I can just add the difference from above to rotate it. As for the position, I again just add it (position start + notecard)*llGetRot(). That doesn't work.

As I said rotations really are my weak point.

who is doing the moving of the poses? the user? I ask because my mentiond method of using zero rotation isn't going to work for a user (well it could, but users are lazy)

I think saving (and reusing)
x = llVecDist( rezzor_pos, ball_pos );
y = llRotBetween( rezzor_pos, Ball_pos );

then calling (in place of the normal call)
llGetPos() + <x, .0, .0> * y, //-- in the position to rez @

getting an accurate rotational offset is eluding me atm...
rezor_rot / ball_rot MIGHT be what you want... me = tired
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Zekez Tatum
Registered User
Join date: 6 Oct 2006
Posts: 5
12-02-2007 11:27
The users aren't setting anything, I'm going to pre-setup where these positions should sit relative to the base object.

The rezzed object pops straight up

llRezObject("Object",llGetPos() + <0,0,1>*llGetRot(),ZERO_VECTOR,llGetRot(),remotechannel );

Users get on this object and a llDialog shows to them...

Pose1, Pose2, Pose3

They pick one and it move the ball and them to predetermined location and rotation, all relative to the base object.

I don't want the rezzed object to move until the user is seated and picked something from the menu.
Zekez Tatum
Registered User
Join date: 6 Oct 2006
Posts: 5
12-02-2007 13:39
Ok think I got the rotation worked out, just converted everything into degree's to deal with it.

Continuing on, to get the position values said to chat history that I will save to a notecard manually.

If the base object is at zero rotation and then I move the rezzed object to a location, I have it say its position subtracting the base objects position to get the difference.

However, when I rotate the base object, and do the same procedure, I get different numbers, because its no longer based on a zero rotation.

How can I get the position values said to always give them as if it was a zero rotation, without having to turn the base object to zero rotation?
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-02-2007 14:16
From: Zekez Tatum
Ok think I got the rotation worked out, just converted everything into degree's to deal with it.

Continuing on, to get the position values said to chat history that I will save to a notecard manually.

If the base object is at zero rotation and then I move the rezzed object to a location, I have it say its position subtracting the base objects position to get the difference.

However, when I rotate the base object, and do the same procedure, I get different numbers, because its no longer based on a zero rotation.

How can I get the position values said to always give them as if it was a zero rotation, without having to turn the base object to zero rotation?

Just solved that on today in this thread:

/54/0c/227162/1.html
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-03-2007 03:50
From: Zekez Tatum
Ok think I got the rotation worked out, just converted everything into degree's to deal with it.

Continuing on, to get the position values said to chat history that I will save to a notecard manually.

If the base object is at zero rotation and then I move the rezzed object to a location, I have it say its position subtracting the base objects position to get the difference.

However, when I rotate the base object, and do the same procedure, I get different numbers, because its no longer based on a zero rotation.

How can I get the position values said to always give them as if it was a zero rotation, without having to turn the base object to zero rotation?

that was the formula I gave above.... llGetPos() + offset * llGetRot();

if you are presetting all your calcualtions based on zero rotation, you'll use that formula for the final rotated product... you could aslo use it to calcuate moves for individual poses, it'll return the point you need to move to

rotation is handled the same way, all you need is the poseballs rotation, then the final product uses calc'd-rot * llGetRot()
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -