Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

animate attachment

Dopel Dollinger
Registered User
Join date: 25 May 2007
Posts: 14
06-09-2007 12:44
Maybe somone can help me here. I am trying to animate a simple object attached to my spine. The script runs, but the object does not move. Any ideas?


list pos;
list rot;
list scale;

vector org;
vector tpos;

animate(string x)
{
llSay(0, "int: " + x);
integer i=(integer)x;
vector scalet=llList2Vector(scale,i);
vector post=llList2Vector(pos,i);

rotation rott=llList2Rot(rot,i);
llSay(0, "rot: " + (string)rott);
llSetScale(scalet);
llSetPos(post);
llSetLocalRot(rott);
}
default
{
state_entry()
{
integer i = 0;
llSay(0, "Anitmating...";);
for(i=0;i<=10;i++)
{
animate((string)i);
}
}

}
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
06-09-2007 14:08
How do the pos, rot, and scale lists get populated?
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
06-10-2007 07:29
Make sure that the coordinates / rotation you use are local and not world-centered.

The root prim of an attachment becomes a child prim of the avatar. Have you tried using llSetLocalPos()? BTW you can combine all three into one call:

llSetPrimitiveParams([PRIM_SIZE, scalet, PRIM_POSITION, post, PRIM_ROTATION, rott]);

Some sample data would help to diagnose the problem.
Fiona Branagh
... or her equivalent.
Join date: 1 Feb 2007
Posts: 156
06-10-2007 08:34
You're going to have an additional problem trying to animate the attachment.

Avatars become the root, and you will be trying to move the attachment in relation to this root, which sounds fine in theory; unfortunately, the rotations are going to end up all screwy when your avatar moves around, because the script will return a nonsense number for the avatar's local rotation.

If anyone's figured out how to make this not happen, a lot of us would love to see the solution.
_____________________
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
06-10-2007 09:07
More information can be found in the wiki https://wiki.secondlife.com/wiki/Rotation#Single_or_Root_Prims_vs_Linked_Prims_vs_Attachments
it seems that attachment rotations also become tricky because the functions also change base on if the attachment is a single prim attachment or a multiple prim attachment.
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
06-10-2007 11:21
From: Fiona Branagh
You're going to have an additional problem trying to animate the attachment.

Avatars become the root, and you will be trying to move the attachment in relation to this root, which sounds fine in theory; unfortunately, the rotations are going to end up all screwy when your avatar moves around, because the script will return a nonsense number for the avatar's local rotation.

If anyone's figured out how to make this not happen, a lot of us would love to see the solution.



I've solved it by only moving child prims, and keeping a root prim as reference, that way all movements / rotations are relative.
Fiona Branagh
... or her equivalent.
Join date: 1 Feb 2007
Posts: 156
07-02-2007 13:26
From: someone
I've solved it by only moving child prims, and keeping a root prim as reference, that way all movements / rotations are relative.


On an attachment? Are you sure?

When using localrot on an attachment, SL produces a nonsense number, although it does fine with the X Y and Z values. The entire attachment is made up of child prims in relation to the avatar, so I'm not sure what you're saying about only animating child prims.

Do you mean that you use a 'virtual' root prim, and use a different method to determine the other child prim's position to it instead of GetLocalRot?
_____________________
Fiona Branagh
... or her equivalent.
Join date: 1 Feb 2007
Posts: 156
03-25-2008 08:42
BTW, I had forgotten I'd posted on this thread aeons ago and found it while searching for something else. Yes, you CAN do what is suggested here - the link to the method is here:

Attachment Root Rotations

Enjoy!
_____________________