diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 34 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 4 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 4 |
5 files changed, 53 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 542f732..ff5b6ab 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -419,7 +419,7 @@ public sealed class BSCharacter : BSPhysObject | |||
419 | DetailLog("{0},BSCharacter.setTargetVelocity,call,vel={1}", LocalID, value); | 419 | DetailLog("{0},BSCharacter.setTargetVelocity,call,vel={1}", LocalID, value); |
420 | m_targetVelocity = value; | 420 | m_targetVelocity = value; |
421 | OMV.Vector3 targetVel = value; | 421 | OMV.Vector3 targetVel = value; |
422 | if (_setAlwaysRun) | 422 | if (_setAlwaysRun && !_flying) |
423 | targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 0f); | 423 | targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 0f); |
424 | 424 | ||
425 | if (m_moveActor != null) | 425 | if (m_moveActor != null) |
@@ -481,7 +481,10 @@ public sealed class BSCharacter : BSPhysObject | |||
481 | _orientation = value; | 481 | _orientation = value; |
482 | PhysScene.TaintedObject("BSCharacter.setOrientation", delegate() | 482 | PhysScene.TaintedObject("BSCharacter.setOrientation", delegate() |
483 | { | 483 | { |
484 | ForceOrientation = _orientation; | 484 | // Bullet assumes we know what we are doing when forcing orientation |
485 | // so it lets us go against all the rules and just compensates for them later. | ||
486 | // This keeps us from flipping the capsule over which the veiwer does not understand. | ||
487 | ForceOrientation = new OMV.Quaternion(0, 0, _orientation.Z,0); | ||
485 | }); | 488 | }); |
486 | } | 489 | } |
487 | } | 490 | } |
@@ -649,12 +652,12 @@ public sealed class BSCharacter : BSPhysObject | |||
649 | OMV.Vector3 newScale; | 652 | OMV.Vector3 newScale; |
650 | 653 | ||
651 | // Bullet's capsule total height is the "passed height + radius * 2"; | 654 | // Bullet's capsule total height is the "passed height + radius * 2"; |
652 | // The base capsule is 1 diameter and 2 height (passed radius=0.5, passed height = 1) | 655 | // The base capsule is 1 unit in diameter and 2 units in height (passed radius=0.5, passed height = 1) |
653 | // The number we pass in for 'scaling' is the multiplier to get that base | 656 | // The number we pass in for 'scaling' is the multiplier to get that base |
654 | // shape to be the size desired. | 657 | // shape to be the size desired. |
655 | // So, when creating the scale for the avatar height, we take the passed height | 658 | // So, when creating the scale for the avatar height, we take the passed height |
656 | // (size.Z) and remove the caps. | 659 | // (size.Z) and remove the caps. |
657 | // Another oddity of the Bullet capsule implementation is that it presumes the Y | 660 | // An oddity of the Bullet capsule implementation is that it presumes the Y |
658 | // dimension is the radius of the capsule. Even though some of the code allows | 661 | // dimension is the radius of the capsule. Even though some of the code allows |
659 | // for a asymmetrical capsule, other parts of the code presume it is cylindrical. | 662 | // for a asymmetrical capsule, other parts of the code presume it is cylindrical. |
660 | 663 | ||
@@ -662,8 +665,27 @@ public sealed class BSCharacter : BSPhysObject | |||
662 | newScale.X = size.X / 2f; | 665 | newScale.X = size.X / 2f; |
663 | newScale.Y = size.Y / 2f; | 666 | newScale.Y = size.Y / 2f; |
664 | 667 | ||
668 | float heightAdjust = BSParam.AvatarHeightMidFudge; | ||
669 | if (BSParam.AvatarHeightLowFudge != 0f || BSParam.AvatarHeightHighFudge != 0f) | ||
670 | { | ||
671 | // An avatar is between 1.61 and 2.12 meters. Midpoint is 1.87m. | ||
672 | // The "times 4" relies on the fact that the difference from the midpoint to the extremes is exactly 0.25 | ||
673 | float midHeightOffset = size.Z - 1.87f; | ||
674 | if (midHeightOffset < 0f) | ||
675 | { | ||
676 | // Small avatar. Add the adjustment based on the distance from midheight | ||
677 | heightAdjust += -1f * midHeightOffset * 4f * BSParam.AvatarHeightLowFudge; | ||
678 | } | ||
679 | else | ||
680 | { | ||
681 | // Large avatar. Add the adjustment based on the distance from midheight | ||
682 | heightAdjust += midHeightOffset * 4f * BSParam.AvatarHeightHighFudge; | ||
683 | } | ||
684 | } | ||
665 | // The total scale height is the central cylindar plus the caps on the two ends. | 685 | // The total scale height is the central cylindar plus the caps on the two ends. |
666 | newScale.Z = (size.Z + (Math.Min(size.X, size.Y) * 2)) / 2f; | 686 | newScale.Z = (size.Z + (Math.Min(size.X, size.Y) * 2) + heightAdjust) / 2f; |
687 | // m_log.DebugFormat("{0} ComputeAvatarScale: size={1},adj={2},scale={3}", LogHeader, size, heightAdjust, newScale); | ||
688 | |||
667 | // If smaller than the endcaps, just fake like we're almost that small | 689 | // If smaller than the endcaps, just fake like we're almost that small |
668 | if (newScale.Z < 0) | 690 | if (newScale.Z < 0) |
669 | newScale.Z = 0.1f; | 691 | newScale.Z = 0.1f; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 3ca7e16..d33292f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -90,7 +90,7 @@ public static class BSParam | |||
90 | public static bool ShouldUseBulletHACD { get; set; } | 90 | public static bool ShouldUseBulletHACD { get; set; } |
91 | public static bool ShouldUseSingleConvexHullForPrims { get; set; } | 91 | public static bool ShouldUseSingleConvexHullForPrims { get; set; } |
92 | 92 | ||
93 | public static float TerrainImplementation { get; private set; } | 93 | public static float TerrainImplementation { get; set; } |
94 | public static int TerrainMeshMagnification { get; private set; } | 94 | public static int TerrainMeshMagnification { get; private set; } |
95 | public static float TerrainFriction { get; private set; } | 95 | public static float TerrainFriction { get; private set; } |
96 | public static float TerrainHitFraction { get; private set; } | 96 | public static float TerrainHitFraction { get; private set; } |
@@ -125,6 +125,9 @@ public static class BSParam | |||
125 | public static float AvatarCapsuleWidth { get; private set; } | 125 | public static float AvatarCapsuleWidth { get; private set; } |
126 | public static float AvatarCapsuleDepth { get; private set; } | 126 | public static float AvatarCapsuleDepth { get; private set; } |
127 | public static float AvatarCapsuleHeight { get; private set; } | 127 | public static float AvatarCapsuleHeight { get; private set; } |
128 | public static float AvatarHeightLowFudge { get; private set; } | ||
129 | public static float AvatarHeightMidFudge { get; private set; } | ||
130 | public static float AvatarHeightHighFudge { get; private set; } | ||
128 | public static float AvatarContactProcessingThreshold { get; private set; } | 131 | public static float AvatarContactProcessingThreshold { get; private set; } |
129 | public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } | 132 | public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } |
130 | public static float AvatarStepHeight { get; private set; } | 133 | public static float AvatarStepHeight { get; private set; } |
@@ -539,6 +542,12 @@ public static class BSParam | |||
539 | 0.45f ), | 542 | 0.45f ), |
540 | new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar", | 543 | new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar", |
541 | 1.5f ), | 544 | 1.5f ), |
545 | new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", | ||
546 | -0.2f ), | ||
547 | new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", | ||
548 | 0.1f ), | ||
549 | new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", | ||
550 | 0.1f ), | ||
542 | new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", | 551 | new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", |
543 | 0.1f ), | 552 | 0.1f ), |
544 | new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", | 553 | new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index a4a8794..3f407ce 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -318,8 +318,12 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
318 | ret = new BSAPIXNA(engineName, this); | 318 | ret = new BSAPIXNA(engineName, this); |
319 | // Disable some features that are not implemented in BulletXNA | 319 | // Disable some features that are not implemented in BulletXNA |
320 | m_log.InfoFormat("{0} Disabling some physics features not implemented by BulletXNA", LogHeader); | 320 | m_log.InfoFormat("{0} Disabling some physics features not implemented by BulletXNA", LogHeader); |
321 | m_log.InfoFormat("{0} Disabling ShouldUseBulletHACD", LogHeader); | ||
321 | BSParam.ShouldUseBulletHACD = false; | 322 | BSParam.ShouldUseBulletHACD = false; |
323 | m_log.InfoFormat("{0} Disabling ShouldUseSingleConvexHullForPrims", LogHeader); | ||
322 | BSParam.ShouldUseSingleConvexHullForPrims = false; | 324 | BSParam.ShouldUseSingleConvexHullForPrims = false; |
325 | m_log.InfoFormat("{0} Setting terrain implimentation to Heightmap", LogHeader); | ||
326 | BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap; | ||
323 | break; | 327 | break; |
324 | } | 328 | } |
325 | 329 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 2dc029e..6b09468 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |||
@@ -283,8 +283,13 @@ public class BSShapeNative : BSShape | |||
283 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) | 283 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) |
284 | { | 284 | { |
285 | // Native shapes are not shared so we return a new shape. | 285 | // Native shapes are not shared so we return a new shape. |
286 | return new BSShapeNative(CreatePhysicalNativeShape(pPhysicsScene, pPrim, | 286 | BSShape ret = null; |
287 | physShapeInfo.shapeType, (FixedShapeKey)physShapeInfo.shapeKey) ); | 287 | lock (physShapeInfo) |
288 | { | ||
289 | ret = new BSShapeNative(CreatePhysicalNativeShape(pPhysicsScene, pPrim, | ||
290 | physShapeInfo.shapeType, (FixedShapeKey)physShapeInfo.shapeKey)); | ||
291 | } | ||
292 | return ret; | ||
288 | } | 293 | } |
289 | 294 | ||
290 | // Make this reference to the physical shape go away since native shapes are not shared. | 295 | // Make this reference to the physical shape go away since native shapes are not shared. |
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index d181b78..42929ec 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -358,6 +358,10 @@ namespace OpenSim.Region.Physics.Meshing | |||
358 | physicsParms = (OSDMap)map["physics_shape"]; // old asset format | 358 | physicsParms = (OSDMap)map["physics_shape"]; // old asset format |
359 | else if (map.ContainsKey("physics_mesh")) | 359 | else if (map.ContainsKey("physics_mesh")) |
360 | physicsParms = (OSDMap)map["physics_mesh"]; // new asset format | 360 | physicsParms = (OSDMap)map["physics_mesh"]; // new asset format |
361 | else if (map.ContainsKey("medium_lod")) | ||
362 | physicsParms = (OSDMap)map["medium_lod"]; // if no physics mesh, try to fall back to medium LOD display mesh | ||
363 | else if (map.ContainsKey("high_lod")) | ||
364 | physicsParms = (OSDMap)map["high_lod"]; // if all else fails, use highest LOD display mesh and hope it works :) | ||
361 | 365 | ||
362 | if (physicsParms == null) | 366 | if (physicsParms == null) |
363 | { | 367 | { |