diff options
5 files changed, 51 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 62b5a01..caeb4f8 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1765,11 +1765,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1765 | // Next, let's close the child agent connections that are too far away. | 1765 | // Next, let's close the child agent connections that are too far away. |
1766 | uint neighbourx; | 1766 | uint neighbourx; |
1767 | uint neighboury; | 1767 | uint neighboury; |
1768 | 1768 | Util.RegionHandleToRegionLoc(neighbourRegion.RegionHandle, out neighbourx, out neighboury); | |
1769 | Utils.LongToUInts(neighbourRegion.RegionHandle, out neighbourx, out neighboury); | ||
1770 | |||
1771 | neighbourx /= Constants.RegionSize; | ||
1772 | neighboury /= Constants.RegionSize; | ||
1773 | 1769 | ||
1774 | agent.CloseChildAgents(neighbourx, neighboury); | 1770 | agent.CloseChildAgents(neighbourx, neighboury); |
1775 | 1771 | ||
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 |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 860193f..4d14a9e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -128,6 +128,7 @@ public static class BSParam | |||
128 | public static float AvatarAlwaysRunFactor { get; private set; } | 128 | public static float AvatarAlwaysRunFactor { get; private set; } |
129 | public static float AvatarDensity { get; private set; } | 129 | public static float AvatarDensity { get; private set; } |
130 | public static float AvatarRestitution { get; private set; } | 130 | public static float AvatarRestitution { get; private set; } |
131 | public static int AvatarShape { get; private set; } | ||
131 | public static float AvatarCapsuleWidth { get; private set; } | 132 | public static float AvatarCapsuleWidth { get; private set; } |
132 | public static float AvatarCapsuleDepth { get; private set; } | 133 | public static float AvatarCapsuleDepth { get; private set; } |
133 | public static float AvatarCapsuleHeight { get; private set; } | 134 | public static float AvatarCapsuleHeight { get; private set; } |
@@ -565,6 +566,8 @@ public static class BSParam | |||
565 | 3500f) , // 3.5 * 100 | 566 | 3500f) , // 3.5 * 100 |
566 | new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", | 567 | new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", |
567 | 0f ), | 568 | 0f ), |
569 | new ParameterDefn<int>("AvatarShape", "Code for avatar physical shape: 0:capsule, 1:cube, 2:ovoid, 2:mesh", | ||
570 | BSShapeCollection.AvatarShapeCube ) , | ||
568 | new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", | 571 | new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", |
569 | 0.6f ) , | 572 | 0.6f ) , |
570 | new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", | 573 | new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", |
@@ -572,11 +575,11 @@ public static class BSParam | |||
572 | new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar", | 575 | new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar", |
573 | 1.5f ), | 576 | 1.5f ), |
574 | new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", | 577 | new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", |
575 | -0.2f ), | 578 | 0f ), |
576 | new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", | 579 | new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", |
577 | 0.1f ), | 580 | -0.1f ), |
578 | new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", | 581 | new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", |
579 | 0.1f ), | 582 | 0f ), |
580 | new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", | 583 | new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", |
581 | 0.1f ), | 584 | 0.1f ), |
582 | new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", | 585 | new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 32bbc8f..721a8eb 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -124,6 +124,10 @@ public sealed class BSShapeCollection : IDisposable | |||
124 | // Info in prim.BSShape is updated to the new shape. | 124 | // Info in prim.BSShape is updated to the new shape. |
125 | // Returns 'true' if the geometry was rebuilt. | 125 | // Returns 'true' if the geometry was rebuilt. |
126 | // Called at taint-time! | 126 | // Called at taint-time! |
127 | public const int AvatarShapeCapsule = 0; | ||
128 | public const int AvatarShapeCube = 1; | ||
129 | public const int AvatarShapeOvoid = 2; | ||
130 | public const int AvatarShapeMesh = 3; | ||
127 | private bool CreateGeom(bool forceRebuild, BSPhysObject prim, PhysicalDestructionCallback shapeCallback) | 131 | private bool CreateGeom(bool forceRebuild, BSPhysObject prim, PhysicalDestructionCallback shapeCallback) |
128 | { | 132 | { |
129 | bool ret = false; | 133 | bool ret = false; |
@@ -137,10 +141,32 @@ public sealed class BSShapeCollection : IDisposable | |||
137 | if (theChar != null) | 141 | if (theChar != null) |
138 | { | 142 | { |
139 | DereferenceExistingShape(prim, shapeCallback); | 143 | DereferenceExistingShape(prim, shapeCallback); |
140 | prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim, | 144 | switch (BSParam.AvatarShape) |
145 | { | ||
146 | case AvatarShapeCapsule: | ||
147 | prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim, | ||
141 | BSPhysicsShapeType.SHAPE_CAPSULE, FixedShapeKey.KEY_CAPSULE); | 148 | BSPhysicsShapeType.SHAPE_CAPSULE, FixedShapeKey.KEY_CAPSULE); |
142 | ret = true; | 149 | ret = true; |
143 | haveShape = true; | 150 | haveShape = true; |
151 | break; | ||
152 | case AvatarShapeCube: | ||
153 | prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim, | ||
154 | BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_CAPSULE); | ||
155 | ret = true; | ||
156 | haveShape = true; | ||
157 | break; | ||
158 | case AvatarShapeOvoid: | ||
159 | // Saddly, Bullet doesn't scale spheres so this doesn't work as an avatar shape | ||
160 | prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim, | ||
161 | BSPhysicsShapeType.SHAPE_SPHERE, FixedShapeKey.KEY_CAPSULE); | ||
162 | ret = true; | ||
163 | haveShape = true; | ||
164 | break; | ||
165 | case AvatarShapeMesh: | ||
166 | break; | ||
167 | default: | ||
168 | break; | ||
169 | } | ||
144 | } | 170 | } |
145 | 171 | ||
146 | // If the prim attributes are simple, this could be a simple Bullet native shape | 172 | // If the prim attributes are simple, this could be a simple Bullet native shape |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index fca0b49..6d756a8 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -1015,9 +1015,9 @@ | |||
1015 | 1015 | ||
1016 | ; Avatar physics height adjustments. | 1016 | ; Avatar physics height adjustments. |
1017 | ; http://opensimulator.org/wiki/BulletSim#Adjusting_Avatar_Height | 1017 | ; http://opensimulator.org/wiki/BulletSim#Adjusting_Avatar_Height |
1018 | AvatarHeightLowFudge = -0.2 ; Adjustment at low end of height range | 1018 | AvatarHeightLowFudge = 0 ; Adjustment at low end of height range |
1019 | AvatarHeightMidFudge = 0.1 ; Adjustment at mid point of avatar height range | 1019 | AvatarHeightMidFudge = -0.1 ; Adjustment at mid point of avatar height range |
1020 | AvatarHeightHighFudge = 0.1 ; Adjustment at high end of height range | 1020 | AvatarHeightHighFudge = 0 ; Adjustment at high end of height range |
1021 | 1021 | ||
1022 | ; Default linkset implmentation | 1022 | ; Default linkset implmentation |
1023 | ; 'Constraint' uses physics constraints to hold linkset together. 'Compound' | 1023 | ; 'Constraint' uses physics constraints to hold linkset together. 'Compound' |