diff options
author | Robert Adams | 2013-02-21 08:52:11 -0800 |
---|---|---|
committer | Robert Adams | 2013-02-21 08:52:11 -0800 |
commit | efb5da0aa672551a8a68e16066f3dd3991f75da4 (patch) | |
tree | 713c0f254a512f18e3025afc0b8d0621bade92c7 /OpenSim | |
parent | Add a method to IStatsCollector for returning stats as an OSDMap. (diff) | |
download | opensim-SC_OLD-efb5da0aa672551a8a68e16066f3dd3991f75da4.zip opensim-SC_OLD-efb5da0aa672551a8a68e16066f3dd3991f75da4.tar.gz opensim-SC_OLD-efb5da0aa672551a8a68e16066f3dd3991f75da4.tar.bz2 opensim-SC_OLD-efb5da0aa672551a8a68e16066f3dd3991f75da4.tar.xz |
BulletSim: add OutOfBounds logic and some position sanity checking
to eliminate some of the "cannot find terrain height" warning messages.
Diffstat (limited to 'OpenSim')
5 files changed, 68 insertions, 33 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 8dca7c6..1f186c3 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -443,6 +443,7 @@ public sealed class BSCharacter : BSPhysObject | |||
443 | PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate() | 443 | PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate() |
444 | { | 444 | { |
445 | DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 445 | DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
446 | PositionSanityCheck(); | ||
446 | ForcePosition = _position; | 447 | ForcePosition = _position; |
447 | }); | 448 | }); |
448 | } | 449 | } |
@@ -456,7 +457,6 @@ public sealed class BSCharacter : BSPhysObject | |||
456 | _position = value; | 457 | _position = value; |
457 | if (PhysBody.HasPhysicalBody) | 458 | if (PhysBody.HasPhysicalBody) |
458 | { | 459 | { |
459 | PositionSanityCheck(); | ||
460 | PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation); | 460 | PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation); |
461 | } | 461 | } |
462 | } | 462 | } |
@@ -512,9 +512,8 @@ public sealed class BSCharacter : BSPhysObject | |||
512 | // just assign to "Position" because of potential call loops. | 512 | // just assign to "Position" because of potential call loops. |
513 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() | 513 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() |
514 | { | 514 | { |
515 | DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 515 | DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
516 | if (PhysBody.HasPhysicalBody) | 516 | ForcePosition = _position; |
517 | PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation); | ||
518 | }); | 517 | }); |
519 | ret = true; | 518 | ret = true; |
520 | } | 519 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index c2a9671..dc57b67 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -46,6 +46,8 @@ public static class BSParam | |||
46 | public static float MeshMegaPrimThreshold { get; private set; } | 46 | public static float MeshMegaPrimThreshold { get; private set; } |
47 | public static float SculptLOD { get; private set; } | 47 | public static float SculptLOD { get; private set; } |
48 | 48 | ||
49 | public static int CrossingFailuresBeforeOutOfBounds { get; private set; } | ||
50 | |||
49 | public static float MinimumObjectMass { get; private set; } | 51 | public static float MinimumObjectMass { get; private set; } |
50 | public static float MaximumObjectMass { get; private set; } | 52 | public static float MaximumObjectMass { get; private set; } |
51 | public static float MaxLinearVelocity { get; private set; } | 53 | public static float MaxLinearVelocity { get; private set; } |
@@ -73,23 +75,23 @@ public static class BSParam | |||
73 | public static float TerrainRestitution { get; private set; } | 75 | public static float TerrainRestitution { get; private set; } |
74 | public static float TerrainCollisionMargin { get; private set; } | 76 | public static float TerrainCollisionMargin { get; private set; } |
75 | 77 | ||
76 | public static float DefaultFriction; | 78 | public static float DefaultFriction { get; private set; } |
77 | public static float DefaultDensity; | 79 | public static float DefaultDensity { get; private set; } |
78 | public static float DefaultRestitution; | 80 | public static float DefaultRestitution { get; private set; } |
79 | public static float CollisionMargin; | 81 | public static float CollisionMargin { get; private set; } |
80 | public static float Gravity; | 82 | public static float Gravity { get; private set; } |
81 | 83 | ||
82 | // Physics Engine operation | 84 | // Physics Engine operation |
83 | public static float MaxPersistantManifoldPoolSize; | 85 | public static float MaxPersistantManifoldPoolSize { get; private set; } |
84 | public static float MaxCollisionAlgorithmPoolSize; | 86 | public static float MaxCollisionAlgorithmPoolSize { get; private set; } |
85 | public static bool ShouldDisableContactPoolDynamicAllocation; | 87 | public static bool ShouldDisableContactPoolDynamicAllocation { get; private set; } |
86 | public static bool ShouldForceUpdateAllAabbs; | 88 | public static bool ShouldForceUpdateAllAabbs { get; private set; } |
87 | public static bool ShouldRandomizeSolverOrder; | 89 | public static bool ShouldRandomizeSolverOrder { get; private set; } |
88 | public static bool ShouldSplitSimulationIslands; | 90 | public static bool ShouldSplitSimulationIslands { get; private set; } |
89 | public static bool ShouldEnableFrictionCaching; | 91 | public static bool ShouldEnableFrictionCaching { get; private set; } |
90 | public static float NumberOfSolverIterations; | 92 | public static float NumberOfSolverIterations { get; private set; } |
91 | public static bool UseSingleSidedMeshes; | 93 | public static bool UseSingleSidedMeshes { get; private set; } |
92 | public static float GlobalContactBreakingThreshold; | 94 | public static float GlobalContactBreakingThreshold { get; private set; } |
93 | 95 | ||
94 | // Avatar parameters | 96 | // Avatar parameters |
95 | public static float AvatarFriction { get; private set; } | 97 | public static float AvatarFriction { get; private set; } |
@@ -118,6 +120,7 @@ public static class BSParam | |||
118 | public static float VehicleGroundGravityFudge { get; private set; } | 120 | public static float VehicleGroundGravityFudge { get; private set; } |
119 | public static bool VehicleDebuggingEnabled { get; private set; } | 121 | public static bool VehicleDebuggingEnabled { get; private set; } |
120 | 122 | ||
123 | // Linkset implementation parameters | ||
121 | public static float LinksetImplementation { get; private set; } | 124 | public static float LinksetImplementation { get; private set; } |
122 | public static bool LinkConstraintUseFrameOffset { get; private set; } | 125 | public static bool LinkConstraintUseFrameOffset { get; private set; } |
123 | public static bool LinkConstraintEnableTransMotor { get; private set; } | 126 | public static bool LinkConstraintEnableTransMotor { get; private set; } |
@@ -282,6 +285,11 @@ public static class BSParam | |||
282 | (s) => { return ShouldRemoveZeroWidthTriangles; }, | 285 | (s) => { return ShouldRemoveZeroWidthTriangles; }, |
283 | (s,v) => { ShouldRemoveZeroWidthTriangles = v; } ), | 286 | (s,v) => { ShouldRemoveZeroWidthTriangles = v; } ), |
284 | 287 | ||
288 | new ParameterDefn<int>("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", | ||
289 | 5, | ||
290 | (s) => { return CrossingFailuresBeforeOutOfBounds; }, | ||
291 | (s,v) => { CrossingFailuresBeforeOutOfBounds = v; } ), | ||
292 | |||
285 | new ParameterDefn<float>("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", | 293 | new ParameterDefn<float>("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", |
286 | 32f, | 294 | 32f, |
287 | (s) => { return MeshLOD; }, | 295 | (s) => { return MeshLOD; }, |
@@ -695,6 +703,10 @@ public static class BSParam | |||
695 | } | 703 | } |
696 | } | 704 | } |
697 | 705 | ||
706 | // ===================================================================== | ||
707 | // ===================================================================== | ||
708 | // There are parameters that, when set, cause things to happen in the physics engine. | ||
709 | // This causes the broadphase collision cache to be cleared. | ||
698 | private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) | 710 | private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) |
699 | { | 711 | { |
700 | BSScene physScene = pPhysScene; | 712 | BSScene physScene = pPhysScene; |
@@ -704,6 +716,7 @@ public static class BSParam | |||
704 | }); | 716 | }); |
705 | } | 717 | } |
706 | 718 | ||
719 | // This causes the constraint solver cache to be cleared and reset. | ||
707 | private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v) | 720 | private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v) |
708 | { | 721 | { |
709 | BSScene physScene = pPhysScene; | 722 | BSScene physScene = pPhysScene; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 4d61ad2..4dff927 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -70,6 +70,8 @@ public class BSPrim : BSPhysObject | |||
70 | private bool _kinematic; | 70 | private bool _kinematic; |
71 | private float _buoyancy; | 71 | private float _buoyancy; |
72 | 72 | ||
73 | private int CrossingFailures { get; set; } | ||
74 | |||
73 | public BSDynamics VehicleController { get; private set; } | 75 | public BSDynamics VehicleController { get; private set; } |
74 | 76 | ||
75 | private BSVMotor _targetMotor; | 77 | private BSVMotor _targetMotor; |
@@ -197,7 +199,20 @@ public class BSPrim : BSPhysObject | |||
197 | { | 199 | { |
198 | get { return _isSelected; } | 200 | get { return _isSelected; } |
199 | } | 201 | } |
200 | public override void CrossingFailure() { return; } | 202 | |
203 | public override void CrossingFailure() | ||
204 | { | ||
205 | CrossingFailures++; | ||
206 | if (CrossingFailures > BSParam.CrossingFailuresBeforeOutOfBounds) | ||
207 | { | ||
208 | base.RaiseOutOfBounds(RawPosition); | ||
209 | } | ||
210 | else if (CrossingFailures == BSParam.CrossingFailuresBeforeOutOfBounds) | ||
211 | { | ||
212 | m_log.WarnFormat("{0} Too many crossing failures for {1}", LogHeader, Name); | ||
213 | } | ||
214 | return; | ||
215 | } | ||
201 | 216 | ||
202 | // link me to the specified parent | 217 | // link me to the specified parent |
203 | public override void link(PhysicsActor obj) { | 218 | public override void link(PhysicsActor obj) { |
@@ -1123,7 +1138,11 @@ public class BSPrim : BSPhysObject | |||
1123 | 1138 | ||
1124 | // Used for MoveTo | 1139 | // Used for MoveTo |
1125 | public override OMV.Vector3 PIDTarget { | 1140 | public override OMV.Vector3 PIDTarget { |
1126 | set { _PIDTarget = value; } | 1141 | set |
1142 | { | ||
1143 | // TODO: add a sanity check -- don't move more than a region or something like that. | ||
1144 | _PIDTarget = value; | ||
1145 | } | ||
1127 | } | 1146 | } |
1128 | public override float PIDTau { | 1147 | public override float PIDTau { |
1129 | set { _PIDTau = value; } | 1148 | set { _PIDTau = value; } |
@@ -1177,7 +1196,9 @@ public class BSPrim : BSPhysObject | |||
1177 | } | 1196 | } |
1178 | else | 1197 | else |
1179 | { | 1198 | { |
1180 | ForcePosition = movePosition; | 1199 | _position = movePosition; |
1200 | PositionSanityCheck(true /* intaintTime */); | ||
1201 | ForcePosition = _position; | ||
1181 | } | 1202 | } |
1182 | DetailLog("{0},BSPrim.PIDTarget,move,fromPos={1},movePos={2}", LocalID, origPosition, movePosition); | 1203 | DetailLog("{0},BSPrim.PIDTarget,move,fromPos={1},movePos={2}", LocalID, origPosition, movePosition); |
1183 | }); | 1204 | }); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 15747c9..219372b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -568,7 +568,7 @@ public sealed class BSShapeCollection : IDisposable | |||
568 | { | 568 | { |
569 | 569 | ||
570 | newShape = PhysicsScene.PE.BuildCapsuleShape(PhysicsScene.World, 1f, 1f, prim.Scale); | 570 | newShape = PhysicsScene.PE.BuildCapsuleShape(PhysicsScene.World, 1f, 1f, prim.Scale); |
571 | if (DDetail) DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale); | 571 | if (DDetail) DetailLog("{0},BSShapeCollection.BuildPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale); |
572 | } | 572 | } |
573 | else | 573 | else |
574 | { | 574 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index bda7c47..49718c4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -1,17 +1,16 @@ | |||
1 | CURRENT PRIORITIES | 1 | CURRENT PRIORITIES |
2 | ================================================= | 2 | ================================================= |
3 | One sided meshes? Should terrain be built into a closed shape? | ||
4 | When meshes get partially wedged into the terrain, they cannot push themselves out. | ||
5 | It is possible that Bullet processes collisions whether entering or leaving a mesh. | ||
6 | Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869 | ||
7 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. | 3 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. |
8 | Not sure if it is because standing on it. Done with large prim linksets. | 4 | Not sure if it is because standing on it. Done with large prim linksets. |
9 | Terrain detail: double terrain mesh detail | ||
10 | Vehicle angular vertical attraction | 5 | Vehicle angular vertical attraction |
11 | vehicle angular banking | 6 | vehicle angular banking |
12 | Center-of-gravity | 7 | Center-of-gravity |
13 | Vehicle angular deflection | 8 | Vehicle angular deflection |
14 | Preferred orientation angular correction fix | 9 | Preferred orientation angular correction fix |
10 | Enable vehicle border crossings (at least as poorly as ODE) | ||
11 | Terrain skirts | ||
12 | Avatar created in previous region and not new region when crossing border | ||
13 | Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) | ||
15 | when should angular and linear motor targets be zeroed? when selected? | 14 | when should angular and linear motor targets be zeroed? when selected? |
16 | Need a vehicle.clear()? Or an 'else' in prestep if not physical. | 15 | Need a vehicle.clear()? Or an 'else' in prestep if not physical. |
17 | Teravus llMoveToTarget script debug | 16 | Teravus llMoveToTarget script debug |
@@ -26,14 +25,16 @@ Avatar movement | |||
26 | flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE) | 25 | flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE) |
27 | walking up stairs is not calibrated correctly (stairs out of Kepler cabin) | 26 | walking up stairs is not calibrated correctly (stairs out of Kepler cabin) |
28 | avatar capsule rotation completed (NOT DONE - Bullet's capsule shape is not the solution) | 27 | avatar capsule rotation completed (NOT DONE - Bullet's capsule shape is not the solution) |
29 | Enable vehicle border crossings (at least as poorly as ODE) | ||
30 | Terrain skirts | ||
31 | Avatar created in previous region and not new region when crossing border | ||
32 | Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) | ||
33 | Vehicle script tuning/debugging | 28 | Vehicle script tuning/debugging |
34 | Avanti speed script | 29 | Avanti speed script |
35 | Weapon shooter script | 30 | Weapon shooter script |
36 | Add material densities to the material types | 31 | Move material definitions (friction, ...) into simulator. |
32 | Add material densities to the material types. | ||
33 | Terrain detail: double terrain mesh detail | ||
34 | One sided meshes? Should terrain be built into a closed shape? | ||
35 | When meshes get partially wedged into the terrain, they cannot push themselves out. | ||
36 | It is possible that Bullet processes collisions whether entering or leaving a mesh. | ||
37 | Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869 | ||
37 | 38 | ||
38 | VEHICLES TODO LIST: | 39 | VEHICLES TODO LIST: |
39 | ================================================= | 40 | ================================================= |
@@ -65,6 +66,7 @@ Vehicle attributes are not restored when a vehicle is rezzed on region creation | |||
65 | 66 | ||
66 | GENERAL TODO LIST: | 67 | GENERAL TODO LIST: |
67 | ================================================= | 68 | ================================================= |
69 | Add a sanity check for PIDTarget location. | ||
68 | Level-of-detail for mesh creation. Prims with circular interiors require lod of 32. | 70 | Level-of-detail for mesh creation. Prims with circular interiors require lod of 32. |
69 | Is much saved with lower LODs? At the moment, all set to 32. | 71 | Is much saved with lower LODs? At the moment, all set to 32. |
70 | Collisions are inconsistant: arrows are supposed to hit and report collision. Often don't. | 72 | Collisions are inconsistant: arrows are supposed to hit and report collision. Often don't. |