|
Moon Corrigible
Registered User
Join date: 19 Jan 2007
Posts: 75
|
05-19-2008 08:40
I can not for the life of me figure out what I am doing wrong. I have a setup with poseballs linked in as child prims and I want to be able to move the poseballs relative to the root prim depending upon the choice of the avatar using them. I *think* (maybe maybe) I have the positioning and rotation worked out (at least the debugging llSay look like the right coordinates. But nothing flippin MOVES!! I've tried llSetPos and llSetPrimitiveParams and they both just look at me like I'm daft. The only thing that works is rotation .. which I have completely wrong making it all the more disheartening - lol. Any input ya'll have would be GREATLY appreciated!!
listen(integer channel, string name, key id, string message) { llSay(0, "I heard" + message); //just a debug message if(message == "Stand") { animation = UP; vector newPos = llGetPos() + STANDOFFSET * llGetRot(); llSetPrimitiveParams([PRIM_POSITION, newPos]); llSetLocalRot(llGetRot()); llSay(0, "From the if statement newPos is " + (string)newPos); //debugging } else if(message == "Sitt") { animation = DOWN; vector newPos = llGetPos() + SITOFFSET * llGetRot(); llSetPrimitiveParams([PRIM_POSITION, newPos]); rotation newRot = llGetRot() * llEuler2Rot(<0,0,180>); llSetLocalRot(newRot); llSay(0, "From the if statement newPos is " + (string)newPos); //more debugging } StartAnimation(animation); //procedure defined earlier - didnt want to bug ya'll with it. llSay(0, "Called start animation with " + (string)animation); }
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
05-19-2008 08:44
If you try moving them where there _isn't_ an avatar sitting on them, do they move?
I've never played with this stuff but, IIRC, you need to get the link number of the avatar that's sitting, not the poseball they're sitting on.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Moon Corrigible
Registered User
Join date: 19 Jan 2007
Posts: 75
|
05-19-2008 08:51
Nope - I put it in a touch function too just in case - nada - zip zilch zero.
And since the script is IN the actual ball I want moved I thought I was good on the link number thing. I guess I could try moving the script to the root prim and using llMessageLinked.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-19-2008 08:55
llGetPos() returns the prim's global coordinates. llSetPos() (and llSetPrimitiveParams() and llSetLinkPrimitiveParams()) use local coordinates if the prim being moved is a child prim. That means statements like "newPos = llGetPos() + ...;" should almost certainly be replaced with "newPos = llGetLocalPos() + ...;". Similarly for rotating. What's almost certainly happening now is that you are trying to move to a position WAY outside the link distance limit, so nothing happens.
|
|
Moon Corrigible
Registered User
Join date: 19 Jan 2007
Posts: 75
|
05-19-2008 11:25
Gah! I cant get inworld to try it but that makes a WHOLE bunch of sense. I'm still a bit confused since my llSay was spitting back coordinates that were about where I wanted the ball to be (didnt check the fine tuning after the decimal point but the numbers before the decimal were all correct). Oohh I cant wait to try this thank you!!
|
|
Moon Corrigible
Registered User
Join date: 19 Jan 2007
Posts: 75
|
Blarg
05-19-2008 14:06
OK I'm sorta kinda close to figuring this out but I'm starting to dent the wall from banging my head against it so I'm back with my head in my hands.
The thing is I want to move the child prim in relation to the root prim. So figuring out the new positon I want it set at I will need to figure out global coordinates - happy hunky dorey fine. But how do I turn those global cordinates into local coordinates to use with llSetPos?
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-19-2008 14:38
From: Moon Corrigible OK I'm sorta kinda close to figuring this out but I'm starting to dent the wall from banging my head against it so I'm back with my head in my hands.
The thing is I want to move the child prim in relation to the root prim. So figuring out the new positon I want it set at I will need to figure out global coordinates - happy hunky dorey fine. But how do I turn those global cordinates into local coordinates to use with llSetPos? vector rootPos = llGetRootPosition(); rotation rootRot = llGetRootRotation(); vector localPos = (globalPos-rootPos)/rootRot; rotation localRot = globalRot/rootRot;
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetRootPositionhttp://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetRootRotation
|
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
05-19-2008 15:18
llGetRootRotation() won't work the way you want with regards to attachments.
_____________________
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
|