From f3baed5827853c5041f042ff36cf394b1e45538f Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 27 Dec 2012 06:58:07 -0800 Subject: BulletSim: add physical parameter min/max constants in BSParam. I just don't like raw numbers scattered around the code. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 12 ++++++++++++ OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 4 ++-- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 9 --------- OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | 1 + 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 7454718..8366cef 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -89,6 +89,18 @@ public static class BSParam public static float PID_D { get; private set; } // derivative public static float PID_P { get; private set; } // proportional + // Various constants that come from that other virtual world that shall not be named + public const float MinGravityZ = -1f; + public const float MaxGravityZ = 28f; + public const float MinFriction = 0f; + public const float MaxFriction = 255f; + public const float MinDensity = 0f; + public const float MaxDensity = 22587f; + public const float MinRestitution = 0f; + public const float MaxRestitution = 1f; + public const float MaxAddForceMagnitude = 20000f; + + // =========================================================================== public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); public delegate float ParamGet(BSScene scene); public delegate void ParamSet(BSScene scene, string paramName, uint localID, float val); diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 9013414..c7a81e0 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1025,10 +1025,10 @@ public sealed class BSPrim : BSPhysObject if (force.IsFinite()) { float magnitude = force.Length(); - if (magnitude > 20000f) + if (magnitude > BSParam.MaxAddForceMagnitude) { // Force has a limit - force = force / magnitude * 20000f; + force = force / magnitude * BSParam.MaxAddForceMagnitude; } OMV.Vector3 addForce = force; diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index b67c0ed..a5fbf10 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -38,15 +38,6 @@ using Nini.Config; using log4net; using OpenMetaverse; -// TODOs for BulletSim (for BSScene, BSPrim, BSCharacter and BulletSim) -// Based on material, set density and friction -// More efficient memory usage when passing hull information from BSPrim to BulletSim -// Do attachments need to be handled separately? Need collision events. Do not collide with VolumeDetect -// Implement LockAngularMotion -// Add PID movement operations. What does ScenePresence.MoveToTarget do? -// Check terrain size. 128 or 127? -// Raycast -// namespace OpenSim.Region.Physics.BulletSPlugin { public sealed class BSScene : PhysicsScene, IPhysicsParameters diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 78cc26c..bc6dd7e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt @@ -96,6 +96,7 @@ Selecting and deselecting physical objects causes CPU processing time to jump put thousand physical objects, select and deselect same. CPU time will be large. Re-implement buoyancy as a separate force on the object rather than diddling gravity. Register a pre-step event to add the force. +More efficient memory usage when passing hull information from BSPrim to BulletSim LINKSETS ====================================================== -- cgit v1.1