Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetLinkKey & llGetObjectDetails

Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-20-2008 05:56
hi, i'm basically trying to get the position of a child prim with the same object but i can't figure it out. i tried this:

key who = llGetLinkKey(3);
vector them = llGetObjectDetails(who,[OBJECT_POS]);

but it keeps telling me there's a type mismatch? from the wiki it looks like it should be

vector them = llGetObjectDetails(who,([OBJECT_POS])); (an extra set of parentheses around the list of object details requested) am i doing something wrong? can i not use that to get the positon of a linked prim?
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
09-20-2008 06:32
From: Ruthven Willenov
hi, i'm basically trying to get the position of a child prim with the same object but i can't figure it out. i tried this:

key who = llGetLinkKey(3);
vector them = llGetObjectDetails(who,[OBJECT_POS]);

but it keeps telling me there's a type mismatch? from the wiki it looks like it should be

vector them = llGetObjectDetails(who,([OBJECT_POS])); (an extra set of parentheses around the list of object details requested) am i doing something wrong? can i not use that to get the positon of a linked prim?

Try this:
key who = llGetLinkKey(3);
vector them = llList2Vector( llGetObjectDetails(who,[OBJECT_POS]), 0);
Should work better:)
_____________________
From Studio Dora
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-20-2008 06:55
ah ha, thanks, didn't even occur to me that it's creating a list of details. i'm trying to use that to make a flex point at another link in the build, problem is, if the object is rotated, it makes it point away instead of towards the target, even if i reset the script. the only way i could get it to work is if i reversed "me-them" depending on the position of each link. know of anyway to get it to dtect the correct calculation to make? i aready know about using moving _end(){llResetScript();}

default
{
state_entry()
{
vector me = llGetPos();
key who = llGetLinkKey(3);
vector them = llList2Vector( llGetObjectDetails(who,[OBJECT_POS]), 0);
vector point = me-them;
llSetPrimitiveParams( [ PRIM_FLEXIBLE, TRUE, 3, 0.0, 10.0, 0.0, 3.50, point ] );
}
}
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
09-20-2008 07:42
Unfortunately there's no way to detect when a prim changes rotation, to counter for this you'd need to use a timer to regularly look for any change and update accordingly.

The co-ordinates returned by llGetObjectDetails() should be world-coordinates, so the position of "them" should be fine, the issue will be with your flexi-prim's rotation. I'm not sure how you're calculating the force you want to apply, but theirPos - myPos (that is, target's position minus flexi-prim's position) should give you the force you need. Of course this won't solve the issue of the flexi-prim's base, as this can prevent it from flexing as far as you might like.

Is there a particular reason why you want to use the flexi-prim to point at a child? Why a flexi-prim and not a regular one that's fixed. Depending on your requirements there may be a better solution.
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-20-2008 07:56
hmm, what if i used llGetLocalRot or llGetRot?

vector point = me-them*llGetLocalRot();
or
vector point = me-them*llGetRot();

i suppose the local rotation wouldn't really help since that gets the rotation relative to the root prim? and the direction i want the flexi to point has nothing to do with the root's position.
it's for some furniture and using a flexi is the only way i could get the effect i wanted with certain prims. i'm just using the moving_end call to reset the script/force if the furniture has been rotated.

plus i've been wondering how to do it for a while for other projects. like a ball on a chain effect that has been asked about many times by others, but never really answered.
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-20-2008 18:07
GAAH! nope, got home, tried it, doesn't work at all, it ends up making the force all weird, it points way too much in a different direction, or sags too much
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
09-21-2008 01:51
I wrote a similar function some time ago, GetSitTarget, you may want to look at it. It is for getting the sit target of a seated avatar, it uses llGetObjectDetails but it does a bit more because the Sit Target calculation is kinda crazy.

You can find it here:
http://wiki.secondlife.com/wiki/LlSitTarget#Useful_Snippets
_____________________
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
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-21-2008 06:33
it looks like you're trying to help with getting the offset of the link. thanks i got that part, i'm just having trouble figure out how to calculate the offset to apply as a force to the flexi. local position i don't think will work because neither of the prims are the root (and the root may not be the same rotation
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369