aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs27
1 files changed, 23 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 542f732..3671fc2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -649,12 +649,12 @@ public sealed class BSCharacter : BSPhysObject
649 OMV.Vector3 newScale; 649 OMV.Vector3 newScale;
650 650
651 // Bullet's capsule total height is the "passed height + radius * 2"; 651 // Bullet's capsule total height is the "passed height + radius * 2";
652 // The base capsule is 1 diameter and 2 height (passed radius=0.5, passed height = 1) 652 // The base capsule is 1 unit in diameter and 2 units in height (passed radius=0.5, passed height = 1)
653 // The number we pass in for 'scaling' is the multiplier to get that base 653 // The number we pass in for 'scaling' is the multiplier to get that base
654 // shape to be the size desired. 654 // shape to be the size desired.
655 // So, when creating the scale for the avatar height, we take the passed height 655 // So, when creating the scale for the avatar height, we take the passed height
656 // (size.Z) and remove the caps. 656 // (size.Z) and remove the caps.
657 // Another oddity of the Bullet capsule implementation is that it presumes the Y 657 // An oddity of the Bullet capsule implementation is that it presumes the Y
658 // dimension is the radius of the capsule. Even though some of the code allows 658 // dimension is the radius of the capsule. Even though some of the code allows
659 // for a asymmetrical capsule, other parts of the code presume it is cylindrical. 659 // for a asymmetrical capsule, other parts of the code presume it is cylindrical.
660 660
@@ -662,8 +662,27 @@ public sealed class BSCharacter : BSPhysObject
662 newScale.X = size.X / 2f; 662 newScale.X = size.X / 2f;
663 newScale.Y = size.Y / 2f; 663 newScale.Y = size.Y / 2f;
664 664
665 float heightAdjust = BSParam.AvatarHeightMidFudge;
666 if (BSParam.AvatarHeightLowFudge != 0f || BSParam.AvatarHeightHighFudge != 0f)
667 {
668 // An avatar is between 1.61 and 2.12 meters. Midpoint is 1.87m.
669 // The "times 4" relies on the fact that the difference from the midpoint to the extremes is exactly 0.25
670 float midHeightOffset = size.Z - 1.87f;
671 if (midHeightOffset < 0f)
672 {
673 // Small avatar. Add the adjustment based on the distance from midheight
674 heightAdjust += -1f * midHeightOffset * 4f * BSParam.AvatarHeightLowFudge;
675 }
676 else
677 {
678 // Large avatar. Add the adjustment based on the distance from midheight
679 heightAdjust += midHeightOffset * 4f * BSParam.AvatarHeightHighFudge;
680 }
681 }
665 // The total scale height is the central cylindar plus the caps on the two ends. 682 // The total scale height is the central cylindar plus the caps on the two ends.
666 newScale.Z = (size.Z + (Math.Min(size.X, size.Y) * 2)) / 2f; 683 newScale.Z = (size.Z + (Math.Min(size.X, size.Y) * 2) + heightAdjust) / 2f;
684 // m_log.DebugFormat("{0} ComputeAvatarScale: size={1},adj={2},scale={3}", LogHeader, size, heightAdjust, newScale);
685
667 // If smaller than the endcaps, just fake like we're almost that small 686 // If smaller than the endcaps, just fake like we're almost that small
668 if (newScale.Z < 0) 687 if (newScale.Z < 0)
669 newScale.Z = 0.1f; 688 newScale.Z = 0.1f;