Xiija Posted September 13, 2021 Share Posted September 13, 2021 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? Link to comment Share on other sites More sharing options...
Innula Zenovka Posted September 13, 2021 Share Posted September 13, 2021 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. 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted September 13, 2021 Share Posted September 13, 2021 (edited) 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 September 13, 2021 by Rolig Loon 1 Link to comment Share on other sites More sharing options...
Innula Zenovka Posted September 13, 2021 Share Posted September 13, 2021 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. 1 Link to comment Share on other sites More sharing options...
Fenix Eldritch Posted September 14, 2021 Share Posted September 14, 2021 (edited) 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 September 14, 2021 by Fenix Eldritch clarification Link to comment Share on other sites More sharing options...
Recommended Posts
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