BulletSim: adjust avatar capsule height calculation to be closer to defined SL heights. Correct BSParam avatar height defaults to be what's in OpenSimDefaults.ini.
parent
fd3e267ec6
commit
1f740926a2
|
@ -676,18 +676,20 @@ public sealed class BSCharacter : BSPhysObject
|
||||||
float heightAdjust = BSParam.AvatarHeightMidFudge;
|
float heightAdjust = BSParam.AvatarHeightMidFudge;
|
||||||
if (BSParam.AvatarHeightLowFudge != 0f || BSParam.AvatarHeightHighFudge != 0f)
|
if (BSParam.AvatarHeightLowFudge != 0f || BSParam.AvatarHeightHighFudge != 0f)
|
||||||
{
|
{
|
||||||
// An avatar is between 1.61 and 2.12 meters. Midpoint is 1.87m.
|
const float AVATAR_LOW = 1.1f;
|
||||||
// The "times 4" relies on the fact that the difference from the midpoint to the extremes is exactly 0.25
|
const float AVATAR_MID = 1.775f; // 1.87f
|
||||||
float midHeightOffset = size.Z - 1.87f;
|
const float AVATAR_HI = 2.45f;
|
||||||
|
// An avatar is between 1.1 and 2.45 meters. Midpoint is 1.775m.
|
||||||
|
float midHeightOffset = size.Z - AVATAR_MID;
|
||||||
if (midHeightOffset < 0f)
|
if (midHeightOffset < 0f)
|
||||||
{
|
{
|
||||||
// Small avatar. Add the adjustment based on the distance from midheight
|
// Small avatar. Add the adjustment based on the distance from midheight
|
||||||
heightAdjust += -1f * midHeightOffset * 4f * BSParam.AvatarHeightLowFudge;
|
heightAdjust += ((-1f * midHeightOffset) / (AVATAR_MID - AVATAR_LOW)) * BSParam.AvatarHeightLowFudge;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Large avatar. Add the adjustment based on the distance from midheight
|
// Large avatar. Add the adjustment based on the distance from midheight
|
||||||
heightAdjust += midHeightOffset * 4f * BSParam.AvatarHeightHighFudge;
|
heightAdjust += ((midHeightOffset) / (AVATAR_HI - AVATAR_MID)) * BSParam.AvatarHeightHighFudge;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The total scale height is the central cylindar plus the caps on the two ends.
|
// The total scale height is the central cylindar plus the caps on the two ends.
|
||||||
|
@ -698,6 +700,9 @@ public sealed class BSCharacter : BSPhysObject
|
||||||
if (newScale.Z < 0)
|
if (newScale.Z < 0)
|
||||||
newScale.Z = 0.1f;
|
newScale.Z = 0.1f;
|
||||||
|
|
||||||
|
DetailLog("{0},BSCharacter.ComputerAvatarScale,size={1},lowF={2},midF={3},hiF={4},adj={5},newScale={6}",
|
||||||
|
LocalID, size, BSParam.AvatarHeightLowFudge, BSParam.AvatarHeightMidFudge, BSParam.AvatarHeightHighFudge, heightAdjust, newScale);
|
||||||
|
|
||||||
return newScale;
|
return newScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -570,9 +570,9 @@ public static class BSParam
|
||||||
new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground",
|
new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground",
|
||||||
-0.2f ),
|
-0.2f ),
|
||||||
new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground",
|
new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground",
|
||||||
0.2f ),
|
0.1f ),
|
||||||
new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground",
|
new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground",
|
||||||
0.2f ),
|
0.1f ),
|
||||||
new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
|
new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
|
||||||
0.1f ),
|
0.1f ),
|
||||||
new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground",
|
new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground",
|
||||||
|
|
Loading…
Reference in New Issue