Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

weight scale

Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
01-03-2005 18:48
How would I create an object that could tell me how much an object (or av) weighs? I see there's a GetAgentSize function but no GetAgentWeight one. :/

I'm guessing that since GetMass only returns the mass of the object the script is attached to, the scale would have to first be attached to the av, then the scale's weight removed from the combined weight. Surely it's been done before though...
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
01-03-2005 19:26
It's possible I have no idea what I'm talking about here, but this script...
CODE
default
{
touch_start(integer total_number)
{
key detected = llDetectedKey(0);
if (detected == llGetOwner());
{
float mass = llGetMass();
vector size = llGetAgentSize(detected);
// vector size = llGetScale();
float density = mass / size.x / size.y / size.z;


llSay(0,"Mass: " + (string)mass);
llSay(0,"Size: " + (string)size);
llSay(0,"Density: " + (string)density);
}
}
}
...returns 3.489141 for density on avatars, and 10.0 for density on other objects. (Uncomment the second "vector size" line for objects.) You should be able to figure out a mass estimation based on this, as the bounding box's width and depth are constant. Only height, the Z axis, changes.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
01-03-2005 22:46
Thanks, but isn't the mass already determined via GetMass? Did you mean determine a weight estimation or...?
Adam Zaius
Deus
Join date: 9 Jan 2004
Posts: 1,483
01-04-2005 05:31
Avatar weight is a constant. So, once you figure it for one av, you have them all. :)

-Adam
_____________________
Co-Founder / Lead Developer
GigasSecondServer
Kyrah Abattoir
cruelty delight
Join date: 4 Jun 2004
Posts: 2,786
01-04-2005 07:37
i dont think av weight is a constant, it seems small AV are more affected by physic than big AV
_____________________

tired of XStreetSL? try those!
apez http://tinyurl.com/yfm9d5b
metalife http://tinyurl.com/yzm3yvw
metaverse exchange http://tinyurl.com/yzh7j4a
slapt http://tinyurl.com/yfqah9u
Shack Dougall
self become: Object new
Join date: 9 Aug 2004
Posts: 1,028
01-04-2005 08:15
AV mass *NOT* a constant.

Put this code in a prim. Attach the prim. Touch it to see your mass. Make yourself taller. Touch again, and you will get a larger number.

Also, it looks like llGetMass() in an attachment returns the mass of the AV alone. It doesn't look like it includes the mass of attachments.

CODE

default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}

touch_start(integer total_number)
{
llSay(0, "mass = " + (string) llGetMass());
}
}
_____________________
Prim Composer for 3dsMax
-- complete offline builder for prims and sculpties in 3ds Max
http://liferain.com/downloads/primcomposer/

Hierarchical Prim Archive (HPA)
-- HPA is is a fully-documented, platform-independent specification for storing and transferring builds between Second Life-compatible platforms and tools.
https://liferain.com/projects/hpa
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
01-04-2005 08:20
From: Adam Zaius
Avatar weight is a constant. So, once you figure it for one av, you have them all. :)

-Adam


oh contrare. I dunno if it always shows up the same via llGetMass but I do know that llPushObject does act differently on smaller avs vs large. not to mention a larger av gets pushed less when firing a heavy projectile.
_____________________
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
01-04-2005 08:21
attachments have no mass.
_____________________
Shack Dougall
self become: Object new
Join date: 9 Aug 2004
Posts: 1,028
01-04-2005 09:37
From: Rickard Roentgen
attachments have no mass.


Neat! Just verified this! :)

I just tried this:

Put a physical movement script into a prim that was too heavy to move.

Unattached, it would try to move and then fall down.
Attached, it moved just fine.

Just for kicks I tried sitting on it. as expected, it behaved as unattached.
_____________________
Prim Composer for 3dsMax
-- complete offline builder for prims and sculpties in 3ds Max
http://liferain.com/downloads/primcomposer/

Hierarchical Prim Archive (HPA)
-- HPA is is a fully-documented, platform-independent specification for storing and transferring builds between Second Life-compatible platforms and tools.
https://liferain.com/projects/hpa
Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
05-20-2005 18:28
CODE

default
{
touch_start(integer total_number)
{
key detected = llDetectedKey(0);
float mass = llGetMass();
vector size = llGetAgentSize(detected);
// vector size = llGetScale();
float density = mass / (size.x * size.y * size.z);

llWhisper(0,"mass: " + (string)mass + ", size: " + (string)size + ", density: " + (string)density);
}
}
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
05-20-2005 22:00
From: Adam Zaius
Avatar weight is a constant. So, once you figure it for one av, you have them all. :)

-Adam


This can't possibly be true. llPushObject pushes smaller avatars harder.
_____________________
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
12-12-2005 03:47
Found this thread via a search; I've been playing around with some physics recently and got interested. It answers my question as to how to find one's own mass.

What I was wondering, though, was what the average mass of an av is? Has anyone got any idea? Perhaps one could do a survey...