diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 62b5a014a2..caeb4f8cf1 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 // Next, let's close the child agent connections that are too far away. uint neighbourx; uint neighboury; - - Utils.LongToUInts(neighbourRegion.RegionHandle, out neighbourx, out neighboury); - - neighbourx /= Constants.RegionSize; - neighboury /= Constants.RegionSize; + Util.RegionHandleToRegionLoc(neighbourRegion.RegionHandle, out neighbourx, out neighboury); agent.CloseChildAgents(neighbourx, neighboury); diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index c9b134cc4e..dfcd2bf43f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -657,7 +657,7 @@ public sealed class BSCharacter : BSPhysObject private OMV.Vector3 ComputeAvatarScale(OMV.Vector3 size) { - OMV.Vector3 newScale; + OMV.Vector3 newScale = size; // Bullet's capsule total height is the "passed height + radius * 2"; // 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 // for a asymmetrical capsule, other parts of the code presume it is cylindrical. // Scale is multiplier of radius with one of "0.5" - newScale.X = size.X / 2f; - newScale.Y = size.Y / 2f; float heightAdjust = BSParam.AvatarHeightMidFudge; if (BSParam.AvatarHeightLowFudge != 0f || BSParam.AvatarHeightHighFudge != 0f) @@ -692,8 +690,17 @@ public sealed class BSCharacter : BSPhysObject heightAdjust += ((midHeightOffset) / (AVATAR_HI - AVATAR_MID)) * BSParam.AvatarHeightHighFudge; } } - // The total scale height is the central cylindar plus the caps on the two ends. - newScale.Z = (size.Z + (Math.Min(size.X, size.Y) * 2) + heightAdjust) / 2f; + if (BSParam.AvatarShape == BSShapeCollection.AvatarShapeCapsule) + { + newScale.X = size.X / 2f; + newScale.Y = size.Y / 2f; + // The total scale height is the central cylindar plus the caps on the two ends. + newScale.Z = (size.Z + (Math.Min(size.X, size.Y) * 2) + heightAdjust) / 2f; + } + else + { + newScale.Z = size.Z + heightAdjust; + } // m_log.DebugFormat("{0} ComputeAvatarScale: size={1},adj={2},scale={3}", LogHeader, size, heightAdjust, newScale); // 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 860193f30d..4d14a9edb5 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -128,6 +128,7 @@ public static class BSParam public static float AvatarAlwaysRunFactor { get; private set; } public static float AvatarDensity { get; private set; } public static float AvatarRestitution { get; private set; } + public static int AvatarShape { get; private set; } public static float AvatarCapsuleWidth { get; private set; } public static float AvatarCapsuleDepth { get; private set; } public static float AvatarCapsuleHeight { get; private set; } @@ -565,6 +566,8 @@ public static class BSParam 3500f) , // 3.5 * 100 new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 0f ), + new ParameterDefn("AvatarShape", "Code for avatar physical shape: 0:capsule, 1:cube, 2:ovoid, 2:mesh", + BSShapeCollection.AvatarShapeCube ) , new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", 0.6f ) , new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", @@ -572,11 +575,11 @@ public static class BSParam new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", 1.5f ), new ParameterDefn("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", - -0.2f ), + 0f ), new ParameterDefn("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", - 0.1f ), + -0.1f ), new ParameterDefn("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", - 0.1f ), + 0f ), new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 0.1f ), new ParameterDefn("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 32bbc8f5c3..721a8eb7cc 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs @@ -124,6 +124,10 @@ public sealed class BSShapeCollection : IDisposable // Info in prim.BSShape is updated to the new shape. // Returns 'true' if the geometry was rebuilt. // Called at taint-time! + public const int AvatarShapeCapsule = 0; + public const int AvatarShapeCube = 1; + public const int AvatarShapeOvoid = 2; + public const int AvatarShapeMesh = 3; private bool CreateGeom(bool forceRebuild, BSPhysObject prim, PhysicalDestructionCallback shapeCallback) { bool ret = false; @@ -137,10 +141,32 @@ public sealed class BSShapeCollection : IDisposable if (theChar != null) { DereferenceExistingShape(prim, shapeCallback); - prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim, + switch (BSParam.AvatarShape) + { + case AvatarShapeCapsule: + prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim, BSPhysicsShapeType.SHAPE_CAPSULE, FixedShapeKey.KEY_CAPSULE); - ret = true; - haveShape = true; + ret = true; + haveShape = true; + break; + case AvatarShapeCube: + prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim, + BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_CAPSULE); + ret = true; + haveShape = true; + break; + case AvatarShapeOvoid: + // Saddly, Bullet doesn't scale spheres so this doesn't work as an avatar shape + prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim, + BSPhysicsShapeType.SHAPE_SPHERE, FixedShapeKey.KEY_CAPSULE); + ret = true; + haveShape = true; + break; + case AvatarShapeMesh: + break; + default: + break; + } } // 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 fca0b49594..6d756a8f7d 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1015,9 +1015,9 @@ ; Avatar physics height adjustments. ; http://opensimulator.org/wiki/BulletSim#Adjusting_Avatar_Height - AvatarHeightLowFudge = -0.2 ; Adjustment at low end of height range - AvatarHeightMidFudge = 0.1 ; Adjustment at mid point of avatar height range - AvatarHeightHighFudge = 0.1 ; Adjustment at high end of height range + AvatarHeightLowFudge = 0 ; Adjustment at low end of height range + AvatarHeightMidFudge = -0.1 ; Adjustment at mid point of avatar height range + AvatarHeightHighFudge = 0 ; Adjustment at high end of height range ; Default linkset implmentation ; 'Constraint' uses physics constraints to hold linkset together. 'Compound'