Jump to content

sit target height adj


Xiija
 Share

You are about to reply to a thread that has been inactive for 955 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

4 minutes ago, Xiija said:

 

I cannot get my mind around the math.

i'm doing

  float x = ( avi.z/2 ) + (root.z / 2);

but it ends up either too low or too high.

should i be using a percent of the avi height or something?

Depends what you're trying to calculate, of course, but if you want the position of the avatar's feet, I think the calculation is 

vector vAvSize = llGetAgentSize(kAv);

float f = -1*((vAvSize.z*1.1)/2);

(and then add f to the avatar's z coordinate, of course).    That's what I use for traps and things, anyway.

  • Like 1
Link to comment
Share on other sites

Pay close attention to the caveats in the wiki discussion of llGetAgentSize.  The returned value may not be what you expect.  I don't think it will make much difference how you calculate it.  You can hope that standard- size avatars will need to be offset by almost the same amount, but non-standard shapes may vary quite a bit.

EDIT: I have used a method like Innula's, but it's really a crap shoot. The 1.1 factor is one that I've seen in scripts for a very long time.  It seems to be an empirical fudge factor that approximates the difference between the value reported by llGetAgentSize (which does not include the head, for some reason I have forgotten -- the bounding box, maybe?) and the avatar's real height (which does include the head).  That's close for standard-sized avatars, but not for everyone.

Edited by Rolig Loon
  • Like 1
Link to comment
Share on other sites

5 hours ago, Rolig Loon said:

Pay close attention to the caveats in the wiki discussion of llGetAgentSize.  The returned value may not be what you expect.  I don't think it will make much difference how you calculate it.  You can hope that standard- size avatars will need to be offset by almost the same amount, but non-standard shapes may vary quite a bit.

EDIT: I have used a method like Innula's, but it's really a crap shoot. The 1.1 factor is one that I've seen in scripts for a very long time.  It seems to be an empirical fudge factor that approximates the difference between the value reported by llGetAgentSize (which does not include the head, for some reason I have forgotten -- the bounding box, maybe?) and the avatar's real height (which does include the head).  That's close for standard-sized avatars, but not for everyone.

The other option, I guess, would be a ray cast to see what's directly underneath the avatar.    Hard to go wrong with that, I'd have thought.

  • Confused 1
Link to comment
Share on other sites

7 hours ago, Rolig Loon said:

llGetAgentSize (which does not include the head, for some reason I have forgotten -- the bounding box, maybe?)

Yup, the function returns the size of the bounding box for the avatar's physics representation - which terminates at eye level and is where the camera is positioned in mouselook.

Edited by Fenix Eldritch
clarification
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 955 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...