Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

beginner scripter need help with llrezobject

Medusa Torok
Registered User
Join date: 13 Oct 2007
Posts: 13
06-27-2009 01:45
hi, I am a scripting noob and need a little help..

what I am trying to achieve is make an object with a larger object inside it, when touched the larger object rezzes and the smaller one dies. I had a look at scripts inside existing objects in my inv, played around with them and I figured out that I can use llrezobject and then lldie to do this. Jumped up and down for joy when it actually worked. But what happens is that because llrezobject rezzes the new item at its geometric centre, it appears half submerged in the ground. Can anyone tell me if theres a way to get around this please.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
06-27-2009 02:42
You have to calculate the position you want.
for a single not rotated prim you can try to put this in a script inside the prim you rez:
CODE

on_rez( integer p)
{
vector sc = llGetScale();
vector newpos = llGetPos();
newpos.z = llGround(ZERO_VECTOR) + 0.5*sc.z;
llSetPos(newpos);
}

This can be generalized for an object by using llGetBoundingBox.
Happy scripting:)
_____________________
From Studio Dora
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
06-27-2009 04:49
let me make that easier... llRezAtRoot uses the root center, rather than the geometric. (llRezObject really only makes sense for physical objects, for all others use llRezAtRoot)
_____________________
|
| . "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...
| -
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
06-27-2009 05:00
From: Void Singer
let me make that easier... llRezAtRoot uses the root center, rather than the geometric. (llRezObject really only makes sense for physical objects, for all others use llRezAtRoot)
Right! but in Medusa's case the object will rezz partly underground whether you use llRezObject or llRezAtRoot
_____________________
From Studio Dora
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
06-27-2009 07:42
From: Dora Gustafson
Right! but in Medusa's case the object will rezz partly underground whether you use llRezObject or llRezAtRoot

depends on the position/size of the root in comparison to the rezzor... if the root is at the bottom of the object/similarly sized, no. if it's higher up/differently sized... probably, in which case it'll still need an offset.
_____________________
|
| . "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...
| -