Detecting the position of a child prim?
|
Fairge Kinsella
Gravity isn't so serious!
Join date: 23 Oct 2004
Posts: 158
|
03-23-2005 21:27
Hello,
I have a linked object, with a script sitting in the parent prim. In that script, I would like to determine the position of one of the child objects. This is a once-off initialisation thing, and only needs to happen when the object is rezzed or has it's script reset.
The only function I can find that will get the position of another prim (not the one the script is sitting in) is llDetectedPos(), but I can't use that, because nothing has touched or collided with the child. I've tried using llSensor(), but it doesn't pick up child objects?
I can put a script in the child, so it will use llGetPos() and send it's own position back to the parent, but I'd really like to avoid putting a script in the child object.
Any advice?
Thanks, Fairge
|
Tiger Crossing
The Prim Maker
Join date: 18 Aug 2003
Posts: 1,560
|
03-24-2005 10:43
From: Fairge Kinsella I can put a script in the child, so it will use llGetPos() and send it's own position back to the parent, but I'd really like to avoid putting a script in the child object. You pretty much have to. 
_____________________
~ Tiger Crossing ~ (Nonsanity)
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
03-24-2005 13:45
I've not tried it, but as I understand it you can remote load scripts, so you could have an on_rez and state_entry event that loads the scripts into the children, gets them to link message their positions back, and then the script deletes itself. It would save you do the work...
|
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
|
03-24-2005 14:39
From: Fairge Kinsella I can put a script in the child, so it will use llGetPos() and send it's own position back to the parent, but I'd really like to avoid putting a script in the child object. Not to be blunt, but why? It's not going to cause any problems.
|
Fairge Kinsella
Gravity isn't so serious!
Join date: 23 Oct 2004
Posts: 158
|
03-28-2005 17:05
Sorry for the delay in replying, I was away for the weekend.
As for the why, it's simple laziness <grin>
As I'm learning, I'm updating scripts often. The child prims I want to get the location for are small, transparent, and a bugger to select. I've spent ages updating the scripts in them over and over again, and I thought it would be simpler if I could get rid of those scripts, and detect the child location from the parent.
But if that's not possible, then I'll wear it. The scripts in the child prims are pretty pared down, and hopefully I won't be changing them again. At the moment, putting a script to set the PIN will be just as long as the one to end the position. If I have to include any additional functionality, I'll look at remote loading the scripts, as Eloise has suggested.
Thanks for the help, Fairge
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
03-28-2005 17:32
you could get the key of linked prim, break the link, use the key to detect the prim via sensor, then relink it.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Spuds Milk
Registered User
Join date: 28 Sep 2004
Posts: 94
|
03-28-2005 18:19
a painfull mathy way would be to get the global position and rotation of root prim, then compute the location of child prim from that.
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
03-29-2005 00:30
From: Spuds Milk a painfull mathy way would be to get the global position and rotation of root prim, then compute the location of child prim from that. Its not that hard, you have to know the offset of the child from the root, and that offset cant change, but its basically this: childPos = llDetectedPos(0) + (CHILD_OFFSET * llDetectedRot(0)); ==Chris
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-29-2005 03:05
Well, the problem here is pretty much by design. However, if you have control and mod rights on the object, why not use: http://secondlife.com/badgeo/wakka.php?wakka=llSetRemoteScriptAccessPinhttp://secondlife.com/badgeo/wakka.php?wakka=llRemoteLoadScriptPinOnce the pin is set, you can broadcast out the scripts, get the positions, send them back, and remove the child scripts, all remotely. 
_____________________
---
|