diff options
author | Robert Adams | 2014-04-02 21:53:58 -0700 |
---|---|---|
committer | Robert Adams | 2014-04-02 21:53:58 -0700 |
commit | 65c4cb48ac49bd6aa9e813a401411be5226d01a7 (patch) | |
tree | ec930505cba9332628e9ce0d576814ada83ce741 /OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |
parent | Fix problem with floating avatar by passing avatar size information (diff) | |
download | opensim-SC_OLD-65c4cb48ac49bd6aa9e813a401411be5226d01a7.zip opensim-SC_OLD-65c4cb48ac49bd6aa9e813a401411be5226d01a7.tar.gz opensim-SC_OLD-65c4cb48ac49bd6aa9e813a401411be5226d01a7.tar.bz2 opensim-SC_OLD-65c4cb48ac49bd6aa9e813a401411be5226d01a7.tar.xz |
BulletSim: make avatar physical shape to be a rectangle rather than
a capsule. Set the default to be the rectangle shape and adjust the
parameters in OpenSimDefaults.ini for the new shape.
The rectangle shape will perform better and avatar height can be
computed more accurately.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index c9b134c..dfcd2bf 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -657,7 +657,7 @@ public sealed class BSCharacter : BSPhysObject | |||
657 | 657 | ||
658 | private OMV.Vector3 ComputeAvatarScale(OMV.Vector3 size) | 658 | private OMV.Vector3 ComputeAvatarScale(OMV.Vector3 size) |
659 | { | 659 | { |
660 | OMV.Vector3 newScale; | 660 | OMV.Vector3 newScale = size; |
661 | 661 | ||
662 | // Bullet's capsule total height is the "passed height + radius * 2"; | 662 | // Bullet's capsule total height is the "passed height + radius * 2"; |
663 | // The base capsule is 1 unit in diameter and 2 units in height (passed radius=0.5, passed height = 1) | 663 | // The base capsule is 1 unit in diameter and 2 units in height (passed radius=0.5, passed height = 1) |
@@ -670,8 +670,6 @@ public sealed class BSCharacter : BSPhysObject | |||
670 | // for a asymmetrical capsule, other parts of the code presume it is cylindrical. | 670 | // for a asymmetrical capsule, other parts of the code presume it is cylindrical. |
671 | 671 | ||
672 | // Scale is multiplier of radius with one of "0.5" | 672 | // Scale is multiplier of radius with one of "0.5" |
673 | newScale.X = size.X / 2f; | ||
674 | newScale.Y = size.Y / 2f; | ||
675 | 673 | ||
676 | float heightAdjust = BSParam.AvatarHeightMidFudge; | 674 | float heightAdjust = BSParam.AvatarHeightMidFudge; |
677 | if (BSParam.AvatarHeightLowFudge != 0f || BSParam.AvatarHeightHighFudge != 0f) | 675 | if (BSParam.AvatarHeightLowFudge != 0f || BSParam.AvatarHeightHighFudge != 0f) |
@@ -692,8 +690,17 @@ public sealed class BSCharacter : BSPhysObject | |||
692 | heightAdjust += ((midHeightOffset) / (AVATAR_HI - AVATAR_MID)) * BSParam.AvatarHeightHighFudge; | 690 | heightAdjust += ((midHeightOffset) / (AVATAR_HI - AVATAR_MID)) * BSParam.AvatarHeightHighFudge; |
693 | } | 691 | } |
694 | } | 692 | } |
695 | // The total scale height is the central cylindar plus the caps on the two ends. | 693 | if (BSParam.AvatarShape == BSShapeCollection.AvatarShapeCapsule) |
696 | newScale.Z = (size.Z + (Math.Min(size.X, size.Y) * 2) + heightAdjust) / 2f; | 694 | { |
695 | newScale.X = size.X / 2f; | ||
696 | newScale.Y = size.Y / 2f; | ||
697 | // The total scale height is the central cylindar plus the caps on the two ends. | ||
698 | newScale.Z = (size.Z + (Math.Min(size.X, size.Y) * 2) + heightAdjust) / 2f; | ||
699 | } | ||
700 | else | ||
701 | { | ||
702 | newScale.Z = size.Z + heightAdjust; | ||
703 | } | ||
697 | // m_log.DebugFormat("{0} ComputeAvatarScale: size={1},adj={2},scale={3}", LogHeader, size, heightAdjust, newScale); | 704 | // m_log.DebugFormat("{0} ComputeAvatarScale: size={1},adj={2},scale={3}", LogHeader, size, heightAdjust, newScale); |
698 | 705 | ||
699 | // If smaller than the endcaps, just fake like we're almost that small | 706 | // If smaller than the endcaps, just fake like we're almost that small |