Zarf Vantongerloo
Obscure Resident
Join date: 22 Jun 2005
Posts: 110
|
07-14-2005 12:30
I am trying to let a script in the root prim of a complex (many linked prims) object rez another complex object from the rezzer's inventory at a specific position and rotation relative to the rezzer. This has been discussed before, with several people giving somewhat contradictory recipes for it. However, from both my reading of the docs, the wiki, and this forum, and my in-world tests, it seems the "right" way to do this is like this: putThatThere(string item, vector relativePos, rotation relativeRotation) { vector basePos = llGetPos(); // position of root prim of rezzer rotation baseRot = llGetRot(); // rotation of root prim of rezzer vector newPos = basePos + relativePos * baseRot; vector newRot = baseRot * relativeRot; llRezObject(item, newPos, ZERO_VECTOR, newRot, 0); }
//example use: putUpDish() { // these values determined through hand placement dishZAngle = 34.5; dishRelPos = <0.25,-0.391,1.021>; vector angles; angles.z = dishZAngle * DEG2RAD; putThatThere("dish", dishRelPos, llEuler2Rot(angles)); }
With most objects in inventory this works perfectly: I can spin the base object around all I want, then issue the command that will rez the object from inventory, and it comes up in exactly in the right place and rotation with respect to the base object. However, it doesn't work for some objects. Specifically, if the object being rezzed has a root prim who's geometric center doesn't correspond to the center of mass of the object as a whole, then the above code fails. Anyone know what is going on here? Is llRezObject doing something screwy like using the center of mass for one of pos or rot, and using geometric center of root prim for the other?
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
07-14-2005 13:16
From: Zarf Vantongerloo Anyone know what is going on here? Is llRezObject doing something screwy like using the center of mass for one of pos or rot, and using geometric center of root prim for the other? It sure is! This has been the core of some heated debate and was the cause for llRezAtRoot's creation. Unfortunately, llRezAtRoot suffers a bug that I do not believe has been fixed. It has a bad habit of rezzing an object by referencing the second prim, as opposed to the root. Anyway, one way to deal with this is to just add a script in the rezzed object to move it to the proper location after the fact. You know: http://secondlife.com/badgeo/wakka.php?wakka=llListenhttp://secondlife.com/badgeo/wakka.php?wakka=listenhttp://secondlife.com/badgeo/wakka.php?wakka=llGetScriptNamehttp://secondlife.com/badgeo/wakka.php?wakka=llRemoveInventory... and all that good stuff. 
_____________________
---
|
Zarf Vantongerloo
Obscure Resident
Join date: 22 Jun 2005
Posts: 110
|
07-14-2005 13:25
From: Jeffrey Gomez It sure is! Tease! Can you tell me exactly what it is doing? Which is it? I searched all nine pages of this forum and didn't find an answer - just a lot of broken scripts! From: Jeffery Gomez Unfortunately, llRezAtRoot ... has a bad habit of rezzing an object by referencing the second prim, as opposed to the root. Does it doe this ALL the time, or just some of the time? None of the literature I've read about llRezAtRoot makes this clear. From: Jeffery Gomez Anyway, one way to deal with this is to just add a script in the rezzed object to move it to the proper location after the fact. I realize I could do that, and I'm pretty sure I can make it work... BUT, then the object appears at the wrong place and then moves. The effect isn't nearly as nice as it rezzing into the exact final location.
|
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
|
07-14-2005 15:26
From: Zarf Vantongerloo I realize I could do that, and I'm pretty sure I can make it work... BUT, then the object appears at the wrong place and then moves. The effect isn't nearly as nice as it rezzing into the exact final location. You could set the object to be completely invisible with llSetAlpha(0.0, ALL_SIDES) prior to placing it in your rezzer. After it rezzes, have it move, then llSetAlpha(1.0, ALL_SIDES) to make it visible again. That would give it the appearance of just popping into existence.
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
07-14-2005 15:33
From: Zarf Vantongerloo Tease! Can you tell me exactly what it is doing? Which is it? I searched all nine pages of this forum and didn't find an answer - just a lot of broken scripts! From here: http://secondlife.com/badgeo/wakka.php?wakka=llRezObjectFrom: someone When rezzing a linked set, pos specifies the geometric center, which can be determined with llGetGeometricCenter (when called from the object that is to be rezzed, so you'll have to store this information somewhere). I'd imagine you could also just compare llGetGeometricCenter with llGetPos, but I've never really tried. From: Zarf Vantongerloo Does it doe this ALL the time, or just some of the time? None of the literature I've read about llRezAtRoot makes this clear. Unsure, really. I personally just don't use llRezAtRoot at all until it's fixed. And yes, you can take Cath's advice as well.
_____________________
---
|