02-13-2006 08:08
According to the almighty LSL-Wiki. llGetMass() is supposed to return the mass of the prim which calls the function, not the combined mass of the entire link set (unless it's the root prim). And for the most part this is TRUE while you are working on a script, saving and then testing right away.

BUT!!! There is a problem. Once you rez the object, any llGetMass() function in a non-root prim will give you the mass of the entire link set, which it's not supposed to.

To clarify the problem lets go step by step.

Create two blocks, one small block and one very large dense block. Link them together so that the larger block is root. Create a new script in the smaller block as such:

1) set a variable float myMass = llGetMass();
2) then put a say, llOwnerSay("My mass is " + (string)myMass);
3) Then Save*. :-)

You will get "My Mass is 12" or some number accurately depicting the mass of just the smaller prim.

4) take the object into you inventory
5) rez the object.

Now you will get "My Mass is 8765" or some much higher number representing the mass of the entire link set.

6) Open the script, add a single space somewhere in the script, and then delete that single space.
7) Save the script (resetting wont do it)

Now you will once again get "My Mass is 12" until the next time you rez the object.

So as you can see, what I'm trying to explain is that after you save a script (but before you rez it again) the llGetMass() function returns the mass of the individual prim. But once you rez the object again it will return the mass of the entire link_set.

This inconsistency is not good, and will wreak Havoc on many scripts as it has with my tractor beam. I've had to hard code the mass of the prim into my formula which I don't feel comfortable with (cause it will have to be changed if I resize the object).

Also worth noting is that when this prim is used to llPushObject() The energy used to push seems to be the same regardless of what llGetMass() tells you, and I'm assuming that the energy used is that of the single prim, not that of the entire link set.

I believe that this is some kind of bug and so I guess I'll report it. But I wanted to mention it here and find if anyone else has had problems with this, and also see you anyone else can reproduce the bug.

PB
_____________________
I'll do anything for love, most things for money, and some things for a smile.