Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rezing offset taker

Sekker Thirroul
Registered User
Join date: 27 Aug 2006
Posts: 28
12-10-2008 06:23
Hi, I've been makeing a few basic furniture rezing, systems, I've mostly been seting them up manualy. Which is a pain so I wrote these scripts hopeing that it would alow me to get the information which I can just cut and paste into the rezing script.

//// Base script (in the rezzer box/platform) ////
default
{
state_entry()
{
llOwnerSay("When you are satisfied with all positions touch me";);
}
touch_start(integer CHANNEL)
{
if (llDetectedKey(0) == llGetOwner())
{
llSay(99887766,(string)llGetPos());

}
}
}

//////////Remote, (in all objects that will be rezed) //////////


default
{
state_entry()
{
llListen(99887766,"",NULL_KEY,"";);

}
listen(integer CHANNEL, string name, key id, string message)
{
vector REZPOS = (vector)message;
vector MYPOS = llGetPos() + llGetGeometricCenter();
rotation MYROT = llGetRot();
vector OFFSET = MYPOS - REZPOS;
llSay(0,"llRezObject("+llGetObjectName()+", llGetPos()+"+(string)OFFSET+",<0,0,0>,"+(string)MYROT+",rezchan);";);
llRemoveInventory(llGetScriptName());
}

}
//////////////////////////////////////////////////////////////////////////////////////


In this way each object says its rez comand (minus the "" aroudn the name but I can live with that).

The problem is that it dosn't give the correct offset I've tried substetuting center of mass for geometric center with no luck. I might just be to sick of the sight of it so if anyone can point out the error and fix please do.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-10-2008 07:05
llGetGeometricCenter() corresponds to no real readings you can get in world.

Use llRezAtRoot

http://wiki.secondlife.com/wiki/LlRezAtRoot
_____________________
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
Zen Zeddmore
3dprinter Enthusiast
Join date: 31 Jul 2006
Posts: 604
12-13-2008 08:40
(vector)message

You can do that? I'd assumed string to float was a hairy problem. I'll have to go in world and test. I hope it works. It would solve a considerable problem right now.
_____________________
A kilogram of programmable nanobots can lower the certainty of both death AND taxes.
Zen Zeddmore
3dprinter Enthusiast
Join date: 31 Jul 2006
Posts: 604
12-13-2008 09:35
hmm, I'm seeing that without something like

positionSTR = "<" +(string)llGetPos() + ">";
llSay(channel,positionSTR)



the (vector)message returns <0.00000,0.00000,0.00000>
_____________________
A kilogram of programmable nanobots can lower the certainty of both death AND taxes.
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
12-13-2008 12:11
Use llRezAtRoot for precise positioning, I never really saw the point of llRezObject's strange offsetting that it caused.

Zed: Yeah, you can directly typecast any type to string.
_____________________

Geometric Library, for all your 3D maths needs.
https://wiki.secondlife.com/wiki/Geometric

Creator of the Vertical Life Client
Zen Zeddmore
3dprinter Enthusiast
Join date: 31 Jul 2006
Posts: 604
12-13-2008 12:16
sure you can cast anything into a string, It's the reverse operation that's atypical.
the string 1234 in most languages needs a string2number() function to turn it into the integer 1234
_____________________
A kilogram of programmable nanobots can lower the certainty of both death AND taxes.
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
12-14-2008 09:30
Integer: "1" = (string)1
Float: "3.200000" = (string)3.2
Vector: "<1.20000, 3.50000, 10.00000>" = (string)<1.2,3.5,10.0>
Rotation: "<0.00000, 0.00000, 0.00000, 1.00000>" = (string)<0,0,0,1>
List: "12243648" = (string)[12,24,36,48]

1 = (integer)"1"
3.2 = (float)"3.200000"
<1.2,3.5,10.0> = (vector)"<1.20000, 3.50000, 10.00000>"
<0.0,0.0,0.0,1.0> = (rotation)"<0.00000, 0.00000, 0.00000, 1.00000>"

Simple enough. This is also called explicit typecasting.
There is a full description of this and what typecastes there are available shown in a table: http://wiki.secondlife.com/wiki/Typecast
_____________________

Geometric Library, for all your 3D maths needs.
https://wiki.secondlife.com/wiki/Geometric

Creator of the Vertical Life Client