BulletSim: add OutOfBounds logic and some position sanity checking
to eliminate some of the "cannot find terrain height" warning messages.user_profiles
parent
681653ca13
commit
efb5da0aa6
|
@ -443,6 +443,7 @@ public sealed class BSCharacter : BSPhysObject
|
|||
PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate()
|
||||
{
|
||||
DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
|
||||
PositionSanityCheck();
|
||||
ForcePosition = _position;
|
||||
});
|
||||
}
|
||||
|
@ -456,7 +457,6 @@ public sealed class BSCharacter : BSPhysObject
|
|||
_position = value;
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
{
|
||||
PositionSanityCheck();
|
||||
PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
|
||||
}
|
||||
}
|
||||
|
@ -513,8 +513,7 @@ public sealed class BSCharacter : BSPhysObject
|
|||
PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate()
|
||||
{
|
||||
DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation);
|
||||
if (PhysBody.HasPhysicalBody)
|
||||
PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
|
||||
ForcePosition = _position;
|
||||
});
|
||||
ret = true;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ public static class BSParam
|
|||
public static float MeshMegaPrimThreshold { get; private set; }
|
||||
public static float SculptLOD { get; private set; }
|
||||
|
||||
public static int CrossingFailuresBeforeOutOfBounds { get; private set; }
|
||||
|
||||
public static float MinimumObjectMass { get; private set; }
|
||||
public static float MaximumObjectMass { get; private set; }
|
||||
public static float MaxLinearVelocity { get; private set; }
|
||||
|
@ -73,23 +75,23 @@ public static class BSParam
|
|||
public static float TerrainRestitution { get; private set; }
|
||||
public static float TerrainCollisionMargin { get; private set; }
|
||||
|
||||
public static float DefaultFriction;
|
||||
public static float DefaultDensity;
|
||||
public static float DefaultRestitution;
|
||||
public static float CollisionMargin;
|
||||
public static float Gravity;
|
||||
public static float DefaultFriction { get; private set; }
|
||||
public static float DefaultDensity { get; private set; }
|
||||
public static float DefaultRestitution { get; private set; }
|
||||
public static float CollisionMargin { get; private set; }
|
||||
public static float Gravity { get; private set; }
|
||||
|
||||
// Physics Engine operation
|
||||
public static float MaxPersistantManifoldPoolSize;
|
||||
public static float MaxCollisionAlgorithmPoolSize;
|
||||
public static bool ShouldDisableContactPoolDynamicAllocation;
|
||||
public static bool ShouldForceUpdateAllAabbs;
|
||||
public static bool ShouldRandomizeSolverOrder;
|
||||
public static bool ShouldSplitSimulationIslands;
|
||||
public static bool ShouldEnableFrictionCaching;
|
||||
public static float NumberOfSolverIterations;
|
||||
public static bool UseSingleSidedMeshes;
|
||||
public static float GlobalContactBreakingThreshold;
|
||||
public static float MaxPersistantManifoldPoolSize { get; private set; }
|
||||
public static float MaxCollisionAlgorithmPoolSize { get; private set; }
|
||||
public static bool ShouldDisableContactPoolDynamicAllocation { get; private set; }
|
||||
public static bool ShouldForceUpdateAllAabbs { get; private set; }
|
||||
public static bool ShouldRandomizeSolverOrder { get; private set; }
|
||||
public static bool ShouldSplitSimulationIslands { get; private set; }
|
||||
public static bool ShouldEnableFrictionCaching { get; private set; }
|
||||
public static float NumberOfSolverIterations { get; private set; }
|
||||
public static bool UseSingleSidedMeshes { get; private set; }
|
||||
public static float GlobalContactBreakingThreshold { get; private set; }
|
||||
|
||||
// Avatar parameters
|
||||
public static float AvatarFriction { get; private set; }
|
||||
|
@ -118,6 +120,7 @@ public static class BSParam
|
|||
public static float VehicleGroundGravityFudge { get; private set; }
|
||||
public static bool VehicleDebuggingEnabled { get; private set; }
|
||||
|
||||
// Linkset implementation parameters
|
||||
public static float LinksetImplementation { get; private set; }
|
||||
public static bool LinkConstraintUseFrameOffset { get; private set; }
|
||||
public static bool LinkConstraintEnableTransMotor { get; private set; }
|
||||
|
@ -282,6 +285,11 @@ public static class BSParam
|
|||
(s) => { return ShouldRemoveZeroWidthTriangles; },
|
||||
(s,v) => { ShouldRemoveZeroWidthTriangles = v; } ),
|
||||
|
||||
new ParameterDefn<int>("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions",
|
||||
5,
|
||||
(s) => { return CrossingFailuresBeforeOutOfBounds; },
|
||||
(s,v) => { CrossingFailuresBeforeOutOfBounds = v; } ),
|
||||
|
||||
new ParameterDefn<float>("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
|
||||
32f,
|
||||
(s) => { return MeshLOD; },
|
||||
|
@ -695,6 +703,10 @@ public static class BSParam
|
|||
}
|
||||
}
|
||||
|
||||
// =====================================================================
|
||||
// =====================================================================
|
||||
// There are parameters that, when set, cause things to happen in the physics engine.
|
||||
// This causes the broadphase collision cache to be cleared.
|
||||
private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v)
|
||||
{
|
||||
BSScene physScene = pPhysScene;
|
||||
|
@ -704,6 +716,7 @@ public static class BSParam
|
|||
});
|
||||
}
|
||||
|
||||
// This causes the constraint solver cache to be cleared and reset.
|
||||
private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v)
|
||||
{
|
||||
BSScene physScene = pPhysScene;
|
||||
|
|
|
@ -70,6 +70,8 @@ public class BSPrim : BSPhysObject
|
|||
private bool _kinematic;
|
||||
private float _buoyancy;
|
||||
|
||||
private int CrossingFailures { get; set; }
|
||||
|
||||
public BSDynamics VehicleController { get; private set; }
|
||||
|
||||
private BSVMotor _targetMotor;
|
||||
|
@ -197,7 +199,20 @@ public class BSPrim : BSPhysObject
|
|||
{
|
||||
get { return _isSelected; }
|
||||
}
|
||||
public override void CrossingFailure() { return; }
|
||||
|
||||
public override void CrossingFailure()
|
||||
{
|
||||
CrossingFailures++;
|
||||
if (CrossingFailures > BSParam.CrossingFailuresBeforeOutOfBounds)
|
||||
{
|
||||
base.RaiseOutOfBounds(RawPosition);
|
||||
}
|
||||
else if (CrossingFailures == BSParam.CrossingFailuresBeforeOutOfBounds)
|
||||
{
|
||||
m_log.WarnFormat("{0} Too many crossing failures for {1}", LogHeader, Name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// link me to the specified parent
|
||||
public override void link(PhysicsActor obj) {
|
||||
|
@ -1123,7 +1138,11 @@ public class BSPrim : BSPhysObject
|
|||
|
||||
// Used for MoveTo
|
||||
public override OMV.Vector3 PIDTarget {
|
||||
set { _PIDTarget = value; }
|
||||
set
|
||||
{
|
||||
// TODO: add a sanity check -- don't move more than a region or something like that.
|
||||
_PIDTarget = value;
|
||||
}
|
||||
}
|
||||
public override float PIDTau {
|
||||
set { _PIDTau = value; }
|
||||
|
@ -1177,7 +1196,9 @@ public class BSPrim : BSPhysObject
|
|||
}
|
||||
else
|
||||
{
|
||||
ForcePosition = movePosition;
|
||||
_position = movePosition;
|
||||
PositionSanityCheck(true /* intaintTime */);
|
||||
ForcePosition = _position;
|
||||
}
|
||||
DetailLog("{0},BSPrim.PIDTarget,move,fromPos={1},movePos={2}", LocalID, origPosition, movePosition);
|
||||
});
|
||||
|
|
|
@ -568,7 +568,7 @@ public sealed class BSShapeCollection : IDisposable
|
|||
{
|
||||
|
||||
newShape = PhysicsScene.PE.BuildCapsuleShape(PhysicsScene.World, 1f, 1f, prim.Scale);
|
||||
if (DDetail) DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale);
|
||||
if (DDetail) DetailLog("{0},BSShapeCollection.BuildPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
CURRENT PRIORITIES
|
||||
=================================================
|
||||
One sided meshes? Should terrain be built into a closed shape?
|
||||
When meshes get partially wedged into the terrain, they cannot push themselves out.
|
||||
It is possible that Bullet processes collisions whether entering or leaving a mesh.
|
||||
Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869
|
||||
Deleting a linkset while standing on the root will leave the physical shape of the root behind.
|
||||
Not sure if it is because standing on it. Done with large prim linksets.
|
||||
Terrain detail: double terrain mesh detail
|
||||
Vehicle angular vertical attraction
|
||||
vehicle angular banking
|
||||
Center-of-gravity
|
||||
Vehicle angular deflection
|
||||
Preferred orientation angular correction fix
|
||||
Enable vehicle border crossings (at least as poorly as ODE)
|
||||
Terrain skirts
|
||||
Avatar created in previous region and not new region when crossing border
|
||||
Vehicle recreated in new sim at small Z value (offset from root value?) (DONE)
|
||||
when should angular and linear motor targets be zeroed? when selected?
|
||||
Need a vehicle.clear()? Or an 'else' in prestep if not physical.
|
||||
Teravus llMoveToTarget script debug
|
||||
|
@ -26,14 +25,16 @@ Avatar movement
|
|||
flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE)
|
||||
walking up stairs is not calibrated correctly (stairs out of Kepler cabin)
|
||||
avatar capsule rotation completed (NOT DONE - Bullet's capsule shape is not the solution)
|
||||
Enable vehicle border crossings (at least as poorly as ODE)
|
||||
Terrain skirts
|
||||
Avatar created in previous region and not new region when crossing border
|
||||
Vehicle recreated in new sim at small Z value (offset from root value?) (DONE)
|
||||
Vehicle script tuning/debugging
|
||||
Avanti speed script
|
||||
Weapon shooter script
|
||||
Add material densities to the material types
|
||||
Move material definitions (friction, ...) into simulator.
|
||||
Add material densities to the material types.
|
||||
Terrain detail: double terrain mesh detail
|
||||
One sided meshes? Should terrain be built into a closed shape?
|
||||
When meshes get partially wedged into the terrain, they cannot push themselves out.
|
||||
It is possible that Bullet processes collisions whether entering or leaving a mesh.
|
||||
Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869
|
||||
|
||||
VEHICLES TODO LIST:
|
||||
=================================================
|
||||
|
@ -65,6 +66,7 @@ Vehicle attributes are not restored when a vehicle is rezzed on region creation
|
|||
|
||||
GENERAL TODO LIST:
|
||||
=================================================
|
||||
Add a sanity check for PIDTarget location.
|
||||
Level-of-detail for mesh creation. Prims with circular interiors require lod of 32.
|
||||
Is much saved with lower LODs? At the moment, all set to 32.
|
||||
Collisions are inconsistant: arrows are supposed to hit and report collision. Often don't.
|
||||
|
|
Loading…
Reference in New Issue