diff options
author | Robert Adams | 2013-08-19 11:08:22 -0700 |
---|---|---|
committer | Robert Adams | 2013-09-11 09:12:00 -0700 |
commit | 6d83f3f02190509119f65da92def19d08ef825f9 (patch) | |
tree | 47b616652c6e010c862035e3537a5aaf239e2ea8 | |
parent | BulletSim: add extended physics function physGetLinkType(linkNum). Add implem... (diff) | |
download | opensim-SC_OLD-6d83f3f02190509119f65da92def19d08ef825f9.zip opensim-SC_OLD-6d83f3f02190509119f65da92def19d08ef825f9.tar.gz opensim-SC_OLD-6d83f3f02190509119f65da92def19d08ef825f9.tar.bz2 opensim-SC_OLD-6d83f3f02190509119f65da92def19d08ef825f9.tar.xz |
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.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 15 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 4 |
2 files changed, 12 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 291dfcd..28b2a7e 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -676,18 +676,20 @@ public sealed class BSCharacter : BSPhysObject | |||
676 | float heightAdjust = BSParam.AvatarHeightMidFudge; | 676 | float heightAdjust = BSParam.AvatarHeightMidFudge; |
677 | if (BSParam.AvatarHeightLowFudge != 0f || BSParam.AvatarHeightHighFudge != 0f) | 677 | if (BSParam.AvatarHeightLowFudge != 0f || BSParam.AvatarHeightHighFudge != 0f) |
678 | { | 678 | { |
679 | // An avatar is between 1.61 and 2.12 meters. Midpoint is 1.87m. | 679 | const float AVATAR_LOW = 1.1f; |
680 | // The "times 4" relies on the fact that the difference from the midpoint to the extremes is exactly 0.25 | 680 | const float AVATAR_MID = 1.775f; // 1.87f |
681 | float midHeightOffset = size.Z - 1.87f; | 681 | const float AVATAR_HI = 2.45f; |
682 | // An avatar is between 1.1 and 2.45 meters. Midpoint is 1.775m. | ||
683 | float midHeightOffset = size.Z - AVATAR_MID; | ||
682 | if (midHeightOffset < 0f) | 684 | if (midHeightOffset < 0f) |
683 | { | 685 | { |
684 | // Small avatar. Add the adjustment based on the distance from midheight | 686 | // Small avatar. Add the adjustment based on the distance from midheight |
685 | heightAdjust += -1f * midHeightOffset * 4f * BSParam.AvatarHeightLowFudge; | 687 | heightAdjust += ((-1f * midHeightOffset) / (AVATAR_MID - AVATAR_LOW)) * BSParam.AvatarHeightLowFudge; |
686 | } | 688 | } |
687 | else | 689 | else |
688 | { | 690 | { |
689 | // Large avatar. Add the adjustment based on the distance from midheight | 691 | // Large avatar. Add the adjustment based on the distance from midheight |
690 | heightAdjust += midHeightOffset * 4f * BSParam.AvatarHeightHighFudge; | 692 | heightAdjust += ((midHeightOffset) / (AVATAR_HI - AVATAR_MID)) * BSParam.AvatarHeightHighFudge; |
691 | } | 693 | } |
692 | } | 694 | } |
693 | // The total scale height is the central cylindar plus the caps on the two ends. | 695 | // The total scale height is the central cylindar plus the caps on the two ends. |
@@ -698,6 +700,9 @@ public sealed class BSCharacter : BSPhysObject | |||
698 | if (newScale.Z < 0) | 700 | if (newScale.Z < 0) |
699 | newScale.Z = 0.1f; | 701 | newScale.Z = 0.1f; |
700 | 702 | ||
703 | DetailLog("{0},BSCharacter.ComputerAvatarScale,size={1},lowF={2},midF={3},hiF={4},adj={5},newScale={6}", | ||
704 | LocalID, size, BSParam.AvatarHeightLowFudge, BSParam.AvatarHeightMidFudge, BSParam.AvatarHeightHighFudge, heightAdjust, newScale); | ||
705 | |||
701 | return newScale; | 706 | return newScale; |
702 | } | 707 | } |
703 | 708 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 737dda1..4e92e6d 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -570,9 +570,9 @@ public static class BSParam | |||
570 | new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", | 570 | new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", |
571 | -0.2f ), | 571 | -0.2f ), |
572 | new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", | 572 | new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", |
573 | 0.2f ), | 573 | 0.1f ), |
574 | new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", | 574 | new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", |
575 | 0.2f ), | 575 | 0.1f ), |
576 | new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", | 576 | new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", |
577 | 0.1f ), | 577 | 0.1f ), |
578 | new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", | 578 | new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", |