diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs index 34a4bfc1d7..bfe1e8dc33 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs @@ -47,6 +47,8 @@ namespace OpenSim.Region.Framework.Interfaces event ScriptCommand OnScriptCommand; void RegisterScriptInvocation(object target, string method); + void RegisterScriptInvocation(object target, MethodInfo method); + void RegisterScriptInvocation(object target, string[] methods); Delegate[] GetScriptInvocationList(); Delegate LookupScriptInvocation(string fname); diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index 0605590e77..cab30dec25 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs @@ -130,9 +130,6 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms public void RegisterScriptInvocation(object target, string meth) { - m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}",meth,target.GetType().Name); - - MethodInfo mi = target.GetType().GetMethod(meth, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); if (mi == null) @@ -140,7 +137,20 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}",meth); return; } - + + RegisterScriptInvocation(target, mi); + } + + public void RegisterScriptInvocation(object target, string[] meth) + { + foreach (string m in meth) + RegisterScriptInvocation(target, m); + } + + public void RegisterScriptInvocation(object target, MethodInfo mi) + { + m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, target.GetType().Name); + Type delegateType; var typeArgs = mi.GetParameters() .Select(p => p.ParameterType) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 0cab5d11cf..20708d9ce0 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -94,7 +94,7 @@ public class BSCharacter : PhysicsActor _flying = isFlying; _orientation = Quaternion.Identity; _velocity = Vector3.Zero; - _buoyancy = isFlying ? 1f : 0f; + _buoyancy = ComputeBuoyancyFromFlying(isFlying); _scale = new Vector3(1f, 1f, 1f); _density = _scene.Params.avatarDensity; ComputeAvatarVolumeAndMass(); // set _avatarVolume and _mass based on capsule size, _density and _scale @@ -110,7 +110,7 @@ public class BSCharacter : PhysicsActor shapeData.Buoyancy = _buoyancy; shapeData.Static = ShapeData.numericFalse; shapeData.Friction = _scene.Params.avatarFriction; - shapeData.Restitution = _scene.Params.defaultRestitution; + shapeData.Restitution = _scene.Params.avatarRestitution; // do actual create at taint time _scene.TaintedObject(delegate() @@ -260,13 +260,13 @@ public class BSCharacter : PhysicsActor get { return _flying; } set { _flying = value; - _scene.TaintedObject(delegate() - { - // simulate flying by changing the effect of gravity - BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, LocalID, _flying ? 1f : 0f); - }); + // simulate flying by changing the effect of gravity + this.Buoyancy = ComputeBuoyancyFromFlying(_flying); } } + private float ComputeBuoyancyFromFlying(bool ifFlying) { + return ifFlying ? 1f : 0f; + } public override bool SetAlwaysRun { get { return _setAlwaysRun; } @@ -299,6 +299,7 @@ public class BSCharacter : PhysicsActor get { return _kinematic; } set { _kinematic = value; } } + // neg=fall quickly, 0=1g, 1=0g, pos=float up public override float Buoyancy { get { return _buoyancy; } set { _buoyancy = value; @@ -355,7 +356,7 @@ public class BSCharacter : PhysicsActor } else { - m_log.WarnFormat("{0}: Got a NaN force applied to a Character", LogHeader); + m_log.ErrorFormat("{0}: Got a NaN force applied to a Character", LogHeader); } //m_lastUpdateSent = false; } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 046726d979..eb20eb3daa 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs @@ -821,7 +821,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin */ // Get what the body is doing, this includes 'external' influences - Vector3 angularVelocity = m_prim.AngularVelocity; + Vector3 angularVelocity = m_prim.RotationalVelocity; // Vector3 angularVelocity = Vector3.Zero; if (m_angularMotorApply > 0) @@ -910,7 +910,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin m_lastAngularVelocity -= m_lastAngularVelocity * decayamount; // Apply to the body - m_prim.AngularVelocity = m_lastAngularVelocity; + m_prim.RotationalVelocity = m_lastAngularVelocity; } //end MoveAngular internal void LimitRotation(float timestep) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 898436b133..f122df90d5 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -85,7 +85,6 @@ public sealed class BSPrim : PhysicsActor private OMV.Vector3 _rotationalVelocity; private bool _kinematic; private float _buoyancy; - private OMV.Vector3 _angularVelocity; private List _childrenPrims; private BSPrim _parentPrim; @@ -119,7 +118,6 @@ public sealed class BSPrim : PhysicsActor _buoyancy = 1f; _velocity = OMV.Vector3.Zero; _rotationalVelocity = OMV.Vector3.Zero; - _angularVelocity = OMV.Vector3.Zero; _hullKey = 0; _meshKey = 0; _pbs = pbs; @@ -146,7 +144,7 @@ public sealed class BSPrim : PhysicsActor // called when this prim is being destroyed and we should free all the resources public void Destroy() { - // m_log.DebugFormat("{0}: Destroy", LogHeader); + // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID); // Undo any vehicle properties _vehicle.ProcessTypeChange(Vehicle.TYPE_NONE); _scene.RemoveVehiclePrim(this); // just to make sure @@ -203,7 +201,7 @@ public sealed class BSPrim : PhysicsActor // link me to the specified parent public override void link(PhysicsActor obj) { - BSPrim parent = (BSPrim)obj; + BSPrim parent = obj as BSPrim; // m_log.DebugFormat("{0}: link {1}/{2} to {3}", LogHeader, _avName, _localID, obj.LocalID); // TODO: decide if this parent checking needs to happen at taint time if (_parentPrim == null) @@ -527,10 +525,6 @@ public sealed class BSPrim : PhysicsActor }); } } - public OMV.Vector3 AngularVelocity { - get { return _angularVelocity; } - set { _angularVelocity = value; } - } public override bool Kinematic { get { return _kinematic; } set { _kinematic = value; @@ -993,7 +987,7 @@ public sealed class BSPrim : PhysicsActor } // m_log.DebugFormat("{0}: CreateGeomMesh: calling CreateMesh. lid={1}, key={2}, indices={3}, vertices={4}", - // LogHeader, _localID, _meshKey, indices.Length, vertices.Count); + // LogHeader, _localID, _meshKey, indices.Length, vertices.Count); BulletSimAPI.CreateMesh(_scene.WorldID, _meshKey, indices.GetLength(0), indices, vertices.Count, verticesAsFloats); @@ -1127,7 +1121,7 @@ public sealed class BSPrim : PhysicsActor return; } - // Create an object in Bullet + // Create an object in Bullet if it has not already been created // No locking here because this is done when the physics engine is not simulating private void CreateObject() { @@ -1324,7 +1318,8 @@ public sealed class BSPrim : PhysicsActor _velocity = entprop.Velocity; _acceleration = entprop.Acceleration; _rotationalVelocity = entprop.RotationalVelocity; - // m_log.DebugFormat("{0}: RequestTerseUpdate. id={1}, ch={2}, pos={3}, rot={4}", LogHeader, LocalID, changed, _position, _orientation); + // m_log.DebugFormat("{0}: RequestTerseUpdate. id={1}, ch={2}, pos={3}, rot={4}, vel={5}, acc={6}, rvel={7}", + // LogHeader, LocalID, changed, _position, _orientation, _velocity, _acceleration, _rotationalVelocity); base.RequestPhysicsterseUpdate(); } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index e9a849c839..581d5402ce 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -37,14 +37,18 @@ using OpenMetaverse; using OpenSim.Region.Framework; // TODOs for BulletSim (for BSScene, BSPrim, BSCharacter and BulletSim) +// Debug linkset +// Test with multiple regions in one simulator // Adjust character capsule size when height is adjusted (ScenePresence.SetHeight) // Test sculpties // Compute physics FPS reasonably // Based on material, set density and friction -// More efficient memory usage in passing hull information from BSPrim to BulletSim +// More efficient memory usage when passing hull information from BSPrim to BulletSim // Four states of prim: Physical, regular, phantom and selected. Are we modeling these correctly? // In SL one can set both physical and phantom (gravity, does not effect others, makes collisions with ground) // At the moment, physical and phantom causes object to drop through the terrain +// Physical phantom objects and related typing (collision options ) +// Check out llVolumeDetect. Must do something for that. // Should prim.link() and prim.delink() membership checking happen at taint time? // Mesh sharing. Use meshHash to tell if we already have a hull of that shape and only create once // Do attachments need to be handled separately? Need collision events. Do not collide with VolumeDetect @@ -52,6 +56,16 @@ using OpenSim.Region.Framework; // Implement LockAngularMotion // Decide if clearing forces is the right thing to do when setting position (BulletSim::SetObjectTranslation) // Does NeedsMeshing() really need to exclude all the different shapes? +// Remove mesh and Hull stuff. Use mesh passed to bullet and use convexdecom from bullet. +// Add PID movement operations. What does ScenePresence.MoveToTarget do? +// Check terrain size. 128 or 127? +// Multiple contact points on collision? +// See code in ode::near... calls to collision_accounting_events() +// (This might not be a problem. ODE collects all the collisions with one object in one tick.) +// Use collision masks for collision with terrain and phantom objects +// Figure out how to not allocate a new Dictionary and List for every collision +// in BSPrim.Collide() and BSCharacter.Collide(). Can the same ones be reused? +// Raycast // namespace OpenSim.Region.Physics.BulletSPlugin { @@ -164,6 +178,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters if (m_log.IsDebugEnabled) { m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", LogHeader); + // the handle is saved to it doesn't get freed after this call m_DebugLogCallbackHandle = new BulletSimAPI.DebugLogCallback(BulletLogger); BulletSimAPI.SetDebugLogCallback(m_DebugLogCallbackHandle); } @@ -172,7 +187,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters mesher = meshmerizer; // The bounding box for the simulated world - Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 4096f); + Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 8192f); // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader); m_worldID = BulletSimAPI.Initialize(worldExtent, m_paramsHandle.AddrOfPinnedObject(), @@ -220,10 +235,20 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.terrainFriction = 0.5f; parms.terrainHitFraction = 0.8f; parms.terrainRestitution = 0f; - parms.avatarFriction = 0.0f; + parms.avatarFriction = 0.5f; + parms.avatarRestitution = 0.0f; parms.avatarDensity = 60f; parms.avatarCapsuleRadius = 0.37f; parms.avatarCapsuleHeight = 1.5f; // 2.140599f + parms.avatarContactProcessingThreshold = 0.1f; + + parms.maxPersistantManifoldPoolSize = 0f; + parms.shouldDisableContactPoolDynamicAllocation = ConfigurationParameters.numericTrue; + parms.shouldForceUpdateAllAabbs = ConfigurationParameters.numericFalse; + parms.shouldRandomizeSolverOrder = ConfigurationParameters.numericFalse; + parms.shouldSplitSimulationIslands = ConfigurationParameters.numericFalse; + parms.shouldEnableFrictionCaching = ConfigurationParameters.numericFalse; + parms.numberOfSolverIterations = 0f; // means use default if (config != null) { @@ -265,14 +290,40 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction); parms.terrainRestitution = pConfig.GetFloat("TerrainRestitution", parms.terrainRestitution); parms.avatarFriction = pConfig.GetFloat("AvatarFriction", parms.avatarFriction); + parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution); parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity); parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius); parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight); + parms.avatarContactProcessingThreshold = pConfig.GetFloat("AvatarContactProcessingThreshold", parms.avatarContactProcessingThreshold); + + parms.maxPersistantManifoldPoolSize = pConfig.GetFloat("MaxPersistantManifoldPoolSize", parms.maxPersistantManifoldPoolSize); + parms.shouldDisableContactPoolDynamicAllocation = ParamBoolean(pConfig, "ShouldDisableContactPoolDynamicAllocation", parms.shouldDisableContactPoolDynamicAllocation); + parms.shouldForceUpdateAllAabbs = ParamBoolean(pConfig, "ShouldForceUpdateAllAabbs", parms.shouldForceUpdateAllAabbs); + parms.shouldRandomizeSolverOrder = ParamBoolean(pConfig, "ShouldRandomizeSolverOrder", parms.shouldRandomizeSolverOrder); + parms.shouldSplitSimulationIslands = ParamBoolean(pConfig, "ShouldSplitSimulationIslands", parms.shouldSplitSimulationIslands); + parms.shouldEnableFrictionCaching = ParamBoolean(pConfig, "ShouldEnableFrictionCaching", parms.shouldEnableFrictionCaching); + parms.numberOfSolverIterations = pConfig.GetFloat("NumberOfSolverIterations", parms.numberOfSolverIterations); } } m_params[0] = parms; } + // A helper function that handles a true/false parameter and returns the proper float number encoding + float ParamBoolean(IConfig config, string parmName, float deflt) + { + float ret = deflt; + if (config.Contains(parmName)) + { + ret = ConfigurationParameters.numericFalse; + if (config.GetBoolean(parmName, false)) + { + ret = ConfigurationParameters.numericTrue; + } + } + return ret; + } + + // Called directly from unmanaged code so don't do much private void BulletLogger(string msg) { @@ -391,16 +442,16 @@ public class BSScene : PhysicsScene, IPhysicsParameters { EntityProperties entprop = m_updateArray[ii]; // m_log.DebugFormat("{0}: entprop[{1}]: id={2}, pos={3}", LogHeader, ii, entprop.ID, entprop.Position); - BSCharacter actor; - if (m_avatars.TryGetValue(entprop.ID, out actor)) - { - actor.UpdateProperties(entprop); - continue; - } BSPrim prim; if (m_prims.TryGetValue(entprop.ID, out prim)) { prim.UpdateProperties(entprop); + continue; + } + BSCharacter actor; + if (m_avatars.TryGetValue(entprop.ID, out actor)) + { + actor.UpdateProperties(entprop); } } } @@ -470,12 +521,12 @@ public class BSScene : PhysicsScene, IPhysicsParameters public override void DeleteTerrain() { - m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); + // m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); } public override void Dispose() { - m_log.DebugFormat("{0}: Dispose()", LogHeader); + // m_log.DebugFormat("{0}: Dispose()", LogHeader); } public override Dictionary GetTopColliders() @@ -699,9 +750,23 @@ public class BSScene : PhysicsScene, IPhysicsParameters new PhysParameterEntry("DeactivationTime", "Seconds before considering an object potentially static" ), new PhysParameterEntry("LinearSleepingThreshold", "Seconds to measure linear movement before considering static" ), new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ), - // new PhysParameterEntry("CcdMotionThreshold", "" ), - // new PhysParameterEntry("CcdSweptSphereRadius", "" ), + new PhysParameterEntry("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ), + new PhysParameterEntry("CcdSweptSphereRadius", "Continuious collision detection test radius" ), new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ), + // Can only change the following at initialization time. Change the INI file and reboot. + new PhysParameterEntry("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default)"), + new PhysParameterEntry("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count"), + new PhysParameterEntry("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step"), + new PhysParameterEntry("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction"), + new PhysParameterEntry("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands"), + new PhysParameterEntry("ShouldEnableFrictionCaching", "Enable friction computation caching"), + new PhysParameterEntry("NumberOfSolverIterations", "Number of internal iterations (0 means default)"), + + new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ), + new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ), + + new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ), + new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ), new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ), new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ), @@ -710,7 +775,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters new PhysParameterEntry("AvatarDensity", "Density of an avatar. Changed on avatar recreation." ), new PhysParameterEntry("AvatarRestitution", "Bouncyness. Changed on avatar recreation." ), new PhysParameterEntry("AvatarCapsuleRadius", "Radius of space around an avatar" ), - new PhysParameterEntry("AvatarCapsuleHeight", "Default height of space around avatar" ) + new PhysParameterEntry("AvatarCapsuleHeight", "Default height of space around avatar" ), + new PhysParameterEntry("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions") + }; #region IPhysicsParameters @@ -733,6 +800,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters switch (lparm) { case "detailedstats": m_detailedStatsStep = (int)val; break; + case "meshlod": m_meshLOD = (int)val; break; case "sculptlod": m_sculptLOD = (int)val; break; case "maxsubstep": m_maxSubSteps = (int)val; break; @@ -743,7 +811,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "defaultdensity": m_params[0].defaultDensity = val; break; case "defaultrestitution": m_params[0].defaultRestitution = val; break; case "collisionmargin": m_params[0].collisionMargin = val; break; - case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, PhysParameterEntry.APPLY_TO_NONE, val); break; + case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, localID, val); break; case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break; case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; @@ -753,6 +821,17 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break; case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break; + // the following are used only at initialization time so setting them makes no sense + // case "maxPersistantmanifoldpoolSize": m_params[0].maxPersistantManifoldPoolSize = val; break; + // case "shoulddisablecontactpooldynamicallocation": m_params[0].shouldDisableContactPoolDynamicAllocation = val; break; + // case "shouldforceupdateallaabbs": m_params[0].shouldForceUpdateAllAabbs = val; break; + // case "shouldrandomizesolverorder": m_params[0].shouldRandomizeSolverOrder = val; break; + // case "shouldsplitsimulationislands": m_params[0].shouldSplitSimulationIslands = val; break; + // case "shouldenablefrictioncaching": m_params[0].shouldEnableFrictionCaching = val; break; + // case "numberofsolveriterations": m_params[0].numberOfSolverIterations = val; break; + + case "friction": TaintedUpdateParameter(lparm, localID, val); break; + case "restitution": TaintedUpdateParameter(lparm, localID, val); break; // set a terrain physical feature and cause terrain to be recalculated case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break; @@ -764,6 +843,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break; case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break; case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; + case "avatarcontactprocessingthreshold": UpdateParameterAvatars(ref m_params[0].avatarContactProcessingThreshold, "avatar", localID, val); break; default: ret = false; break; } @@ -856,6 +936,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break; case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break; case "contactprocessingthreshold": val = m_params[0].contactProcessingThreshold; break; + case "maxPersistantmanifoldpoolSize": val = m_params[0].maxPersistantManifoldPoolSize; break; + case "shoulddisablecontactpooldynamicallocation": val = m_params[0].shouldDisableContactPoolDynamicAllocation; break; + case "shouldforceupdateallaabbs": val = m_params[0].shouldForceUpdateAllAabbs; break; + case "shouldrandomizesolverorder": val = m_params[0].shouldRandomizeSolverOrder; break; + case "shouldsplitsimulationislands": val = m_params[0].shouldSplitSimulationIslands; break; + case "shouldenablefrictioncaching": val = m_params[0].shouldEnableFrictionCaching; break; + case "numberofsolveriterations": val = m_params[0].numberOfSolverIterations; break; case "terrainfriction": val = m_params[0].terrainFriction; break; case "terrainhitfraction": val = m_params[0].terrainHitFraction; break; @@ -866,6 +953,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "avatarrestitution": val = m_params[0].avatarRestitution; break; case "avatarcapsuleradius": val = m_params[0].avatarCapsuleRadius; break; case "avatarcapsuleheight": val = m_params[0].avatarCapsuleHeight; break; + case "avatarcontactprocessingthreshold": val = m_params[0].avatarContactProcessingThreshold; break; default: ret = false; break; } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index d12bd7dcca..086f0dc9d7 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs @@ -132,6 +132,15 @@ public struct ConfigurationParameters public float avatarRestitution; public float avatarCapsuleRadius; public float avatarCapsuleHeight; + public float avatarContactProcessingThreshold; + + public float maxPersistantManifoldPoolSize; + public float shouldDisableContactPoolDynamicAllocation; + public float shouldForceUpdateAllAabbs; + public float shouldRandomizeSolverOrder; + public float shouldSplitSimulationIslands; + public float shouldEnableFrictionCaching; + public float numberOfSolverIterations; public const float numericTrue = 1f; public const float numericFalse = 0f; @@ -148,17 +157,17 @@ public static extern uint Initialize(Vector3 maxPosition, IntPtr parms, int maxCollisions, IntPtr collisionArray, int maxUpdates, IntPtr updateArray); -[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] -public static extern bool UpdateParameter(uint worldID, uint localID, - [MarshalAs(UnmanagedType.LPStr)]string paramCode, float value); - [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] public static extern void SetHeightmap(uint worldID, [MarshalAs(UnmanagedType.LPArray)] float[] heightMap); [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] public static extern void Shutdown(uint worldID); +[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] +public static extern bool UpdateParameter(uint worldID, uint localID, + [MarshalAs(UnmanagedType.LPStr)]string paramCode, float value); +// =============================================================================== [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep, out int updatedEntityCount, @@ -240,6 +249,7 @@ public static extern bool HasObject(uint worldID, uint id); [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] public static extern bool DestroyObject(uint worldID, uint id); +// =============================================================================== [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] public static extern SweepHit ConvexSweepTest(uint worldID, uint id, Vector3 to, float extraMargin); @@ -249,6 +259,7 @@ public static extern RaycastHit RayTest(uint worldID, uint id, Vector3 from, Vec [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] public static extern Vector3 RecoverFromPenetration(uint worldID, uint id); +// =============================================================================== [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] public static extern void DumpBulletStatistics(); diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index afeb01a7c9..62f1529204 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -846,10 +846,12 @@ TerrainFriction = 0.50 TerrainHitFriction = 0.8 TerrainRestitution = 0 - AvatarFriction = 0 + AvatarFriction = 0.2 + AvatarRestitution = 0.0 AvatarDensity = 60.0 AvatarCapsuleRadius = 0.37 AvatarCapsuleHeight = 1.5 + AvatarContactProcessingThreshold = 0.1; MaxObjectMass = 10000.01 @@ -862,6 +864,14 @@ CcdMotionThreshold = 0.0 CcdSweptSphereRadius = 0.0 ContactProcessingThreshold = 0.1 + MaxPersistantManifoldPoolSize = 0; + ShouldDisableContactPoolDynamicAllocation = True; + ShouldForceUpdateAllAabbs = False; + ShouldRandomizeSolverOrder = False; + ShouldSplitSimulationIslands = False; + ShouldEnableFrictionCaching = False; + NumberOfSolverIterations = 0; + ; Whether to mesh sculpties MeshSculptedPrim = true diff --git a/bin/lib32/BulletSim.dll b/bin/lib32/BulletSim.dll index d1571cf751..357f26e07c 100755 Binary files a/bin/lib32/BulletSim.dll and b/bin/lib32/BulletSim.dll differ diff --git a/bin/lib32/libBulletSim.so b/bin/lib32/libBulletSim.so new file mode 100755 index 0000000000..948d8e31ca Binary files /dev/null and b/bin/lib32/libBulletSim.so differ diff --git a/bin/lib64/BulletSim.dll b/bin/lib64/BulletSim.dll index ec21dfedcf..db8530ce74 100755 Binary files a/bin/lib64/BulletSim.dll and b/bin/lib64/BulletSim.dll differ diff --git a/bin/lib64/libBulletSim.so b/bin/lib64/libBulletSim.so new file mode 100755 index 0000000000..b2fd9d215d Binary files /dev/null and b/bin/lib64/libBulletSim.so differ