Thursday, January 5, 2012

Giants

Penny commented on the height script and pointed out to me that there is a bug, in the height detection of SL itself. I was not aware about that, and have here now the adjusted version of the script....
However...

the result is.. stunning:
"you are 6 ft. 1in.  tall, that equals 1.868088 m "

for comparing: my old script said, 5.7 ft.....

However, the Firestorm height meter shows the same like this script, plus:
if i rezz a prim and make it that high, then it is as tall as my avatar, almost exactly.

Going from here, then, we all have been giants and still are.... a detailed article about the avatar proportions can be found here:
http://pennycow.blogspot.com/2011/08/matter-of-proportion.html

Here is now the corrected script version:
//************************************************************************

      string name;
string saeheight = "";
vector size;
float heightfeet;
key id;
string round_float(float value) {
string result = (string)value;
return llGetSubString(result, 0, llSubStringIndex(result, ".") + 2);
}

default
{
    state_entry()
    {
        //llSetStatus(STATUS_PHANTOM, TRUE);
        llSetText( "", < 1,1,1>, 1 );
    }

    collision_start (integer total_number)
    {
    id=(llDetectedKey(0));
      string name;
string saeheight = "";
vector size;
float heightfeet;

name = (llKey2Name(id));
size = llGetAgentSize(id);
float m = size.z;
m *= 1.1057; // Multiplier
float f = m * 3.28083;
integer ft = (integer)f;
float f2 = f - (float)ft;
integer in = (integer)(12.0 * f2);
heightfeet = size.z * 3.28083;
saeheight = (string)((integer) llFloor(heightfeet)) + " ft. ";
heightfeet -= llFloor(heightfeet);
saeheight += (string)((integer)(llRound(heightfeet * 12))) + " in.";
//llSay(0, llKey2Name(id) + " is " + (string)m + " m (" + (string)ft + " ft. " + (string)in + "in.) tall. (counting shoes) - Accurate SL Height");
vector junk = llGetScale();
        llInstantMessage(id, "you are " + (string)ft + " ft. " + (string)in + "in. "+ " tall, that equals " + (string)m + " m ");
        if (size.z*100<150)
{
        llInstantMessage(id, "Your size is small. This is just a hint. Nothing else.");
}
       else  if (size.z*100>200)
{
        llInstantMessage(id, "Your size is very tall. This is just a hint. Nothing else.");
}
     
     

    }
}
//********************************************************

1 comment:

  1. In fact, there isn't a single 'rule' to go from the llGetAgentSize().z height to the actual height measured by comparing to a prim's height.
    Besides multiplying by 1.25, as I have seen (not very good) and 1.1 (like you do) I've seen adding of 6 inch (somewhere between 14 and 15 cm works quite well). I also found combinations like multiplying by 1.03, then adding 8 cm.
    Turns out that it all depends on which sliders you used to achieve your height. Just moving one, like leg length, will be consistent with a 'formula', but if you then change the size of your head, or of your torso, you need a new formula, to describe the effect of the change in leg length. In short, there is no way to determine the avatar height in a script, as it can't determine the setting of all the 6 to 8 sliders.
    Yet an other way to put it, 2 shapes, with the same size as reported by llGetAgentSize may have different actual sizes (though probably close) and vice versa.

    ReplyDelete

LinkWithin

Related Posts Plugin for WordPress, Blogger...