BulletSim: add physical parameter min/max constants in BSParam. I just don't like raw numbers scattered around the code.

0.7.5-pf-bulletsim
Robert Adams 2012-12-27 06:58:07 -08:00
parent e98e223927
commit f3baed5827
4 changed files with 15 additions and 11 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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
======================================================