Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rezzed object not on level ground

Paulo Dielli
Symfurny Furniture
Join date: 19 Jan 2007
Posts: 780
01-28-2007 06:54
I made an object with several prims. I specifically took care that the base-prims of the object are on level ground. But when I rezz the total object in-world, it rezzes above ground.

The cause is a cutt offed cilinder, which is part of the object. What can I do to make the total linked object (including the cilinder) rezz on level ground instead of above ground?
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
01-28-2007 08:37
EDIT: code was not tested and is broken. See post #5. Sorry.

SL uses the centroid of the bounding box of a set of linked prims to determine its placement point relative to the world. The "bounding box" is the smallest rectangle - oriented along the XYZ axes - that you could fit around the linkset. I do not know whether the bounding box calculation respects cut prims; my guess is that it does not.

If your object always rezes a certain distance above the ground or floor, you could add a script like
CODE
float displacement = 0.5; // how high the object rezes above ground (m)

on_rez() {
vector v = <0, 0, displacement>;
llSetPos(llGetPos() - v);
}
in the root prim.

If it doesn't always rez at the same height, then this won't work. I've seen instances where rezzing a new cube fails to "hit" the surface, so there may also be generic problems in rezzing.

Good luck.
_____________________
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
01-28-2007 12:40
A script such as the previous poster mentioned is the only automatic solution.

Any cut prims that are on the lower sueface of a linkset are treated as if they were NOT cut, for purposes of rezzing placement. So if you had a half-cylander with the cut face toward the ground, the linkset will rez above the ground by a distance equal to the z-axis radius of that cylander.
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.
Paulo Dielli
Symfurny Furniture
Join date: 19 Jan 2007
Posts: 780
01-28-2007 13:39
Okay, makes sense. Thanks to you both for the explanation. Will try the script in order to maintain the design quality of my object. ;) Hehe. Thanks a lot.

EDIT:

Hmm, I'm getting a syntax error on (2, 0) That is on_rez. Should the script be part of a larger script with default state etcetera?
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
complete script
01-28-2007 16:28
CODE

// adjust this height
float wantedHeight = 1.0; // how high the object should rez above ground (m) -

default
{
on_rez(integer x) {
vector v = llGetPos ();
v.z = llGround(ZERO_VECTOR) + wantedHeight;
llSetPos(v);
}
}
Parker McTeague
dubious
Join date: 28 Sep 2004
Posts: 198
01-29-2007 07:59
that's useful, thanks! i tend to often use cut prims for chair legs and have this problem.
Paulo Dielli
Symfurny Furniture
Join date: 19 Jan 2007
Posts: 780
01-30-2007 04:17
Great Ed, that works perfectly. Thanks to you all for replying!!!
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
02-24-2007 07:52
Note. The script in post 5 ONLY works if you are rezzing the object on the terrain ground level! If you rez it inside a building or in a skybox, it still rezzes relative to the ground!

The following script works in buildings and skyboxes as well.

CODE
// adjust this height 
float adjustHeight = -0.5; // how much the position should be adjusted when the object is rezzed. (m) -

default
{
on_rez(integer x) {
vector v = llGetPos ();
v.z = v.z + adjustHeight;
llSetPos(v);
}
}
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.
Paulo Dielli
Symfurny Furniture
Join date: 19 Jan 2007
Posts: 780
02-25-2007 19:08
Ooooowww Ceera. I thought this thread was to an end. And indeed the scripts above only work on land level. Your script will be a big, big help for everyone who wants their structures to rez right in all occasions. I just don't know why I missed your post though. Saw it again through a link in another topic. Anyway, thanks a lot!
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
02-26-2007 11:44
In all fairness, all I did was slightly tweak the script that ed44 posted. He did most of the work in developing his version. But I'm glad it's useful.
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.