Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

user_profiles
Diva Canto 2013-05-14 08:12:23 -07:00
commit 66c328f51b
4 changed files with 44 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@ -649,12 +649,12 @@ public sealed class BSCharacter : BSPhysObject
OMV.Vector3 newScale;
// Bullet's capsule total height is the "passed height + radius * 2";
// The base capsule is 1 diameter and 2 height (passed radius=0.5, passed height = 1)
// The base capsule is 1 unit in diameter and 2 units in height (passed radius=0.5, passed height = 1)
// The number we pass in for 'scaling' is the multiplier to get that base
// shape to be the size desired.
// So, when creating the scale for the avatar height, we take the passed height
// (size.Z) and remove the caps.
// Another oddity of the Bullet capsule implementation is that it presumes the Y
// An oddity of the Bullet capsule implementation is that it presumes the Y
// dimension is the radius of the capsule. Even though some of the code allows
// for a asymmetrical capsule, other parts of the code presume it is cylindrical.
@ -662,8 +662,27 @@ public sealed class BSCharacter : BSPhysObject
newScale.X = size.X / 2f;
newScale.Y = size.Y / 2f;
float heightAdjust = BSParam.AvatarHeightMidFudge;
if (BSParam.AvatarHeightLowFudge != 0f || BSParam.AvatarHeightHighFudge != 0f)
{
// An avatar is between 1.61 and 2.12 meters. Midpoint is 1.87m.
// The "times 4" relies on the fact that the difference from the midpoint to the extremes is exactly 0.25
float midHeightOffset = size.Z - 1.87f;
if (midHeightOffset < 0f)
{
// Small avatar. Add the adjustment based on the distance from midheight
heightAdjust += -1f * midHeightOffset * 4f * BSParam.AvatarHeightLowFudge;
}
else
{
// Large avatar. Add the adjustment based on the distance from midheight
heightAdjust += midHeightOffset * 4f * 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)) / 2f;
newScale.Z = (size.Z + (Math.Min(size.X, size.Y) * 2) + heightAdjust) / 2f;
// 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
if (newScale.Z < 0)
newScale.Z = 0.1f;

View File

@ -90,7 +90,7 @@ public static class BSParam
public static bool ShouldUseBulletHACD { get; set; }
public static bool ShouldUseSingleConvexHullForPrims { get; set; }
public static float TerrainImplementation { get; private set; }
public static float TerrainImplementation { get; set; }
public static int TerrainMeshMagnification { get; private set; }
public static float TerrainFriction { get; private set; }
public static float TerrainHitFraction { get; private set; }
@ -125,6 +125,9 @@ public static class BSParam
public static float AvatarCapsuleWidth { get; private set; }
public static float AvatarCapsuleDepth { get; private set; }
public static float AvatarCapsuleHeight { get; private set; }
public static float AvatarHeightLowFudge { get; private set; }
public static float AvatarHeightMidFudge { get; private set; }
public static float AvatarHeightHighFudge { get; private set; }
public static float AvatarContactProcessingThreshold { get; private set; }
public static float AvatarBelowGroundUpCorrectionMeters { get; private set; }
public static float AvatarStepHeight { get; private set; }
@ -539,6 +542,12 @@ public static class BSParam
0.45f ),
new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar",
1.5f ),
new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground",
-0.2f ),
new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground",
0.1f ),
new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground",
0.1f ),
new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
0.1f ),
new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground",

View File

@ -318,8 +318,12 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
ret = new BSAPIXNA(engineName, this);
// Disable some features that are not implemented in BulletXNA
m_log.InfoFormat("{0} Disabling some physics features not implemented by BulletXNA", LogHeader);
m_log.InfoFormat("{0} Disabling ShouldUseBulletHACD", LogHeader);
BSParam.ShouldUseBulletHACD = false;
m_log.InfoFormat("{0} Disabling ShouldUseSingleConvexHullForPrims", LogHeader);
BSParam.ShouldUseSingleConvexHullForPrims = false;
m_log.InfoFormat("{0} Setting terrain implimentation to Heightmap", LogHeader);
BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap;
break;
}

View File

@ -283,9 +283,14 @@ public class BSShapeNative : BSShape
public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim)
{
// Native shapes are not shared so we return a new shape.
return new BSShapeNative(CreatePhysicalNativeShape(pPhysicsScene, pPrim,
BSShape ret = null;
lock (physShapeInfo)
{
ret = new BSShapeNative(CreatePhysicalNativeShape(pPhysicsScene, pPrim,
physShapeInfo.shapeType, (FixedShapeKey)physShapeInfo.shapeKey));
}
return ret;
}
// Make this reference to the physical shape go away since native shapes are not shared.
public override void Dereference(BSScene physicsScene)