From ae4d932e7f00e781db9c9cdd5c29efc51e2425fb Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 21 Dec 2012 13:35:44 -0800 Subject: BulletSim: Move all the parameter variables, tables and get and fetch logic to a separate, static class for easier addition and to remove all that bulk from the BSScene class. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 558 ++++++++++++++++++++++++ 1 file changed, 558 insertions(+) create mode 100755 OpenSim/Region/Physics/BulletSPlugin/BSParam.cs (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs new file mode 100755 index 0000000..1fb4c31 --- /dev/null +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -0,0 +1,558 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyrightD + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Region.Physics.Manager; + +using OpenMetaverse; +using Nini.Config; + +namespace OpenSim.Region.Physics.BulletSPlugin +{ +public static class BSParam +{ + // Level of Detail values kept as float because that's what the Meshmerizer wants + public static float MeshLOD { get; private set; } + public static float MeshMegaPrimLOD { get; private set; } + public static float MeshMegaPrimThreshold { get; private set; } + public static float SculptLOD { get; private set; } + + public static float MinimumObjectMass { get; private set; } + public static float MaximumObjectMass { get; private set; } + + public static float LinearDamping { get; private set; } + public static float AngularDamping { get; private set; } + public static float DeactivationTime { get; private set; } + public static float LinearSleepingThreshold { get; private set; } + public static float AngularSleepingThreshold { get; private set; } + public static float CcdMotionThreshold { get; private set; } + public static float CcdSweptSphereRadius { get; private set; } + public static float ContactProcessingThreshold { get; private set; } + + public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed + public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes + public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects + + public static float TerrainImplementation { get; private set; } + public static float TerrainFriction { get; private set; } + public static float TerrainHitFraction { get; private set; } + public static float TerrainRestitution { get; private set; } + public static float TerrainCollisionMargin { get; private set; } + + // Avatar parameters + public static float AvatarFriction { get; private set; } + public static float AvatarStandingFriction { get; private set; } + public static float AvatarDensity { get; private set; } + public static float AvatarRestitution { get; private set; } + public static float AvatarCapsuleWidth { get; private set; } + public static float AvatarCapsuleDepth { get; private set; } + public static float AvatarCapsuleHeight { get; private set; } + public static float AvatarContactProcessingThreshold { get; private set; } + + public static float VehicleAngularDamping { get; private set; } + + public static float LinksetImplementation { get; private set; } + public static float LinkConstraintUseFrameOffset { get; private set; } + public static float LinkConstraintEnableTransMotor { get; private set; } + public static float LinkConstraintTransMotorMaxVel { get; private set; } + public static float LinkConstraintTransMotorMaxForce { get; private set; } + public static float LinkConstraintERP { get; private set; } + public static float LinkConstraintCFM { get; private set; } + public static float LinkConstraintSolverIterations { get; private set; } + + public static float PID_D { get; private set; } // derivative + public static float PID_P { get; private set; } // proportional + + 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); + public delegate void SetOnObject(BSScene scene, BSPhysObject obj, float val); + + public struct ParameterDefn + { + public string name; // string name of the parameter + public string desc; // a short description of what the parameter means + public float defaultValue; // default value if not specified anywhere else + public ParamUser userParam; // get the value from the configuration file + public ParamGet getter; // return the current value stored for this parameter + public ParamSet setter; // set the current value for this parameter + public SetOnObject onObject; // set the value on an object in the physical domain + public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s) + { + name = n; + desc = d; + defaultValue = v; + userParam = u; + getter = g; + setter = s; + onObject = null; + } + public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s, SetOnObject o) + { + name = n; + desc = d; + defaultValue = v; + userParam = u; + getter = g; + setter = s; + onObject = o; + } + } + + // List of all of the externally visible parameters. + // For each parameter, this table maps a text name to getter and setters. + // To add a new externally referencable/settable parameter, add the paramter storage + // location somewhere in the program and make an entry in this table with the + // getters and setters. + // It is easiest to find an existing definition and copy it. + // Parameter values are floats. Booleans are converted to a floating value. + // + // A ParameterDefn() takes the following parameters: + // -- the text name of the parameter. This is used for console input and ini file. + // -- a short text description of the parameter. This shows up in the console listing. + // -- a delegate for fetching the parameter from the ini file. + // Should handle fetching the right type from the ini file and converting it. + // -- a delegate for getting the value as a float + // -- a delegate for setting the value from a float + // -- an optional delegate to update the value in the world. Most often used to + // push the new value to an in-world object. + // + // The single letter parameters for the delegates are: + // s = BSScene + // o = BSPhysObject + // p = string parameter name + // l = localID of referenced object + // v = float value + // cf = parameter configuration class (for fetching values from ini file) + private static ParameterDefn[] ParameterDefinitions = + { + new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", + ConfigurationParameters.numericTrue, + (s,cf,p,v) => { ShouldMeshSculptedPrim = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, + (s) => { return BSParam.NumericBool(ShouldMeshSculptedPrim); }, + (s,p,l,v) => { ShouldMeshSculptedPrim = BSParam.BoolNumeric(v); } ), + new ParameterDefn("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects", + ConfigurationParameters.numericFalse, + (s,cf,p,v) => { ShouldForceSimplePrimMeshing = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, + (s) => { return BSParam.NumericBool(ShouldForceSimplePrimMeshing); }, + (s,p,l,v) => { ShouldForceSimplePrimMeshing = BSParam.BoolNumeric(v); } ), + new ParameterDefn("UseHullsForPhysicalObjects", "If true, create hulls for physical objects", + ConfigurationParameters.numericTrue, + (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, + (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, + (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), + + new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", + 8f, + (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); }, + (s) => { return MeshLOD; }, + (s,p,l,v) => { MeshLOD = v; } ), + new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", + 16f, + (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); }, + (s) => { return MeshMegaPrimLOD; }, + (s,p,l,v) => { MeshMegaPrimLOD = v; } ), + new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", + 10f, + (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); }, + (s) => { return MeshMegaPrimThreshold; }, + (s,p,l,v) => { MeshMegaPrimThreshold = v; } ), + new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", + 32f, + (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); }, + (s) => { return SculptLOD; }, + (s,p,l,v) => { SculptLOD = v; } ), + + new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps", + 10f, + (s,cf,p,v) => { s.m_maxSubSteps = cf.GetInt(p, (int)v); }, + (s) => { return (float)s.m_maxSubSteps; }, + (s,p,l,v) => { s.m_maxSubSteps = (int)v; } ), + new ParameterDefn("FixedTimeStep", "In simulation step, seconds of one substep (1/60)", + 1f / 60f, + (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); }, + (s) => { return (float)s.m_fixedTimeStep; }, + (s,p,l,v) => { s.m_fixedTimeStep = v; } ), + new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", + 2048f, + (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); }, + (s) => { return (float)s.m_maxCollisionsPerFrame; }, + (s,p,l,v) => { s.m_maxCollisionsPerFrame = (int)v; } ), + new ParameterDefn("MaxUpdatesPerFrame", "Max updates returned at end of each frame", + 8000f, + (s,cf,p,v) => { s.m_maxUpdatesPerFrame = cf.GetInt(p, (int)v); }, + (s) => { return (float)s.m_maxUpdatesPerFrame; }, + (s,p,l,v) => { s.m_maxUpdatesPerFrame = (int)v; } ), + new ParameterDefn("MaxTaintsToProcessPerStep", "Number of update taints to process before each simulation step", + 500f, + (s,cf,p,v) => { s.m_taintsToProcessPerStep = cf.GetInt(p, (int)v); }, + (s) => { return (float)s.m_taintsToProcessPerStep; }, + (s,p,l,v) => { s.m_taintsToProcessPerStep = (int)v; } ), + new ParameterDefn("MinObjectMass", "Minimum object mass (0.0001)", + 0.0001f, + (s,cf,p,v) => { MinimumObjectMass = cf.GetFloat(p, v); }, + (s) => { return (float)MinimumObjectMass; }, + (s,p,l,v) => { MinimumObjectMass = v; } ), + new ParameterDefn("MaxObjectMass", "Maximum object mass (10000.01)", + 10000.01f, + (s,cf,p,v) => { MaximumObjectMass = cf.GetFloat(p, v); }, + (s) => { return (float)MaximumObjectMass; }, + (s,p,l,v) => { MaximumObjectMass = v; } ), + + new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", + 2200f, + (s,cf,p,v) => { PID_D = cf.GetFloat(p, v); }, + (s) => { return (float)PID_D; }, + (s,p,l,v) => { PID_D = v; } ), + new ParameterDefn("PID_P", "Parameteric factor for motion smoothing", + 900f, + (s,cf,p,v) => { PID_P = cf.GetFloat(p, v); }, + (s) => { return (float)PID_P; }, + (s,p,l,v) => { PID_P = v; } ), + + new ParameterDefn("DefaultFriction", "Friction factor used on new objects", + 0.2f, + (s,cf,p,v) => { s.UnmanagedParams[0].defaultFriction = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].defaultFriction; }, + (s,p,l,v) => { s.UnmanagedParams[0].defaultFriction = v; } ), + new ParameterDefn("DefaultDensity", "Density for new objects" , + 10.000006836f, // Aluminum g/cm3 + (s,cf,p,v) => { s.UnmanagedParams[0].defaultDensity = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].defaultDensity; }, + (s,p,l,v) => { s.UnmanagedParams[0].defaultDensity = v; } ), + new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , + 0f, + (s,cf,p,v) => { s.UnmanagedParams[0].defaultRestitution = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].defaultRestitution; }, + (s,p,l,v) => { s.UnmanagedParams[0].defaultRestitution = v; } ), + new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", + 0.04f, + (s,cf,p,v) => { s.UnmanagedParams[0].collisionMargin = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].collisionMargin; }, + (s,p,l,v) => { s.UnmanagedParams[0].collisionMargin = v; } ), + new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", + -9.80665f, + (s,cf,p,v) => { s.UnmanagedParams[0].gravity = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].gravity; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{s.UnmanagedParams[0].gravity=x;}, p, PhysParameterEntry.APPLY_TO_NONE, v); }, + (s,o,v) => { BulletSimAPI.SetGravity2(s.World.ptr, new Vector3(0f,0f,v)); } ), + + + new ParameterDefn("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", + 0f, + (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, + (s) => { return LinearDamping; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearDamping=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, v, AngularDamping); } ), + new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", + 0f, + (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, + (s) => { return AngularDamping; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularDamping=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, LinearDamping, v); } ), + new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", + 0.2f, + (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, + (s) => { return DeactivationTime; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{DeactivationTime=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetDeactivationTime2(o.PhysBody.ptr, v); } ), + new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", + 0.8f, + (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, + (s) => { return LinearSleepingThreshold; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearSleepingThreshold=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ), + new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", + 1.0f, + (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, + (s) => { return AngularSleepingThreshold; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ), + new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , + 0f, // set to zero to disable + (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, + (s) => { return CcdMotionThreshold; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetCcdMotionThreshold2(o.PhysBody.ptr, v); } ), + new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , + 0f, + (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, + (s) => { return CcdSweptSphereRadius; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetCcdSweptSphereRadius2(o.PhysBody.ptr, v); } ), + new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" , + 0.1f, + (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, + (s) => { return ContactProcessingThreshold; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetContactProcessingThreshold2(o.PhysBody.ptr, v); } ), + + new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", + (float)BSTerrainPhys.TerrainImplementation.Mesh, + (s,cf,p,v) => { TerrainImplementation = cf.GetFloat(p,v); }, + (s) => { return TerrainImplementation; }, + (s,p,l,v) => { TerrainImplementation = v; } ), + new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , + 0.3f, + (s,cf,p,v) => { TerrainFriction = cf.GetFloat(p, v); }, + (s) => { return TerrainFriction; }, + (s,p,l,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), + new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , + 0.8f, + (s,cf,p,v) => { TerrainHitFraction = cf.GetFloat(p, v); }, + (s) => { return TerrainHitFraction; }, + (s,p,l,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), + new ParameterDefn("TerrainRestitution", "Bouncyness" , + 0f, + (s,cf,p,v) => { TerrainRestitution = cf.GetFloat(p, v); }, + (s) => { return TerrainRestitution; }, + (s,p,l,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), + new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , + 0.04f, + (s,cf,p,v) => { TerrainCollisionMargin = cf.GetFloat(p, v); }, + (s) => { return TerrainCollisionMargin; }, + (s,p,l,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), + + new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", + 0.2f, + (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); }, + (s) => { return AvatarFriction; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarFriction=x;}, p, l, v); } ), + new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", + 10.0f, + (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, + (s) => { return AvatarStandingFriction; }, + (s,p,l,v) => { AvatarStandingFriction = v; } ), + new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", + 60f, + (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, + (s) => { return AvatarDensity; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarDensity=x;}, p, l, v); } ), + new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", + 0f, + (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); }, + (s) => { return AvatarRestitution; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarRestitution=x;}, p, l, v); } ), + new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", + 0.6f, + (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); }, + (s) => { return AvatarCapsuleWidth; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleWidth=x;}, p, l, v); } ), + new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", + 0.45f, + (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); }, + (s) => { return AvatarCapsuleDepth; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleDepth=x;}, p, l, v); } ), + new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", + 1.5f, + (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); }, + (s) => { return AvatarCapsuleHeight; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleHeight=x;}, p, l, v); } ), + new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", + 0.1f, + (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, + (s) => { return AvatarContactProcessingThreshold; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarContactProcessingThreshold=x;}, p, l, v); } ), + + new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", + 0.95f, + (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, + (s) => { return VehicleAngularDamping; }, + (s,p,l,v) => { VehicleAngularDamping = v; } ), + + new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", + 0f, + (s,cf,p,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].maxPersistantManifoldPoolSize; }, + (s,p,l,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), + new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", + 0f, + (s,cf,p,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize; }, + (s,p,l,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), + new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", + ConfigurationParameters.numericFalse, + (s,cf,p,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation; }, + (s,p,l,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), + new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", + ConfigurationParameters.numericFalse, + (s,cf,p,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return s.UnmanagedParams[0].shouldForceUpdateAllAabbs; }, + (s,p,l,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), + new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", + ConfigurationParameters.numericTrue, + (s,cf,p,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return s.UnmanagedParams[0].shouldRandomizeSolverOrder; }, + (s,p,l,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), + new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", + ConfigurationParameters.numericTrue, + (s,cf,p,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, + (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), + new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", + ConfigurationParameters.numericFalse, + (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, + (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), + new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", + 0f, // zero says use Bullet default + (s,cf,p,v) => { s.UnmanagedParams[0].numberOfSolverIterations = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].numberOfSolverIterations; }, + (s,p,l,v) => { s.UnmanagedParams[0].numberOfSolverIterations = v; } ), + + new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", + (float)BSLinkset.LinksetImplementation.Compound, + (s,cf,p,v) => { LinksetImplementation = cf.GetFloat(p,v); }, + (s) => { return LinksetImplementation; }, + (s,p,l,v) => { LinksetImplementation = v; } ), + new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", + ConfigurationParameters.numericFalse, + (s,cf,p,v) => { LinkConstraintUseFrameOffset = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return LinkConstraintUseFrameOffset; }, + (s,p,l,v) => { LinkConstraintUseFrameOffset = v; } ), + new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", + ConfigurationParameters.numericTrue, + (s,cf,p,v) => { LinkConstraintEnableTransMotor = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return LinkConstraintEnableTransMotor; }, + (s,p,l,v) => { LinkConstraintEnableTransMotor = v; } ), + new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", + 5.0f, + (s,cf,p,v) => { LinkConstraintTransMotorMaxVel = cf.GetFloat(p, v); }, + (s) => { return LinkConstraintTransMotorMaxVel; }, + (s,p,l,v) => { LinkConstraintTransMotorMaxVel = v; } ), + new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", + 0.1f, + (s,cf,p,v) => { LinkConstraintTransMotorMaxForce = cf.GetFloat(p, v); }, + (s) => { return LinkConstraintTransMotorMaxForce; }, + (s,p,l,v) => { LinkConstraintTransMotorMaxForce = v; } ), + new ParameterDefn("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", + 0.1f, + (s,cf,p,v) => { LinkConstraintCFM = cf.GetFloat(p, v); }, + (s) => { return LinkConstraintCFM; }, + (s,p,l,v) => { LinkConstraintCFM = v; } ), + new ParameterDefn("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", + 0.1f, + (s,cf,p,v) => { LinkConstraintERP = cf.GetFloat(p, v); }, + (s) => { return LinkConstraintERP; }, + (s,p,l,v) => { LinkConstraintERP = v; } ), + new ParameterDefn("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", + 40, + (s,cf,p,v) => { LinkConstraintSolverIterations = cf.GetFloat(p, v); }, + (s) => { return LinkConstraintSolverIterations; }, + (s,p,l,v) => { LinkConstraintSolverIterations = v; } ), + + new ParameterDefn("LogPhysicsStatisticsFrames", "Frames between outputting detailed phys stats. (0 is off)", + 0f, + (s,cf,p,v) => { s.UnmanagedParams[0].physicsLoggingFrames = cf.GetInt(p, (int)v); }, + (s) => { return (float)s.UnmanagedParams[0].physicsLoggingFrames; }, + (s,p,l,v) => { s.UnmanagedParams[0].physicsLoggingFrames = (int)v; } ), + }; + + // Convert a boolean to our numeric true and false values + public static float NumericBool(bool b) + { + return (b ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse); + } + + // Convert numeric true and false values to a boolean + public static bool BoolNumeric(float b) + { + return (b == ConfigurationParameters.numericTrue ? true : false); + } + + // Search through the parameter definitions and return the matching + // ParameterDefn structure. + // Case does not matter as names are compared after converting to lower case. + // Returns 'false' if the parameter is not found. + internal static bool TryGetParameter(string paramName, out ParameterDefn defn) + { + bool ret = false; + ParameterDefn foundDefn = new ParameterDefn(); + string pName = paramName.ToLower(); + + foreach (ParameterDefn parm in ParameterDefinitions) + { + if (pName == parm.name.ToLower()) + { + foundDefn = parm; + ret = true; + break; + } + } + defn = foundDefn; + return ret; + } + + // Pass through the settable parameters and set the default values + internal static void SetParameterDefaultValues(BSScene physicsScene) + { + foreach (ParameterDefn parm in ParameterDefinitions) + { + parm.setter(physicsScene, parm.name, PhysParameterEntry.APPLY_TO_NONE, parm.defaultValue); + } + } + + // Get user set values out of the ini file. + internal static void SetParameterConfigurationValues(BSScene physicsScene, IConfig cfg) + { + foreach (ParameterDefn parm in ParameterDefinitions) + { + parm.userParam(physicsScene, cfg, parm.name, parm.defaultValue); + } + } + + internal static PhysParameterEntry[] SettableParameters = new PhysParameterEntry[1]; + + // This creates an array in the correct format for returning the list of + // parameters. This is used by the 'list' option of the 'physics' command. + internal static void BuildParameterTable() + { + if (SettableParameters.Length < ParameterDefinitions.Length) + { + List entries = new List(); + for (int ii = 0; ii < ParameterDefinitions.Length; ii++) + { + ParameterDefn pd = ParameterDefinitions[ii]; + entries.Add(new PhysParameterEntry(pd.name, pd.desc)); + } + + // make the list in alphabetical order for estetic reasons + entries.Sort(delegate(PhysParameterEntry ppe1, PhysParameterEntry ppe2) + { + return ppe1.name.CompareTo(ppe2.name); + }); + + SettableParameters = entries.ToArray(); + } + } + + +} +} -- cgit v1.1 From 6dbf9c8ed4ca5646f47043f9937da5acbe124d0e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 21 Dec 2012 15:21:32 -0800 Subject: BulletSim: repair vehicle problems introduced in previous 'improvements'. Fix line endings in BSParams. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 1117 ++++++++++++----------- 1 file changed, 559 insertions(+), 558 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 1fb4c31..5558ad5 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -1,558 +1,559 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyrightD - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using System; -using System.Collections.Generic; -using System.Text; - -using OpenSim.Region.Physics.Manager; - -using OpenMetaverse; -using Nini.Config; - -namespace OpenSim.Region.Physics.BulletSPlugin -{ -public static class BSParam -{ - // Level of Detail values kept as float because that's what the Meshmerizer wants - public static float MeshLOD { get; private set; } - public static float MeshMegaPrimLOD { get; private set; } - public static float MeshMegaPrimThreshold { get; private set; } - public static float SculptLOD { get; private set; } - - public static float MinimumObjectMass { get; private set; } - public static float MaximumObjectMass { get; private set; } - - public static float LinearDamping { get; private set; } - public static float AngularDamping { get; private set; } - public static float DeactivationTime { get; private set; } - public static float LinearSleepingThreshold { get; private set; } - public static float AngularSleepingThreshold { get; private set; } - public static float CcdMotionThreshold { get; private set; } - public static float CcdSweptSphereRadius { get; private set; } - public static float ContactProcessingThreshold { get; private set; } - - public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed - public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes - public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects - - public static float TerrainImplementation { get; private set; } - public static float TerrainFriction { get; private set; } - public static float TerrainHitFraction { get; private set; } - public static float TerrainRestitution { get; private set; } - public static float TerrainCollisionMargin { get; private set; } - - // Avatar parameters - public static float AvatarFriction { get; private set; } - public static float AvatarStandingFriction { get; private set; } - public static float AvatarDensity { get; private set; } - public static float AvatarRestitution { get; private set; } - public static float AvatarCapsuleWidth { get; private set; } - public static float AvatarCapsuleDepth { get; private set; } - public static float AvatarCapsuleHeight { get; private set; } - public static float AvatarContactProcessingThreshold { get; private set; } - - public static float VehicleAngularDamping { get; private set; } - - public static float LinksetImplementation { get; private set; } - public static float LinkConstraintUseFrameOffset { get; private set; } - public static float LinkConstraintEnableTransMotor { get; private set; } - public static float LinkConstraintTransMotorMaxVel { get; private set; } - public static float LinkConstraintTransMotorMaxForce { get; private set; } - public static float LinkConstraintERP { get; private set; } - public static float LinkConstraintCFM { get; private set; } - public static float LinkConstraintSolverIterations { get; private set; } - - public static float PID_D { get; private set; } // derivative - public static float PID_P { get; private set; } // proportional - - 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); - public delegate void SetOnObject(BSScene scene, BSPhysObject obj, float val); - - public struct ParameterDefn - { - public string name; // string name of the parameter - public string desc; // a short description of what the parameter means - public float defaultValue; // default value if not specified anywhere else - public ParamUser userParam; // get the value from the configuration file - public ParamGet getter; // return the current value stored for this parameter - public ParamSet setter; // set the current value for this parameter - public SetOnObject onObject; // set the value on an object in the physical domain - public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s) - { - name = n; - desc = d; - defaultValue = v; - userParam = u; - getter = g; - setter = s; - onObject = null; - } - public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s, SetOnObject o) - { - name = n; - desc = d; - defaultValue = v; - userParam = u; - getter = g; - setter = s; - onObject = o; - } - } - - // List of all of the externally visible parameters. - // For each parameter, this table maps a text name to getter and setters. - // To add a new externally referencable/settable parameter, add the paramter storage - // location somewhere in the program and make an entry in this table with the - // getters and setters. - // It is easiest to find an existing definition and copy it. - // Parameter values are floats. Booleans are converted to a floating value. - // - // A ParameterDefn() takes the following parameters: - // -- the text name of the parameter. This is used for console input and ini file. - // -- a short text description of the parameter. This shows up in the console listing. - // -- a delegate for fetching the parameter from the ini file. - // Should handle fetching the right type from the ini file and converting it. - // -- a delegate for getting the value as a float - // -- a delegate for setting the value from a float - // -- an optional delegate to update the value in the world. Most often used to - // push the new value to an in-world object. - // - // The single letter parameters for the delegates are: - // s = BSScene - // o = BSPhysObject - // p = string parameter name - // l = localID of referenced object - // v = float value - // cf = parameter configuration class (for fetching values from ini file) - private static ParameterDefn[] ParameterDefinitions = - { - new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { ShouldMeshSculptedPrim = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, - (s) => { return BSParam.NumericBool(ShouldMeshSculptedPrim); }, - (s,p,l,v) => { ShouldMeshSculptedPrim = BSParam.BoolNumeric(v); } ), - new ParameterDefn("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects", - ConfigurationParameters.numericFalse, - (s,cf,p,v) => { ShouldForceSimplePrimMeshing = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, - (s) => { return BSParam.NumericBool(ShouldForceSimplePrimMeshing); }, - (s,p,l,v) => { ShouldForceSimplePrimMeshing = BSParam.BoolNumeric(v); } ), - new ParameterDefn("UseHullsForPhysicalObjects", "If true, create hulls for physical objects", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, - (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, - (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), - - new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", - 8f, - (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); }, - (s) => { return MeshLOD; }, - (s,p,l,v) => { MeshLOD = v; } ), - new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", - 16f, - (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); }, - (s) => { return MeshMegaPrimLOD; }, - (s,p,l,v) => { MeshMegaPrimLOD = v; } ), - new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", - 10f, - (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); }, - (s) => { return MeshMegaPrimThreshold; }, - (s,p,l,v) => { MeshMegaPrimThreshold = v; } ), - new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", - 32f, - (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); }, - (s) => { return SculptLOD; }, - (s,p,l,v) => { SculptLOD = v; } ), - - new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps", - 10f, - (s,cf,p,v) => { s.m_maxSubSteps = cf.GetInt(p, (int)v); }, - (s) => { return (float)s.m_maxSubSteps; }, - (s,p,l,v) => { s.m_maxSubSteps = (int)v; } ), - new ParameterDefn("FixedTimeStep", "In simulation step, seconds of one substep (1/60)", - 1f / 60f, - (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); }, - (s) => { return (float)s.m_fixedTimeStep; }, - (s,p,l,v) => { s.m_fixedTimeStep = v; } ), - new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", - 2048f, - (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); }, - (s) => { return (float)s.m_maxCollisionsPerFrame; }, - (s,p,l,v) => { s.m_maxCollisionsPerFrame = (int)v; } ), - new ParameterDefn("MaxUpdatesPerFrame", "Max updates returned at end of each frame", - 8000f, - (s,cf,p,v) => { s.m_maxUpdatesPerFrame = cf.GetInt(p, (int)v); }, - (s) => { return (float)s.m_maxUpdatesPerFrame; }, - (s,p,l,v) => { s.m_maxUpdatesPerFrame = (int)v; } ), - new ParameterDefn("MaxTaintsToProcessPerStep", "Number of update taints to process before each simulation step", - 500f, - (s,cf,p,v) => { s.m_taintsToProcessPerStep = cf.GetInt(p, (int)v); }, - (s) => { return (float)s.m_taintsToProcessPerStep; }, - (s,p,l,v) => { s.m_taintsToProcessPerStep = (int)v; } ), - new ParameterDefn("MinObjectMass", "Minimum object mass (0.0001)", - 0.0001f, - (s,cf,p,v) => { MinimumObjectMass = cf.GetFloat(p, v); }, - (s) => { return (float)MinimumObjectMass; }, - (s,p,l,v) => { MinimumObjectMass = v; } ), - new ParameterDefn("MaxObjectMass", "Maximum object mass (10000.01)", - 10000.01f, - (s,cf,p,v) => { MaximumObjectMass = cf.GetFloat(p, v); }, - (s) => { return (float)MaximumObjectMass; }, - (s,p,l,v) => { MaximumObjectMass = v; } ), - - new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", - 2200f, - (s,cf,p,v) => { PID_D = cf.GetFloat(p, v); }, - (s) => { return (float)PID_D; }, - (s,p,l,v) => { PID_D = v; } ), - new ParameterDefn("PID_P", "Parameteric factor for motion smoothing", - 900f, - (s,cf,p,v) => { PID_P = cf.GetFloat(p, v); }, - (s) => { return (float)PID_P; }, - (s,p,l,v) => { PID_P = v; } ), - - new ParameterDefn("DefaultFriction", "Friction factor used on new objects", - 0.2f, - (s,cf,p,v) => { s.UnmanagedParams[0].defaultFriction = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].defaultFriction; }, - (s,p,l,v) => { s.UnmanagedParams[0].defaultFriction = v; } ), - new ParameterDefn("DefaultDensity", "Density for new objects" , - 10.000006836f, // Aluminum g/cm3 - (s,cf,p,v) => { s.UnmanagedParams[0].defaultDensity = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].defaultDensity; }, - (s,p,l,v) => { s.UnmanagedParams[0].defaultDensity = v; } ), - new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , - 0f, - (s,cf,p,v) => { s.UnmanagedParams[0].defaultRestitution = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].defaultRestitution; }, - (s,p,l,v) => { s.UnmanagedParams[0].defaultRestitution = v; } ), - new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", - 0.04f, - (s,cf,p,v) => { s.UnmanagedParams[0].collisionMargin = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].collisionMargin; }, - (s,p,l,v) => { s.UnmanagedParams[0].collisionMargin = v; } ), - new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", - -9.80665f, - (s,cf,p,v) => { s.UnmanagedParams[0].gravity = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].gravity; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{s.UnmanagedParams[0].gravity=x;}, p, PhysParameterEntry.APPLY_TO_NONE, v); }, - (s,o,v) => { BulletSimAPI.SetGravity2(s.World.ptr, new Vector3(0f,0f,v)); } ), - - - new ParameterDefn("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", - 0f, - (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, - (s) => { return LinearDamping; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearDamping=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, v, AngularDamping); } ), - new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", - 0f, - (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, - (s) => { return AngularDamping; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularDamping=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, LinearDamping, v); } ), - new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", - 0.2f, - (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, - (s) => { return DeactivationTime; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{DeactivationTime=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetDeactivationTime2(o.PhysBody.ptr, v); } ), - new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", - 0.8f, - (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, - (s) => { return LinearSleepingThreshold; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearSleepingThreshold=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ), - new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", - 1.0f, - (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, - (s) => { return AngularSleepingThreshold; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ), - new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , - 0f, // set to zero to disable - (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, - (s) => { return CcdMotionThreshold; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetCcdMotionThreshold2(o.PhysBody.ptr, v); } ), - new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , - 0f, - (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, - (s) => { return CcdSweptSphereRadius; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetCcdSweptSphereRadius2(o.PhysBody.ptr, v); } ), - new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" , - 0.1f, - (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, - (s) => { return ContactProcessingThreshold; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetContactProcessingThreshold2(o.PhysBody.ptr, v); } ), - - new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", - (float)BSTerrainPhys.TerrainImplementation.Mesh, - (s,cf,p,v) => { TerrainImplementation = cf.GetFloat(p,v); }, - (s) => { return TerrainImplementation; }, - (s,p,l,v) => { TerrainImplementation = v; } ), - new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , - 0.3f, - (s,cf,p,v) => { TerrainFriction = cf.GetFloat(p, v); }, - (s) => { return TerrainFriction; }, - (s,p,l,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), - new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , - 0.8f, - (s,cf,p,v) => { TerrainHitFraction = cf.GetFloat(p, v); }, - (s) => { return TerrainHitFraction; }, - (s,p,l,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), - new ParameterDefn("TerrainRestitution", "Bouncyness" , - 0f, - (s,cf,p,v) => { TerrainRestitution = cf.GetFloat(p, v); }, - (s) => { return TerrainRestitution; }, - (s,p,l,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), - new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , - 0.04f, - (s,cf,p,v) => { TerrainCollisionMargin = cf.GetFloat(p, v); }, - (s) => { return TerrainCollisionMargin; }, - (s,p,l,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), - - new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", - 0.2f, - (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); }, - (s) => { return AvatarFriction; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarFriction=x;}, p, l, v); } ), - new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", - 10.0f, - (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, - (s) => { return AvatarStandingFriction; }, - (s,p,l,v) => { AvatarStandingFriction = v; } ), - new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", - 60f, - (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, - (s) => { return AvatarDensity; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarDensity=x;}, p, l, v); } ), - new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", - 0f, - (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); }, - (s) => { return AvatarRestitution; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarRestitution=x;}, p, l, v); } ), - new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", - 0.6f, - (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); }, - (s) => { return AvatarCapsuleWidth; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleWidth=x;}, p, l, v); } ), - new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", - 0.45f, - (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); }, - (s) => { return AvatarCapsuleDepth; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleDepth=x;}, p, l, v); } ), - new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", - 1.5f, - (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); }, - (s) => { return AvatarCapsuleHeight; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleHeight=x;}, p, l, v); } ), - new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", - 0.1f, - (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, - (s) => { return AvatarContactProcessingThreshold; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarContactProcessingThreshold=x;}, p, l, v); } ), - - new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", - 0.95f, - (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, - (s) => { return VehicleAngularDamping; }, - (s,p,l,v) => { VehicleAngularDamping = v; } ), - - new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", - 0f, - (s,cf,p,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].maxPersistantManifoldPoolSize; }, - (s,p,l,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), - new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", - 0f, - (s,cf,p,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize; }, - (s,p,l,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), - new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", - ConfigurationParameters.numericFalse, - (s,cf,p,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation; }, - (s,p,l,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), - new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", - ConfigurationParameters.numericFalse, - (s,cf,p,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return s.UnmanagedParams[0].shouldForceUpdateAllAabbs; }, - (s,p,l,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), - new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return s.UnmanagedParams[0].shouldRandomizeSolverOrder; }, - (s,p,l,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), - new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, - (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), - new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", - ConfigurationParameters.numericFalse, - (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, - (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), - new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", - 0f, // zero says use Bullet default - (s,cf,p,v) => { s.UnmanagedParams[0].numberOfSolverIterations = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].numberOfSolverIterations; }, - (s,p,l,v) => { s.UnmanagedParams[0].numberOfSolverIterations = v; } ), - - new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", - (float)BSLinkset.LinksetImplementation.Compound, - (s,cf,p,v) => { LinksetImplementation = cf.GetFloat(p,v); }, - (s) => { return LinksetImplementation; }, - (s,p,l,v) => { LinksetImplementation = v; } ), - new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", - ConfigurationParameters.numericFalse, - (s,cf,p,v) => { LinkConstraintUseFrameOffset = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return LinkConstraintUseFrameOffset; }, - (s,p,l,v) => { LinkConstraintUseFrameOffset = v; } ), - new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { LinkConstraintEnableTransMotor = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return LinkConstraintEnableTransMotor; }, - (s,p,l,v) => { LinkConstraintEnableTransMotor = v; } ), - new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", - 5.0f, - (s,cf,p,v) => { LinkConstraintTransMotorMaxVel = cf.GetFloat(p, v); }, - (s) => { return LinkConstraintTransMotorMaxVel; }, - (s,p,l,v) => { LinkConstraintTransMotorMaxVel = v; } ), - new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", - 0.1f, - (s,cf,p,v) => { LinkConstraintTransMotorMaxForce = cf.GetFloat(p, v); }, - (s) => { return LinkConstraintTransMotorMaxForce; }, - (s,p,l,v) => { LinkConstraintTransMotorMaxForce = v; } ), - new ParameterDefn("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", - 0.1f, - (s,cf,p,v) => { LinkConstraintCFM = cf.GetFloat(p, v); }, - (s) => { return LinkConstraintCFM; }, - (s,p,l,v) => { LinkConstraintCFM = v; } ), - new ParameterDefn("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", - 0.1f, - (s,cf,p,v) => { LinkConstraintERP = cf.GetFloat(p, v); }, - (s) => { return LinkConstraintERP; }, - (s,p,l,v) => { LinkConstraintERP = v; } ), - new ParameterDefn("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", - 40, - (s,cf,p,v) => { LinkConstraintSolverIterations = cf.GetFloat(p, v); }, - (s) => { return LinkConstraintSolverIterations; }, - (s,p,l,v) => { LinkConstraintSolverIterations = v; } ), - - new ParameterDefn("LogPhysicsStatisticsFrames", "Frames between outputting detailed phys stats. (0 is off)", - 0f, - (s,cf,p,v) => { s.UnmanagedParams[0].physicsLoggingFrames = cf.GetInt(p, (int)v); }, - (s) => { return (float)s.UnmanagedParams[0].physicsLoggingFrames; }, - (s,p,l,v) => { s.UnmanagedParams[0].physicsLoggingFrames = (int)v; } ), - }; - - // Convert a boolean to our numeric true and false values - public static float NumericBool(bool b) - { - return (b ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse); - } - - // Convert numeric true and false values to a boolean - public static bool BoolNumeric(float b) - { - return (b == ConfigurationParameters.numericTrue ? true : false); - } - - // Search through the parameter definitions and return the matching - // ParameterDefn structure. - // Case does not matter as names are compared after converting to lower case. - // Returns 'false' if the parameter is not found. - internal static bool TryGetParameter(string paramName, out ParameterDefn defn) - { - bool ret = false; - ParameterDefn foundDefn = new ParameterDefn(); - string pName = paramName.ToLower(); - - foreach (ParameterDefn parm in ParameterDefinitions) - { - if (pName == parm.name.ToLower()) - { - foundDefn = parm; - ret = true; - break; - } - } - defn = foundDefn; - return ret; - } - - // Pass through the settable parameters and set the default values - internal static void SetParameterDefaultValues(BSScene physicsScene) - { - foreach (ParameterDefn parm in ParameterDefinitions) - { - parm.setter(physicsScene, parm.name, PhysParameterEntry.APPLY_TO_NONE, parm.defaultValue); - } - } - - // Get user set values out of the ini file. - internal static void SetParameterConfigurationValues(BSScene physicsScene, IConfig cfg) - { - foreach (ParameterDefn parm in ParameterDefinitions) - { - parm.userParam(physicsScene, cfg, parm.name, parm.defaultValue); - } - } - - internal static PhysParameterEntry[] SettableParameters = new PhysParameterEntry[1]; - - // This creates an array in the correct format for returning the list of - // parameters. This is used by the 'list' option of the 'physics' command. - internal static void BuildParameterTable() - { - if (SettableParameters.Length < ParameterDefinitions.Length) - { - List entries = new List(); - for (int ii = 0; ii < ParameterDefinitions.Length; ii++) - { - ParameterDefn pd = ParameterDefinitions[ii]; - entries.Add(new PhysParameterEntry(pd.name, pd.desc)); - } - - // make the list in alphabetical order for estetic reasons - entries.Sort(delegate(PhysParameterEntry ppe1, PhysParameterEntry ppe2) - { - return ppe1.name.CompareTo(ppe2.name); - }); - - SettableParameters = entries.ToArray(); - } - } - - -} -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyrightD + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Region.Physics.Manager; + +using OpenMetaverse; +using Nini.Config; + +namespace OpenSim.Region.Physics.BulletSPlugin +{ +public static class BSParam +{ + // Level of Detail values kept as float because that's what the Meshmerizer wants + public static float MeshLOD { get; private set; } + public static float MeshMegaPrimLOD { get; private set; } + public static float MeshMegaPrimThreshold { get; private set; } + public static float SculptLOD { get; private set; } + + public static float MinimumObjectMass { get; private set; } + public static float MaximumObjectMass { get; private set; } + + public static float LinearDamping { get; private set; } + public static float AngularDamping { get; private set; } + public static float DeactivationTime { get; private set; } + public static float LinearSleepingThreshold { get; private set; } + public static float AngularSleepingThreshold { get; private set; } + public static float CcdMotionThreshold { get; private set; } + public static float CcdSweptSphereRadius { get; private set; } + public static float ContactProcessingThreshold { get; private set; } + + public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed + public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes + public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects + + public static float TerrainImplementation { get; private set; } + public static float TerrainFriction { get; private set; } + public static float TerrainHitFraction { get; private set; } + public static float TerrainRestitution { get; private set; } + public static float TerrainCollisionMargin { get; private set; } + + // Avatar parameters + public static float AvatarFriction { get; private set; } + public static float AvatarStandingFriction { get; private set; } + public static float AvatarDensity { get; private set; } + public static float AvatarRestitution { get; private set; } + public static float AvatarCapsuleWidth { get; private set; } + public static float AvatarCapsuleDepth { get; private set; } + public static float AvatarCapsuleHeight { get; private set; } + public static float AvatarContactProcessingThreshold { get; private set; } + + public static float VehicleAngularDamping { get; private set; } + + public static float LinksetImplementation { get; private set; } + public static float LinkConstraintUseFrameOffset { get; private set; } + public static float LinkConstraintEnableTransMotor { get; private set; } + public static float LinkConstraintTransMotorMaxVel { get; private set; } + public static float LinkConstraintTransMotorMaxForce { get; private set; } + public static float LinkConstraintERP { get; private set; } + public static float LinkConstraintCFM { get; private set; } + public static float LinkConstraintSolverIterations { get; private set; } + + public static float PID_D { get; private set; } // derivative + public static float PID_P { get; private set; } // proportional + + 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); + public delegate void SetOnObject(BSScene scene, BSPhysObject obj, float val); + + public struct ParameterDefn + { + public string name; // string name of the parameter + public string desc; // a short description of what the parameter means + public float defaultValue; // default value if not specified anywhere else + public ParamUser userParam; // get the value from the configuration file + public ParamGet getter; // return the current value stored for this parameter + public ParamSet setter; // set the current value for this parameter + public SetOnObject onObject; // set the value on an object in the physical domain + public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s) + { + name = n; + desc = d; + defaultValue = v; + userParam = u; + getter = g; + setter = s; + onObject = null; + } + public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s, SetOnObject o) + { + name = n; + desc = d; + defaultValue = v; + userParam = u; + getter = g; + setter = s; + onObject = o; + } + } + + // List of all of the externally visible parameters. + // For each parameter, this table maps a text name to getter and setters. + // To add a new externally referencable/settable parameter, add the paramter storage + // location somewhere in the program and make an entry in this table with the + // getters and setters. + // It is easiest to find an existing definition and copy it. + // Parameter values are floats. Booleans are converted to a floating value. + // + // A ParameterDefn() takes the following parameters: + // -- the text name of the parameter. This is used for console input and ini file. + // -- a short text description of the parameter. This shows up in the console listing. + // -- a default value (float) + // -- a delegate for fetching the parameter from the ini file. + // Should handle fetching the right type from the ini file and converting it. + // -- a delegate for getting the value as a float + // -- a delegate for setting the value from a float + // -- an optional delegate to update the value in the world. Most often used to + // push the new value to an in-world object. + // + // The single letter parameters for the delegates are: + // s = BSScene + // o = BSPhysObject + // p = string parameter name + // l = localID of referenced object + // v = value (float) + // cf = parameter configuration class (for fetching values from ini file) + private static ParameterDefn[] ParameterDefinitions = + { + new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", + ConfigurationParameters.numericTrue, + (s,cf,p,v) => { ShouldMeshSculptedPrim = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, + (s) => { return BSParam.NumericBool(ShouldMeshSculptedPrim); }, + (s,p,l,v) => { ShouldMeshSculptedPrim = BSParam.BoolNumeric(v); } ), + new ParameterDefn("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects", + ConfigurationParameters.numericFalse, + (s,cf,p,v) => { ShouldForceSimplePrimMeshing = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, + (s) => { return BSParam.NumericBool(ShouldForceSimplePrimMeshing); }, + (s,p,l,v) => { ShouldForceSimplePrimMeshing = BSParam.BoolNumeric(v); } ), + new ParameterDefn("UseHullsForPhysicalObjects", "If true, create hulls for physical objects", + ConfigurationParameters.numericTrue, + (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, + (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, + (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), + + new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", + 8f, + (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); }, + (s) => { return MeshLOD; }, + (s,p,l,v) => { MeshLOD = v; } ), + new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", + 16f, + (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); }, + (s) => { return MeshMegaPrimLOD; }, + (s,p,l,v) => { MeshMegaPrimLOD = v; } ), + new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", + 10f, + (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); }, + (s) => { return MeshMegaPrimThreshold; }, + (s,p,l,v) => { MeshMegaPrimThreshold = v; } ), + new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", + 32f, + (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); }, + (s) => { return SculptLOD; }, + (s,p,l,v) => { SculptLOD = v; } ), + + new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps", + 10f, + (s,cf,p,v) => { s.m_maxSubSteps = cf.GetInt(p, (int)v); }, + (s) => { return (float)s.m_maxSubSteps; }, + (s,p,l,v) => { s.m_maxSubSteps = (int)v; } ), + new ParameterDefn("FixedTimeStep", "In simulation step, seconds of one substep (1/60)", + 1f / 60f, + (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); }, + (s) => { return (float)s.m_fixedTimeStep; }, + (s,p,l,v) => { s.m_fixedTimeStep = v; } ), + new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", + 2048f, + (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); }, + (s) => { return (float)s.m_maxCollisionsPerFrame; }, + (s,p,l,v) => { s.m_maxCollisionsPerFrame = (int)v; } ), + new ParameterDefn("MaxUpdatesPerFrame", "Max updates returned at end of each frame", + 8000f, + (s,cf,p,v) => { s.m_maxUpdatesPerFrame = cf.GetInt(p, (int)v); }, + (s) => { return (float)s.m_maxUpdatesPerFrame; }, + (s,p,l,v) => { s.m_maxUpdatesPerFrame = (int)v; } ), + new ParameterDefn("MaxTaintsToProcessPerStep", "Number of update taints to process before each simulation step", + 500f, + (s,cf,p,v) => { s.m_taintsToProcessPerStep = cf.GetInt(p, (int)v); }, + (s) => { return (float)s.m_taintsToProcessPerStep; }, + (s,p,l,v) => { s.m_taintsToProcessPerStep = (int)v; } ), + new ParameterDefn("MinObjectMass", "Minimum object mass (0.0001)", + 0.0001f, + (s,cf,p,v) => { MinimumObjectMass = cf.GetFloat(p, v); }, + (s) => { return (float)MinimumObjectMass; }, + (s,p,l,v) => { MinimumObjectMass = v; } ), + new ParameterDefn("MaxObjectMass", "Maximum object mass (10000.01)", + 10000.01f, + (s,cf,p,v) => { MaximumObjectMass = cf.GetFloat(p, v); }, + (s) => { return (float)MaximumObjectMass; }, + (s,p,l,v) => { MaximumObjectMass = v; } ), + + new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", + 2200f, + (s,cf,p,v) => { PID_D = cf.GetFloat(p, v); }, + (s) => { return (float)PID_D; }, + (s,p,l,v) => { PID_D = v; } ), + new ParameterDefn("PID_P", "Parameteric factor for motion smoothing", + 900f, + (s,cf,p,v) => { PID_P = cf.GetFloat(p, v); }, + (s) => { return (float)PID_P; }, + (s,p,l,v) => { PID_P = v; } ), + + new ParameterDefn("DefaultFriction", "Friction factor used on new objects", + 0.2f, + (s,cf,p,v) => { s.UnmanagedParams[0].defaultFriction = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].defaultFriction; }, + (s,p,l,v) => { s.UnmanagedParams[0].defaultFriction = v; } ), + new ParameterDefn("DefaultDensity", "Density for new objects" , + 10.000006836f, // Aluminum g/cm3 + (s,cf,p,v) => { s.UnmanagedParams[0].defaultDensity = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].defaultDensity; }, + (s,p,l,v) => { s.UnmanagedParams[0].defaultDensity = v; } ), + new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , + 0f, + (s,cf,p,v) => { s.UnmanagedParams[0].defaultRestitution = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].defaultRestitution; }, + (s,p,l,v) => { s.UnmanagedParams[0].defaultRestitution = v; } ), + new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", + 0.04f, + (s,cf,p,v) => { s.UnmanagedParams[0].collisionMargin = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].collisionMargin; }, + (s,p,l,v) => { s.UnmanagedParams[0].collisionMargin = v; } ), + new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", + -9.80665f, + (s,cf,p,v) => { s.UnmanagedParams[0].gravity = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].gravity; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{s.UnmanagedParams[0].gravity=x;}, p, PhysParameterEntry.APPLY_TO_NONE, v); }, + (s,o,v) => { BulletSimAPI.SetGravity2(s.World.ptr, new Vector3(0f,0f,v)); } ), + + + new ParameterDefn("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", + 0f, + (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, + (s) => { return LinearDamping; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearDamping=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, v, AngularDamping); } ), + new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", + 0f, + (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, + (s) => { return AngularDamping; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularDamping=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, LinearDamping, v); } ), + new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", + 0.2f, + (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, + (s) => { return DeactivationTime; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{DeactivationTime=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetDeactivationTime2(o.PhysBody.ptr, v); } ), + new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", + 0.8f, + (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, + (s) => { return LinearSleepingThreshold; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearSleepingThreshold=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ), + new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", + 1.0f, + (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, + (s) => { return AngularSleepingThreshold; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ), + new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , + 0f, // set to zero to disable + (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, + (s) => { return CcdMotionThreshold; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetCcdMotionThreshold2(o.PhysBody.ptr, v); } ), + new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , + 0f, + (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, + (s) => { return CcdSweptSphereRadius; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetCcdSweptSphereRadius2(o.PhysBody.ptr, v); } ), + new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" , + 0.1f, + (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, + (s) => { return ContactProcessingThreshold; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); }, + (s,o,v) => { BulletSimAPI.SetContactProcessingThreshold2(o.PhysBody.ptr, v); } ), + + new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", + (float)BSTerrainPhys.TerrainImplementation.Mesh, + (s,cf,p,v) => { TerrainImplementation = cf.GetFloat(p,v); }, + (s) => { return TerrainImplementation; }, + (s,p,l,v) => { TerrainImplementation = v; } ), + new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , + 0.3f, + (s,cf,p,v) => { TerrainFriction = cf.GetFloat(p, v); }, + (s) => { return TerrainFriction; }, + (s,p,l,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), + new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , + 0.8f, + (s,cf,p,v) => { TerrainHitFraction = cf.GetFloat(p, v); }, + (s) => { return TerrainHitFraction; }, + (s,p,l,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), + new ParameterDefn("TerrainRestitution", "Bouncyness" , + 0f, + (s,cf,p,v) => { TerrainRestitution = cf.GetFloat(p, v); }, + (s) => { return TerrainRestitution; }, + (s,p,l,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), + new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , + 0.04f, + (s,cf,p,v) => { TerrainCollisionMargin = cf.GetFloat(p, v); }, + (s) => { return TerrainCollisionMargin; }, + (s,p,l,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), + + new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", + 0.2f, + (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); }, + (s) => { return AvatarFriction; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarFriction=x;}, p, l, v); } ), + new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", + 10.0f, + (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, + (s) => { return AvatarStandingFriction; }, + (s,p,l,v) => { AvatarStandingFriction = v; } ), + new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", + 60f, + (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, + (s) => { return AvatarDensity; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarDensity=x;}, p, l, v); } ), + new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", + 0f, + (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); }, + (s) => { return AvatarRestitution; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarRestitution=x;}, p, l, v); } ), + new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", + 0.6f, + (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); }, + (s) => { return AvatarCapsuleWidth; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleWidth=x;}, p, l, v); } ), + new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", + 0.45f, + (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); }, + (s) => { return AvatarCapsuleDepth; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleDepth=x;}, p, l, v); } ), + new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", + 1.5f, + (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); }, + (s) => { return AvatarCapsuleHeight; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleHeight=x;}, p, l, v); } ), + new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", + 0.1f, + (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, + (s) => { return AvatarContactProcessingThreshold; }, + (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarContactProcessingThreshold=x;}, p, l, v); } ), + + new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", + 0.95f, + (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, + (s) => { return VehicleAngularDamping; }, + (s,p,l,v) => { VehicleAngularDamping = v; } ), + + new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", + 0f, + (s,cf,p,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].maxPersistantManifoldPoolSize; }, + (s,p,l,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), + new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", + 0f, + (s,cf,p,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize; }, + (s,p,l,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), + new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", + ConfigurationParameters.numericFalse, + (s,cf,p,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation; }, + (s,p,l,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), + new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", + ConfigurationParameters.numericFalse, + (s,cf,p,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return s.UnmanagedParams[0].shouldForceUpdateAllAabbs; }, + (s,p,l,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), + new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", + ConfigurationParameters.numericTrue, + (s,cf,p,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return s.UnmanagedParams[0].shouldRandomizeSolverOrder; }, + (s,p,l,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), + new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", + ConfigurationParameters.numericTrue, + (s,cf,p,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, + (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), + new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", + ConfigurationParameters.numericFalse, + (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, + (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), + new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", + 0f, // zero says use Bullet default + (s,cf,p,v) => { s.UnmanagedParams[0].numberOfSolverIterations = cf.GetFloat(p, v); }, + (s) => { return s.UnmanagedParams[0].numberOfSolverIterations; }, + (s,p,l,v) => { s.UnmanagedParams[0].numberOfSolverIterations = v; } ), + + new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", + (float)BSLinkset.LinksetImplementation.Compound, + (s,cf,p,v) => { LinksetImplementation = cf.GetFloat(p,v); }, + (s) => { return LinksetImplementation; }, + (s,p,l,v) => { LinksetImplementation = v; } ), + new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", + ConfigurationParameters.numericFalse, + (s,cf,p,v) => { LinkConstraintUseFrameOffset = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return LinkConstraintUseFrameOffset; }, + (s,p,l,v) => { LinkConstraintUseFrameOffset = v; } ), + new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", + ConfigurationParameters.numericTrue, + (s,cf,p,v) => { LinkConstraintEnableTransMotor = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return LinkConstraintEnableTransMotor; }, + (s,p,l,v) => { LinkConstraintEnableTransMotor = v; } ), + new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", + 5.0f, + (s,cf,p,v) => { LinkConstraintTransMotorMaxVel = cf.GetFloat(p, v); }, + (s) => { return LinkConstraintTransMotorMaxVel; }, + (s,p,l,v) => { LinkConstraintTransMotorMaxVel = v; } ), + new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", + 0.1f, + (s,cf,p,v) => { LinkConstraintTransMotorMaxForce = cf.GetFloat(p, v); }, + (s) => { return LinkConstraintTransMotorMaxForce; }, + (s,p,l,v) => { LinkConstraintTransMotorMaxForce = v; } ), + new ParameterDefn("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", + 0.1f, + (s,cf,p,v) => { LinkConstraintCFM = cf.GetFloat(p, v); }, + (s) => { return LinkConstraintCFM; }, + (s,p,l,v) => { LinkConstraintCFM = v; } ), + new ParameterDefn("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", + 0.1f, + (s,cf,p,v) => { LinkConstraintERP = cf.GetFloat(p, v); }, + (s) => { return LinkConstraintERP; }, + (s,p,l,v) => { LinkConstraintERP = v; } ), + new ParameterDefn("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", + 40, + (s,cf,p,v) => { LinkConstraintSolverIterations = cf.GetFloat(p, v); }, + (s) => { return LinkConstraintSolverIterations; }, + (s,p,l,v) => { LinkConstraintSolverIterations = v; } ), + + new ParameterDefn("LogPhysicsStatisticsFrames", "Frames between outputting detailed phys stats. (0 is off)", + 0f, + (s,cf,p,v) => { s.UnmanagedParams[0].physicsLoggingFrames = cf.GetInt(p, (int)v); }, + (s) => { return (float)s.UnmanagedParams[0].physicsLoggingFrames; }, + (s,p,l,v) => { s.UnmanagedParams[0].physicsLoggingFrames = (int)v; } ), + }; + + // Convert a boolean to our numeric true and false values + public static float NumericBool(bool b) + { + return (b ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse); + } + + // Convert numeric true and false values to a boolean + public static bool BoolNumeric(float b) + { + return (b == ConfigurationParameters.numericTrue ? true : false); + } + + // Search through the parameter definitions and return the matching + // ParameterDefn structure. + // Case does not matter as names are compared after converting to lower case. + // Returns 'false' if the parameter is not found. + internal static bool TryGetParameter(string paramName, out ParameterDefn defn) + { + bool ret = false; + ParameterDefn foundDefn = new ParameterDefn(); + string pName = paramName.ToLower(); + + foreach (ParameterDefn parm in ParameterDefinitions) + { + if (pName == parm.name.ToLower()) + { + foundDefn = parm; + ret = true; + break; + } + } + defn = foundDefn; + return ret; + } + + // Pass through the settable parameters and set the default values + internal static void SetParameterDefaultValues(BSScene physicsScene) + { + foreach (ParameterDefn parm in ParameterDefinitions) + { + parm.setter(physicsScene, parm.name, PhysParameterEntry.APPLY_TO_NONE, parm.defaultValue); + } + } + + // Get user set values out of the ini file. + internal static void SetParameterConfigurationValues(BSScene physicsScene, IConfig cfg) + { + foreach (ParameterDefn parm in ParameterDefinitions) + { + parm.userParam(physicsScene, cfg, parm.name, parm.defaultValue); + } + } + + internal static PhysParameterEntry[] SettableParameters = new PhysParameterEntry[1]; + + // This creates an array in the correct format for returning the list of + // parameters. This is used by the 'list' option of the 'physics' command. + internal static void BuildParameterTable() + { + if (SettableParameters.Length < ParameterDefinitions.Length) + { + List entries = new List(); + for (int ii = 0; ii < ParameterDefinitions.Length; ii++) + { + ParameterDefn pd = ParameterDefinitions[ii]; + entries.Add(new PhysParameterEntry(pd.name, pd.desc)); + } + + // make the list in alphabetical order for estetic reasons + entries.Sort(delegate(PhysParameterEntry ppe1, PhysParameterEntry ppe2) + { + return ppe1.name.CompareTo(ppe2.name); + }); + + SettableParameters = entries.ToArray(); + } + } + + +} +} -- cgit v1.1 From 4759a8acee97fa175c078ec72d9b8cf0db96121b Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 24 Dec 2012 20:16:10 -0800 Subject: BulletSim: Default avatar density changed to 3.5 which is WAY closer to the SL value. Fixed frictin values for physical materials which were just wrong which caused things that should have slipped to not. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 5558ad5..7454718 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -351,7 +351,7 @@ public static class BSParam (s) => { return AvatarStandingFriction; }, (s,p,l,v) => { AvatarStandingFriction = v; } ), new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", - 60f, + 3.5f, (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, (s) => { return AvatarDensity; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarDensity=x;}, p, l, v); } ), -- cgit v1.1 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 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') 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); -- cgit v1.1 From c1e7539c77480b839d513dbb7db74aa8f260eba0 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 27 Dec 2012 18:19:25 -0800 Subject: BulletSim: Parameterize nominal frame rate (55) and add parameters to dynamially turn on/off detailed, unmanaged data dumping of prims and vehicles. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 8366cef..f8f24bd 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -212,6 +212,11 @@ public static class BSParam (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); }, (s) => { return (float)s.m_fixedTimeStep; }, (s,p,l,v) => { s.m_fixedTimeStep = v; } ), + new ParameterDefn("NominalFrameRate", "The base frame rate we claim", + 55f, + (s,cf,p,v) => { s.NominalFrameRate = cf.GetInt(p, (int)v); }, + (s) => { return (float)s.NominalFrameRate; }, + (s,p,l,v) => { s.NominalFrameRate = (int)v; } ), new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", 2048f, (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); }, -- cgit v1.1 From 7266eeca6efd10852a062cfc802a50c346b7b119 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 28 Dec 2012 12:01:57 -0800 Subject: BulletSim: add 'AvatarAlwaysRunFactor' parameter and use in setTargetVelocity to implement the 'always run' feature. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index f8f24bd..5c8553a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -68,6 +68,7 @@ public static class BSParam // Avatar parameters public static float AvatarFriction { get; private set; } public static float AvatarStandingFriction { get; private set; } + public static float AvatarAlwaysRunFactor { get; private set; } public static float AvatarDensity { get; private set; } public static float AvatarRestitution { get; private set; } public static float AvatarCapsuleWidth { get; private set; } @@ -367,6 +368,11 @@ public static class BSParam (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, (s) => { return AvatarStandingFriction; }, (s,p,l,v) => { AvatarStandingFriction = v; } ), + new ParameterDefn("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", + 1.3f, + (s,cf,p,v) => { AvatarAlwaysRunFactor = cf.GetFloat(p, v); }, + (s) => { return AvatarAlwaysRunFactor; }, + (s,p,l,v) => { AvatarAlwaysRunFactor = v; } ), new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", 3.5f, (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, -- cgit v1.1 From 9218748321519ed04da5cdffa1f29e69030171b5 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 30 Dec 2012 10:21:47 -0800 Subject: BulletSim: another round of conversion: dynamics world and collision object functions. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 5c8553a..c6c2946 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -300,7 +300,7 @@ public static class BSParam (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, (s) => { return DeactivationTime; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{DeactivationTime=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetDeactivationTime2(o.PhysBody.ptr, v); } ), + (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ), new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", 0.8f, (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, @@ -318,19 +318,19 @@ public static class BSParam (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, (s) => { return CcdMotionThreshold; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetCcdMotionThreshold2(o.PhysBody.ptr, v); } ), + (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , 0f, (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, (s) => { return CcdSweptSphereRadius; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetCcdSweptSphereRadius2(o.PhysBody.ptr, v); } ), + (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ), new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" , 0.1f, (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, (s) => { return ContactProcessingThreshold; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetContactProcessingThreshold2(o.PhysBody.ptr, v); } ), + (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ), new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", (float)BSTerrainPhys.TerrainImplementation.Mesh, -- cgit v1.1 From c2a7af18b639646b647eb4cdff4168a2b9746ee4 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 30 Dec 2012 14:26:57 -0800 Subject: BulletSim: nearly complete in conversion from BulletSimAPI to BSAPITemplate. Only initialization and debug fuctions left. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index c6c2946..339722e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -280,7 +280,7 @@ public static class BSParam (s,cf,p,v) => { s.UnmanagedParams[0].gravity = cf.GetFloat(p, v); }, (s) => { return s.UnmanagedParams[0].gravity; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{s.UnmanagedParams[0].gravity=x;}, p, PhysParameterEntry.APPLY_TO_NONE, v); }, - (s,o,v) => { BulletSimAPI.SetGravity2(s.World.ptr, new Vector3(0f,0f,v)); } ), + (s,o,v) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,v)); } ), new ParameterDefn("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", @@ -288,13 +288,13 @@ public static class BSParam (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, (s) => { return LinearDamping; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearDamping=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, v, AngularDamping); } ), + (s,o,v) => { s.PE.SetDamping(o.PhysBody, v, AngularDamping); } ), new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", 0f, (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, (s) => { return AngularDamping; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularDamping=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, LinearDamping, v); } ), + (s,o,v) => { s.PE.SetDamping(o.PhysBody, LinearDamping, v); } ), new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", 0.2f, (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, @@ -306,13 +306,13 @@ public static class BSParam (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, (s) => { return LinearSleepingThreshold; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearSleepingThreshold=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ), + (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", 1.0f, (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, (s) => { return AngularSleepingThreshold; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, - (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ), + (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , 0f, // set to zero to disable (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, -- cgit v1.1 From aa236b2020a16c464a854be2b02ca49ea637cb27 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 1 Jan 2013 17:25:41 -0800 Subject: BulletSim: add parameter to have Bullet output performance statistics every so many frames. Default to off. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 339722e..69ac8cd 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -492,11 +492,11 @@ public static class BSParam (s) => { return LinkConstraintSolverIterations; }, (s,p,l,v) => { LinkConstraintSolverIterations = v; } ), - new ParameterDefn("LogPhysicsStatisticsFrames", "Frames between outputting detailed phys stats. (0 is off)", + new ParameterDefn("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)", 0f, - (s,cf,p,v) => { s.UnmanagedParams[0].physicsLoggingFrames = cf.GetInt(p, (int)v); }, - (s) => { return (float)s.UnmanagedParams[0].physicsLoggingFrames; }, - (s,p,l,v) => { s.UnmanagedParams[0].physicsLoggingFrames = (int)v; } ), + (s,cf,p,v) => { s.PhysicsMetricDumpFrames = cf.GetFloat(p, (int)v); }, + (s) => { return (float)s.PhysicsMetricDumpFrames; }, + (s,p,l,v) => { s.PhysicsMetricDumpFrames = (int)v; } ), }; // Convert a boolean to our numeric true and false values -- cgit v1.1 From 2eda385f5e72e165150d0925c56b1188c77cafe8 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 1 Jan 2013 20:26:31 -0800 Subject: BulletSim: add ResetBroadphasePool and ResetConstraintSolver diagnostic functions. If values set from console, the functions are called. Looking for why the collision pools fill up with unnecessary stuff. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 69ac8cd..b9bd0bf 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -497,6 +497,16 @@ public static class BSParam (s,cf,p,v) => { s.PhysicsMetricDumpFrames = cf.GetFloat(p, (int)v); }, (s) => { return (float)s.PhysicsMetricDumpFrames; }, (s,p,l,v) => { s.PhysicsMetricDumpFrames = (int)v; } ), + new ParameterDefn("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool", + 0f, + (s,cf,p,v) => { ; }, + (s) => { return 0f; }, + (s,p,l,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ), + new ParameterDefn("ResetConstraintSolver", "Setting this is any value resets the constraint solver", + 0f, + (s,cf,p,v) => { ; }, + (s) => { return 0f; }, + (s,p,l,v) => { BSParam.ResetConstraintSolverTainted(s, v); } ), }; // Convert a boolean to our numeric true and false values @@ -511,6 +521,24 @@ public static class BSParam return (b == ConfigurationParameters.numericTrue ? true : false); } + private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) + { + BSScene physScene = pPhysScene; + physScene.TaintedObject("BSParam.ResetBroadphasePoolTainted", delegate() + { + physScene.PE.ResetBroadphasePool(physScene.World); + }); + } + + private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v) + { + BSScene physScene = pPhysScene; + physScene.TaintedObject("BSParam.ResetConstraintSolver", delegate() + { + physScene.PE.ResetConstraintSolver(physScene.World); + }); + } + // Search through the parameter definitions and return the matching // ParameterDefn structure. // Case does not matter as names are compared after converting to lower case. -- cgit v1.1 From 8452c0a8702ccf7ea045740dd829c69a6f509845 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 7 Jan 2013 16:05:02 -0800 Subject: BulletSim: add function to push avatar up when hitting stairs. It looks like BulletSim and ODE rely on penetration correction to cause the avatar to move up and thus allowing walking up stairs. Object penetration was minimized for walking and flying (so one doesn't go through walls) and this stopped stairs from working. This commit introduces avatar movement code to check for collisions at the feet while walking and attempts to raise the avatar for the steps. Not yet perfect but movement is better. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index b9bd0bf..23d573f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -75,6 +75,9 @@ public static class BSParam public static float AvatarCapsuleDepth { get; private set; } public static float AvatarCapsuleHeight { get; private set; } public static float AvatarContactProcessingThreshold { get; private set; } + public static float AvatarStepHeight { get; private set; } + public static float AvatarStepApproachFactor { get; private set; } + public static float AvatarStepForceFactor { get; private set; } public static float VehicleAngularDamping { get; private set; } @@ -403,6 +406,21 @@ public static class BSParam (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, (s) => { return AvatarContactProcessingThreshold; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarContactProcessingThreshold=x;}, p, l, v); } ), + new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", + 0.3f, + (s,cf,p,v) => { AvatarStepHeight = cf.GetFloat(p, v); }, + (s) => { return AvatarStepHeight; }, + (s,p,l,v) => { AvatarStepHeight = v; } ), + new ParameterDefn("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", + 0.6f, + (s,cf,p,v) => { AvatarStepApproachFactor = cf.GetFloat(p, v); }, + (s) => { return AvatarStepApproachFactor; }, + (s,p,l,v) => { AvatarStepApproachFactor = v; } ), + new ParameterDefn("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", + 2.0f, + (s,cf,p,v) => { AvatarStepForceFactor = cf.GetFloat(p, v); }, + (s) => { return AvatarStepForceFactor; }, + (s,p,l,v) => { AvatarStepForceFactor = v; } ), new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", 0.95f, -- cgit v1.1 From 7e58bbaac6c5ebb5bf0d6a7a875a8316ac264128 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 9 Jan 2013 16:27:06 -0800 Subject: BulletSim: Redo linear function coding so they can better interact. New algorithm for limitMotorUp that relies on going up when not colliding rather than distance from ground. Add parameter for turning on and off embedded source vehicle debugging. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 23d573f..27ff047 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -80,6 +80,7 @@ public static class BSParam public static float AvatarStepForceFactor { get; private set; } public static float VehicleAngularDamping { get; private set; } + public static float VehicleDebuggingEnabled { get; private set; } public static float LinksetImplementation { get; private set; } public static float LinkConstraintUseFrameOffset { get; private set; } @@ -427,6 +428,11 @@ public static class BSParam (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, (s) => { return VehicleAngularDamping; }, (s,p,l,v) => { VehicleAngularDamping = v; } ), + new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", + ConfigurationParameters.numericFalse, + (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return VehicleDebuggingEnabled; }, + (s,p,l,v) => { VehicleDebuggingEnabled = v; } ), new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", 0f, -- cgit v1.1 From 13778c895ae8adca907781c9d8c3a9ada30814e0 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 15 Jan 2013 01:44:34 -0800 Subject: BulletSim: by default, turn on continuious collision detection (CCD) and enable friction computation caching. Remove dangerous BulletSim settings from OpenSimDefaults.ini. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 27ff047..862dbf6 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -318,13 +318,13 @@ public static class BSParam (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , - 0f, // set to zero to disable + 0.3f, // set to zero to disable (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, (s) => { return CcdMotionThreshold; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , - 0f, + 0.2f, (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, (s) => { return CcdSweptSphereRadius; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, @@ -465,7 +465,7 @@ public static class BSParam (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", - ConfigurationParameters.numericFalse, + ConfigurationParameters.numericTrue, (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), -- cgit v1.1 From daef2b8d87300f02bef7edf01ae67c8c6a50af46 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 15 Jan 2013 12:55:55 -0800 Subject: BulletSim: reduce maximum force a script can apply (like in llApplyImpulse) to the documented maximum from the outragious number previously. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 862dbf6..3e80aa4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -94,16 +94,16 @@ 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 + // 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 MinDensity = 0.01f; public const float MaxDensity = 22587f; public const float MinRestitution = 0f; public const float MaxRestitution = 1f; - public const float MaxAddForceMagnitude = 20000f; + public const float MaxAddForceMagnitude = 20f; // =========================================================================== public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); -- cgit v1.1 From 52b341e2e24384395fddc7d32fd66358f5062468 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 20 Jan 2013 22:35:42 -0800 Subject: BulletSim: More aggressive as setting character velocity to zero when should be standing. Modify angular force routines to be the same pattern as linear force routines. BulletSim vehicle turning is scaled like SL and is DIFFERENT THAN ODE!! Fix some bugs in BSMotor dealing with the motor going to zero. Add a bunch of parameters: MaxLinearVelocity, MaxAngularVelocity, MaxAddForceMagnitude, VehicleMaxLinearVelocity, VehicleMaxAngularVelocity, and most of the values are defaulted to values that are larger than in SL. Use the new parameters in BSPrim, BSCharacter and BSDynamic. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 32 ++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 3e80aa4..6a92365 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -45,6 +45,9 @@ public static class BSParam public static float MinimumObjectMass { get; private set; } public static float MaximumObjectMass { get; private set; } + public static float MaxLinearVelocity { get; private set; } + public static float MaxAngularVelocity { get; private set; } + public static float MaxAddForceMagnitude { get; private set; } public static float LinearDamping { get; private set; } public static float AngularDamping { get; private set; } @@ -79,6 +82,8 @@ public static class BSParam public static float AvatarStepApproachFactor { get; private set; } public static float AvatarStepForceFactor { get; private set; } + public static float VehicleMaxLinearVelocity { get; private set; } + public static float VehicleMaxAngularVelocity { get; private set; } public static float VehicleAngularDamping { get; private set; } public static float VehicleDebuggingEnabled { get; private set; } @@ -103,7 +108,6 @@ public static class BSParam public const float MaxDensity = 22587f; public const float MinRestitution = 0f; public const float MaxRestitution = 1f; - public const float MaxAddForceMagnitude = 20f; // =========================================================================== public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); @@ -247,6 +251,22 @@ public static class BSParam (s,cf,p,v) => { MaximumObjectMass = cf.GetFloat(p, v); }, (s) => { return (float)MaximumObjectMass; }, (s,p,l,v) => { MaximumObjectMass = v; } ), + new ParameterDefn("MaxLinearVelocity", "Maximum velocity magnitude that can be assigned to an object", + 1000.0f, + (s,cf,p,v) => { MaxLinearVelocity = cf.GetFloat(p, v); }, + (s) => { return (float)MaxLinearVelocity; }, + (s,p,l,v) => { MaxLinearVelocity = v; } ), + new ParameterDefn("MaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to an object", + 1000.0f, + (s,cf,p,v) => { MaxAngularVelocity = cf.GetFloat(p, v); }, + (s) => { return (float)MaxAngularVelocity; }, + (s,p,l,v) => { MaxAngularVelocity = v; } ), + // LL documentation says thie number should be 20f + new ParameterDefn("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)", + 200.0f, + (s,cf,p,v) => { MaxAddForceMagnitude = cf.GetFloat(p, v); }, + (s) => { return (float)MaxAddForceMagnitude; }, + (s,p,l,v) => { MaxAddForceMagnitude = v; } ), new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", 2200f, @@ -423,6 +443,16 @@ public static class BSParam (s) => { return AvatarStepForceFactor; }, (s,p,l,v) => { AvatarStepForceFactor = v; } ), + new ParameterDefn("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", + 1000.0f, + (s,cf,p,v) => { VehicleMaxLinearVelocity = cf.GetFloat(p, v); }, + (s) => { return (float)VehicleMaxLinearVelocity; }, + (s,p,l,v) => { VehicleMaxLinearVelocity = v; } ), + new ParameterDefn("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", + 12.0f, + (s,cf,p,v) => { VehicleMaxAngularVelocity = cf.GetFloat(p, v); }, + (s) => { return (float)VehicleMaxAngularVelocity; }, + (s,p,l,v) => { VehicleMaxAngularVelocity = v; } ), new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", 0.95f, (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, -- cgit v1.1 From 3f6698a595593edc4027ff58cbebf947a6b5ac1f Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 21 Jan 2013 09:19:09 -0800 Subject: BulletSim: remove unused MaxTaintsToProcessPerStep parameter --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 6a92365..2b4488a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -236,11 +236,7 @@ public static class BSParam (s,cf,p,v) => { s.m_maxUpdatesPerFrame = cf.GetInt(p, (int)v); }, (s) => { return (float)s.m_maxUpdatesPerFrame; }, (s,p,l,v) => { s.m_maxUpdatesPerFrame = (int)v; } ), - new ParameterDefn("MaxTaintsToProcessPerStep", "Number of update taints to process before each simulation step", - 500f, - (s,cf,p,v) => { s.m_taintsToProcessPerStep = cf.GetInt(p, (int)v); }, - (s) => { return (float)s.m_taintsToProcessPerStep; }, - (s,p,l,v) => { s.m_taintsToProcessPerStep = (int)v; } ), + new ParameterDefn("MinObjectMass", "Minimum object mass (0.0001)", 0.0001f, (s,cf,p,v) => { MinimumObjectMass = cf.GetFloat(p, v); }, @@ -261,9 +257,9 @@ public static class BSParam (s,cf,p,v) => { MaxAngularVelocity = cf.GetFloat(p, v); }, (s) => { return (float)MaxAngularVelocity; }, (s,p,l,v) => { MaxAngularVelocity = v; } ), - // LL documentation says thie number should be 20f + // LL documentation says thie number should be 20f for llApplyImpulse and 200f for llRezObject new ParameterDefn("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)", - 200.0f, + 20000.0f, (s,cf,p,v) => { MaxAddForceMagnitude = cf.GetFloat(p, v); }, (s) => { return (float)MaxAddForceMagnitude; }, (s,p,l,v) => { MaxAddForceMagnitude = v; } ), -- cgit v1.1 From 80b1e32bfa00a2d3354f0d7e0df83a5b0b3e2c49 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 21 Jan 2013 23:43:24 -0800 Subject: BulletSim: Tweeks to vehicle motion. Pass through old angular velocity making for smoother transitions. Remove some old kludges for angular motion (damping and rotvel suppression). --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 2b4488a..da7438a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -450,7 +450,7 @@ public static class BSParam (s) => { return (float)VehicleMaxAngularVelocity; }, (s,p,l,v) => { VehicleMaxAngularVelocity = v; } ), new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", - 0.95f, + 0.0f, (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, (s) => { return VehicleAngularDamping; }, (s,p,l,v) => { VehicleAngularDamping = v; } ), -- cgit v1.1 From a5e9c665f08059fef16d0b0875697cb08e16351e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 23 Jan 2013 09:09:17 -0800 Subject: BulletSim: center-of-gravity linkset changes. Not working yet. Conflicts: OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index da7438a..9460daf 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -645,11 +645,8 @@ public static class BSParam entries.Add(new PhysParameterEntry(pd.name, pd.desc)); } - // make the list in alphabetical order for estetic reasons - entries.Sort(delegate(PhysParameterEntry ppe1, PhysParameterEntry ppe2) - { - return ppe1.name.CompareTo(ppe2.name); - }); + // make the list alphabetical for estetic reasons + entries.Sort((ppe1, ppe2) => { return ppe1.name.CompareTo(ppe2.name); }); SettableParameters = entries.ToArray(); } -- cgit v1.1 From 591faac3ac236ea676ebd2787d824abd9f30c2b6 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 24 Jan 2013 14:28:25 -0800 Subject: BulletSim: disable CCD (continuious collision detection) and contact processing threshold since the first didn't solve tunneling problems but used resources and the latter caused instabilities. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 9460daf..06186b0 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -334,7 +334,7 @@ public static class BSParam (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , - 0.3f, // set to zero to disable + 0.0f, // set to zero to disable (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, (s) => { return CcdMotionThreshold; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, @@ -345,8 +345,8 @@ public static class BSParam (s) => { return CcdSweptSphereRadius; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ), - new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" , - 0.1f, + new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" , + 0.0f, (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, (s) => { return ContactProcessingThreshold; }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); }, -- cgit v1.1 From dd08e1fba6e154002a7fe8f46c8c01e6e61d39db Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 25 Jan 2013 12:00:19 -0800 Subject: BulletSim: parameterize several vehicle debugging values: physical linear and angular force factors now default to less than 1 (0.2) vehicle friction and restitution now default to low values --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 45 +++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 06186b0..8de8905 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -82,9 +82,34 @@ public static class BSParam public static float AvatarStepApproachFactor { get; private set; } public static float AvatarStepForceFactor { get; private set; } + // Vehicle parameters public static float VehicleMaxLinearVelocity { get; private set; } public static float VehicleMaxAngularVelocity { get; private set; } public static float VehicleAngularDamping { get; private set; } + public static float VehicleFriction { get; private set; } + public static float VehicleRestitution { get; private set; } + public static float VehicleLinearFactor { get; private set; } + private static Vector3? vehicleLinearFactorV; + public static Vector3 VehicleLinearFactorV + { + get + { + if (!vehicleLinearFactorV.HasValue) + vehicleLinearFactorV = new Vector3(VehicleLinearFactor, VehicleLinearFactor, VehicleLinearFactor); + return (Vector3)vehicleLinearFactorV; + } + } + public static float VehicleAngularFactor { get; private set; } + private static Vector3? vehicleAngularFactorV; + public static Vector3 VehicleAngularFactorV + { + get + { + if (!vehicleAngularFactorV.HasValue) + vehicleAngularFactorV = new Vector3(VehicleAngularFactor, VehicleAngularFactor, VehicleAngularFactor); + return (Vector3)vehicleAngularFactorV; + } + } public static float VehicleDebuggingEnabled { get; private set; } public static float LinksetImplementation { get; private set; } @@ -454,6 +479,26 @@ public static class BSParam (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, (s) => { return VehicleAngularDamping; }, (s,p,l,v) => { VehicleAngularDamping = v; } ), + new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (0.0 - 1.0)", + 0.2f, + (s,cf,p,v) => { VehicleLinearFactor = cf.GetFloat(p, v); }, + (s) => { return VehicleLinearFactor; }, + (s,p,l,v) => { VehicleLinearFactor = v; } ), + new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (0.0 - 1.0)", + 0.2f, + (s,cf,p,v) => { VehicleAngularFactor = cf.GetFloat(p, v); }, + (s) => { return VehicleAngularFactor; }, + (s,p,l,v) => { VehicleAngularFactor = v; } ), + new ParameterDefn("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", + 0.0f, + (s,cf,p,v) => { VehicleFriction = cf.GetFloat(p, v); }, + (s) => { return VehicleFriction; }, + (s,p,l,v) => { VehicleFriction = v; } ), + new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", + 0.0f, + (s,cf,p,v) => { VehicleRestitution = cf.GetFloat(p, v); }, + (s) => { return VehicleRestitution; }, + (s,p,l,v) => { VehicleRestitution = v; } ), new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", ConfigurationParameters.numericFalse, (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, -- cgit v1.1 From 36f401d85011b0ffb548e79923381be894dbfabb Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 25 Jan 2013 16:52:16 -0800 Subject: BulletSim: parameterize the value for gravity reduction for ground vehicles on the ground. Set defaults for vehicle factors to one. Debug logging changes. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 8de8905..75eed86 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -110,6 +110,7 @@ public static class BSParam return (Vector3)vehicleAngularFactorV; } } + public static float VehicleGroundGravityFudge { get; private set; } public static float VehicleDebuggingEnabled { get; private set; } public static float LinksetImplementation { get; private set; } @@ -480,12 +481,12 @@ public static class BSParam (s) => { return VehicleAngularDamping; }, (s,p,l,v) => { VehicleAngularDamping = v; } ), new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (0.0 - 1.0)", - 0.2f, + 1.0f, (s,cf,p,v) => { VehicleLinearFactor = cf.GetFloat(p, v); }, (s) => { return VehicleLinearFactor; }, (s,p,l,v) => { VehicleLinearFactor = v; } ), new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (0.0 - 1.0)", - 0.2f, + 1.0f, (s,cf,p,v) => { VehicleAngularFactor = cf.GetFloat(p, v); }, (s) => { return VehicleAngularFactor; }, (s,p,l,v) => { VehicleAngularFactor = v; } ), @@ -495,10 +496,15 @@ public static class BSParam (s) => { return VehicleFriction; }, (s,p,l,v) => { VehicleFriction = v; } ), new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", - 0.0f, + 0.2f, (s,cf,p,v) => { VehicleRestitution = cf.GetFloat(p, v); }, (s) => { return VehicleRestitution; }, (s,p,l,v) => { VehicleRestitution = v; } ), + new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", + 1.0f, + (s,cf,p,v) => { VehicleGroundGravityFudge = cf.GetFloat(p, v); }, + (s) => { return VehicleGroundGravityFudge; }, + (s,p,l,v) => { VehicleGroundGravityFudge = v; } ), new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", ConfigurationParameters.numericFalse, (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, -- cgit v1.1 From b546af9ac290951f22e8c8e56798adb176076591 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 27 Jan 2013 12:48:36 -0800 Subject: BulletSim: simplify the initialization of some of the parameters. Disable vertical attraction for vehicles by default (for the moment). Fix bug where vehicle would go crazy when velocity got above a certain speed. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 36 +++++++------------------ 1 file changed, 10 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 75eed86..4ece944 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -84,32 +84,16 @@ public static class BSParam // Vehicle parameters public static float VehicleMaxLinearVelocity { get; private set; } + public static float VehicleMaxLinearVelocitySq { get; private set; } public static float VehicleMaxAngularVelocity { get; private set; } + public static float VehicleMaxAngularVelocitySq { get; private set; } public static float VehicleAngularDamping { get; private set; } public static float VehicleFriction { get; private set; } public static float VehicleRestitution { get; private set; } public static float VehicleLinearFactor { get; private set; } - private static Vector3? vehicleLinearFactorV; - public static Vector3 VehicleLinearFactorV - { - get - { - if (!vehicleLinearFactorV.HasValue) - vehicleLinearFactorV = new Vector3(VehicleLinearFactor, VehicleLinearFactor, VehicleLinearFactor); - return (Vector3)vehicleLinearFactorV; - } - } + public static Vector3 VehicleLinearFactorV { get; private set; } public static float VehicleAngularFactor { get; private set; } - private static Vector3? vehicleAngularFactorV; - public static Vector3 VehicleAngularFactorV - { - get - { - if (!vehicleAngularFactorV.HasValue) - vehicleAngularFactorV = new Vector3(VehicleAngularFactor, VehicleAngularFactor, VehicleAngularFactor); - return (Vector3)vehicleAngularFactorV; - } - } + public static Vector3 VehicleAngularFactorV { get; private set; } public static float VehicleGroundGravityFudge { get; private set; } public static float VehicleDebuggingEnabled { get; private set; } @@ -469,12 +453,12 @@ public static class BSParam 1000.0f, (s,cf,p,v) => { VehicleMaxLinearVelocity = cf.GetFloat(p, v); }, (s) => { return (float)VehicleMaxLinearVelocity; }, - (s,p,l,v) => { VehicleMaxLinearVelocity = v; } ), + (s,p,l,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySq = v * v; } ), new ParameterDefn("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", 12.0f, (s,cf,p,v) => { VehicleMaxAngularVelocity = cf.GetFloat(p, v); }, (s) => { return (float)VehicleMaxAngularVelocity; }, - (s,p,l,v) => { VehicleMaxAngularVelocity = v; } ), + (s,p,l,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ), new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", 0.0f, (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, @@ -484,24 +468,24 @@ public static class BSParam 1.0f, (s,cf,p,v) => { VehicleLinearFactor = cf.GetFloat(p, v); }, (s) => { return VehicleLinearFactor; }, - (s,p,l,v) => { VehicleLinearFactor = v; } ), + (s,p,l,v) => { VehicleLinearFactor = v; VehicleLinearFactorV = new Vector3(v, v, v); } ), new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (0.0 - 1.0)", 1.0f, (s,cf,p,v) => { VehicleAngularFactor = cf.GetFloat(p, v); }, (s) => { return VehicleAngularFactor; }, - (s,p,l,v) => { VehicleAngularFactor = v; } ), + (s,p,l,v) => { VehicleAngularFactor = v; VehicleAngularFactorV = new Vector3(v, v, v); } ), new ParameterDefn("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", 0.0f, (s,cf,p,v) => { VehicleFriction = cf.GetFloat(p, v); }, (s) => { return VehicleFriction; }, (s,p,l,v) => { VehicleFriction = v; } ), new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", - 0.2f, + 0.0f, (s,cf,p,v) => { VehicleRestitution = cf.GetFloat(p, v); }, (s) => { return VehicleRestitution; }, (s,p,l,v) => { VehicleRestitution = v; } ), new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", - 1.0f, + 0.2f, (s,cf,p,v) => { VehicleGroundGravityFudge = cf.GetFloat(p, v); }, (s) => { return VehicleGroundGravityFudge; }, (s,p,l,v) => { VehicleGroundGravityFudge = v; } ), -- cgit v1.1 From 47f09ed4c1d6a5d9763b6d1f5f86169e452281c8 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 28 Jan 2013 17:21:13 -0800 Subject: BulletSim: enable angular vertical attraction. Increase terrain collision margin to help vehicles from tunneling into same. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 4ece944..8c098b2 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -383,7 +383,7 @@ public static class BSParam (s) => { return TerrainRestitution; }, (s,p,l,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , - 0.04f, + 0.08f, (s,cf,p,v) => { TerrainCollisionMargin = cf.GetFloat(p, v); }, (s) => { return TerrainCollisionMargin; }, (s,p,l,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), -- cgit v1.1 From ad438ee59fce1b262135ef0f7cd1213f3a79df50 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 3 Feb 2013 16:08:09 -0800 Subject: BulletSim: rework some parameter setting implementation moving functionality that was in BSScene to BSParam. Remove unused parameters that were passed to the unmanaged code. Update DLLs and SOs for the new param block. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 131 ++++++++++++++---------- 1 file changed, 77 insertions(+), 54 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 8c098b2..fbef7e7 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -68,6 +68,24 @@ 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; + + // Physics Engine operation + public static float MaxPersistantManifoldPoolSize; + public static float MaxCollisionAlgorithmPoolSize; + public static float ShouldDisableContactPoolDynamicAllocation; + public static float ShouldForceUpdateAllAabbs; + public static float ShouldRandomizeSolverOrder; + public static float ShouldSplitSimulationIslands; + public static float ShouldEnableFrictionCaching; + public static float NumberOfSolverIterations; + public static bool UseSingleSidedMeshes { get { return UseSingleSidedMeshesF != ConfigurationParameters.numericFalse; } } + public static float UseSingleSidedMeshesF; + // Avatar parameters public static float AvatarFriction { get; private set; } public static float AvatarStandingFriction { get; private set; } @@ -287,29 +305,29 @@ public static class BSParam new ParameterDefn("DefaultFriction", "Friction factor used on new objects", 0.2f, - (s,cf,p,v) => { s.UnmanagedParams[0].defaultFriction = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].defaultFriction; }, - (s,p,l,v) => { s.UnmanagedParams[0].defaultFriction = v; } ), + (s,cf,p,v) => { DefaultFriction = cf.GetFloat(p, v); }, + (s) => { return DefaultFriction; }, + (s,p,l,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), new ParameterDefn("DefaultDensity", "Density for new objects" , 10.000006836f, // Aluminum g/cm3 - (s,cf,p,v) => { s.UnmanagedParams[0].defaultDensity = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].defaultDensity; }, - (s,p,l,v) => { s.UnmanagedParams[0].defaultDensity = v; } ), + (s,cf,p,v) => { DefaultDensity = cf.GetFloat(p, v); }, + (s) => { return DefaultDensity; }, + (s,p,l,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , 0f, - (s,cf,p,v) => { s.UnmanagedParams[0].defaultRestitution = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].defaultRestitution; }, - (s,p,l,v) => { s.UnmanagedParams[0].defaultRestitution = v; } ), + (s,cf,p,v) => { DefaultRestitution = cf.GetFloat(p, v); }, + (s) => { return DefaultRestitution; }, + (s,p,l,v) => { DefaultRestitution = v; s.UnmanagedParams[0].defaultRestitution = v; } ), new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", 0.04f, - (s,cf,p,v) => { s.UnmanagedParams[0].collisionMargin = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].collisionMargin; }, - (s,p,l,v) => { s.UnmanagedParams[0].collisionMargin = v; } ), + (s,cf,p,v) => { CollisionMargin = cf.GetFloat(p, v); }, + (s) => { return CollisionMargin; }, + (s,p,l,v) => { CollisionMargin = v; s.UnmanagedParams[0].collisionMargin = v; } ), new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", -9.80665f, - (s,cf,p,v) => { s.UnmanagedParams[0].gravity = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].gravity; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{s.UnmanagedParams[0].gravity=x;}, p, PhysParameterEntry.APPLY_TO_NONE, v); }, + (s,cf,p,v) => { Gravity = cf.GetFloat(p, v); }, + (s) => { return Gravity; }, + (s,p,l,v) => { Gravity = v; s.UnmanagedParams[0].gravity = v; }, (s,o,v) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,v)); } ), @@ -317,49 +335,49 @@ public static class BSParam 0f, (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, (s) => { return LinearDamping; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearDamping=x;}, p, l, v); }, + (s,p,l,v) => { LinearDamping = v; }, (s,o,v) => { s.PE.SetDamping(o.PhysBody, v, AngularDamping); } ), new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", 0f, (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, (s) => { return AngularDamping; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularDamping=x;}, p, l, v); }, + (s,p,l,v) => { AngularDamping = v; }, (s,o,v) => { s.PE.SetDamping(o.PhysBody, LinearDamping, v); } ), new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", 0.2f, (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, (s) => { return DeactivationTime; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{DeactivationTime=x;}, p, l, v); }, + (s,p,l,v) => { DeactivationTime = v; }, (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ), new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", 0.8f, (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, (s) => { return LinearSleepingThreshold; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearSleepingThreshold=x;}, p, l, v); }, + (s,p,l,v) => { LinearSleepingThreshold = v;}, (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", 1.0f, (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, (s) => { return AngularSleepingThreshold; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, + (s,p,l,v) => { AngularSleepingThreshold = v;}, (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , 0.0f, // set to zero to disable (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, (s) => { return CcdMotionThreshold; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, + (s,p,l,v) => { CcdMotionThreshold = v;}, (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , 0.2f, (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, (s) => { return CcdSweptSphereRadius; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, + (s,p,l,v) => { CcdSweptSphereRadius = v;}, (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ), new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" , 0.0f, (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, (s) => { return ContactProcessingThreshold; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); }, + (s,p,l,v) => { ContactProcessingThreshold = v;}, (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ), new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", @@ -392,7 +410,7 @@ public static class BSParam 0.2f, (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); }, (s) => { return AvatarFriction; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarFriction=x;}, p, l, v); } ), + (s,p,l,v) => { AvatarFriction = v; } ), new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", 10.0f, (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, @@ -407,32 +425,32 @@ public static class BSParam 3.5f, (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, (s) => { return AvatarDensity; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarDensity=x;}, p, l, v); } ), + (s,p,l,v) => { AvatarDensity = v; } ), new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 0f, (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); }, (s) => { return AvatarRestitution; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarRestitution=x;}, p, l, v); } ), + (s,p,l,v) => { AvatarRestitution = v; } ), new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", 0.6f, (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); }, (s) => { return AvatarCapsuleWidth; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleWidth=x;}, p, l, v); } ), + (s,p,l,v) => { AvatarCapsuleWidth = v; } ), new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", 0.45f, (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); }, (s) => { return AvatarCapsuleDepth; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleDepth=x;}, p, l, v); } ), + (s,p,l,v) => { AvatarCapsuleDepth = v; } ), new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", 1.5f, (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); }, (s) => { return AvatarCapsuleHeight; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleHeight=x;}, p, l, v); } ), + (s,p,l,v) => { AvatarCapsuleHeight = v; } ), new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 0.1f, (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, (s) => { return AvatarContactProcessingThreshold; }, - (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarContactProcessingThreshold=x;}, p, l, v); } ), + (s,p,l,v) => { AvatarContactProcessingThreshold = v; } ), new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", 0.3f, (s,cf,p,v) => { AvatarStepHeight = cf.GetFloat(p, v); }, @@ -497,44 +515,49 @@ public static class BSParam new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", 0f, - (s,cf,p,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].maxPersistantManifoldPoolSize; }, - (s,p,l,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), + (s,cf,p,v) => { MaxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, + (s) => { return MaxPersistantManifoldPoolSize; }, + (s,p,l,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", 0f, - (s,cf,p,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize; }, - (s,p,l,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), + (s,cf,p,v) => { MaxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, + (s) => { return MaxCollisionAlgorithmPoolSize; }, + (s,p,l,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", ConfigurationParameters.numericFalse, - (s,cf,p,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation; }, - (s,p,l,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), + (s,cf,p,v) => { ShouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return ShouldDisableContactPoolDynamicAllocation; }, + (s,p,l,v) => { ShouldDisableContactPoolDynamicAllocation = v; s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", ConfigurationParameters.numericFalse, - (s,cf,p,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return s.UnmanagedParams[0].shouldForceUpdateAllAabbs; }, - (s,p,l,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), + (s,cf,p,v) => { ShouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return ShouldForceUpdateAllAabbs; }, + (s,p,l,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", ConfigurationParameters.numericTrue, - (s,cf,p,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return s.UnmanagedParams[0].shouldRandomizeSolverOrder; }, - (s,p,l,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), + (s,cf,p,v) => { ShouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return ShouldRandomizeSolverOrder; }, + (s,p,l,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", ConfigurationParameters.numericTrue, - (s,cf,p,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, - (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), + (s,cf,p,v) => { ShouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return ShouldSplitSimulationIslands; }, + (s,p,l,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", ConfigurationParameters.numericTrue, - (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, - (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), + (s,cf,p,v) => { ShouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return ShouldEnableFrictionCaching; }, + (s,p,l,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", 0f, // zero says use Bullet default - (s,cf,p,v) => { s.UnmanagedParams[0].numberOfSolverIterations = cf.GetFloat(p, v); }, - (s) => { return s.UnmanagedParams[0].numberOfSolverIterations; }, - (s,p,l,v) => { s.UnmanagedParams[0].numberOfSolverIterations = v; } ), + (s,cf,p,v) => { NumberOfSolverIterations = cf.GetFloat(p, v); }, + (s) => { return NumberOfSolverIterations; }, + (s,p,l,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ), + new ParameterDefn("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.", + ConfigurationParameters.numericTrue, + (s,cf,p,v) => { UseSingleSidedMeshesF = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s) => { return UseSingleSidedMeshesF; }, + (s,p,l,v) => { UseSingleSidedMeshesF = v; s.UnmanagedParams[0].useSingleSidedMeshes = v; } ), new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", (float)BSLinkset.LinksetImplementation.Compound, -- cgit v1.1 From dce9e323f4f0fdccd2f34266e870de9cbcebd2f0 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 5 Feb 2013 16:51:02 -0800 Subject: BulletSim: remove degenerate triangles from meshes. This fixes the invisible barriers in sculptie doorways (Mantis 6529). Bump up level-of-detail for physical meshes to 32 (the max). This fixes the invisible barriers that showed up in prim cut arches. NOTE: the default LOD values are removed from OpenSimDefaults.ini. If you don't change your OpenSimDefaults.ini, you will continue to see the arch problem. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index fbef7e7..bdd9ce4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -39,6 +39,7 @@ public static class BSParam { // Level of Detail values kept as float because that's what the Meshmerizer wants public static float MeshLOD { get; private set; } + public static float MeshCircularLOD { get; private set; } public static float MeshMegaPrimLOD { get; private set; } public static float MeshMegaPrimThreshold { get; private set; } public static float SculptLOD { get; private set; } @@ -219,20 +220,25 @@ public static class BSParam (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", - 8f, + 32f, (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); }, (s) => { return MeshLOD; }, (s,p,l,v) => { MeshLOD = v; } ), - new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", - 16f, - (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); }, - (s) => { return MeshMegaPrimLOD; }, - (s,p,l,v) => { MeshMegaPrimLOD = v; } ), + new ParameterDefn("MeshLevelOfDetailCircular", "Level of detail for prims with circular cuts or shapes", + 32f, + (s,cf,p,v) => { MeshCircularLOD = (float)cf.GetInt(p, (int)v); }, + (s) => { return MeshCircularLOD; }, + (s,p,l,v) => { MeshCircularLOD = v; } ), new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", 10f, (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); }, (s) => { return MeshMegaPrimThreshold; }, (s,p,l,v) => { MeshMegaPrimThreshold = v; } ), + new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", + 32f, + (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); }, + (s) => { return MeshMegaPrimLOD; }, + (s,p,l,v) => { MeshMegaPrimLOD = v; } ), new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", 32f, (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); }, -- cgit v1.1 From 36463612794f95776e8ddea14333827cbce35eff Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 5 Feb 2013 17:19:55 -0800 Subject: BulletSim: make removing zero width triangles from meshes optional and, for the moment, default to 'off'. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index bdd9ce4..306928a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -62,6 +62,7 @@ public static class BSParam public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects + public static bool ShouldRemoveZeroWidthTriangles { get; private set; } public static float TerrainImplementation { get; private set; } public static float TerrainFriction { get; private set; } @@ -218,6 +219,11 @@ public static class BSParam (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), + new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", + ConfigurationParameters.numericFalse, + (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, + (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); }, + (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ), new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", 32f, -- cgit v1.1 From d2ece00e68c070bf9ffbda3f76e4eccf3c33545f Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 6 Feb 2013 15:59:59 -0800 Subject: BulletSim: set removing zero width triangles in meshes to be enabled by default. This should fix the invisible barrier in sculptie doorways bug. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 306928a..965c382 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -220,7 +220,7 @@ public static class BSParam (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", - ConfigurationParameters.numericFalse, + ConfigurationParameters.numericTrue, (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); }, (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ), -- cgit v1.1 From af73ea909cad78eee78bd4e9d9e3a42cf8856263 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 6 Feb 2013 22:34:03 -0800 Subject: Change passed PhysicsParameter value from float to the more general string value --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 34 ++++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 965c382..601c78c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -641,24 +641,6 @@ public static class BSParam return (b == ConfigurationParameters.numericTrue ? true : false); } - private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) - { - BSScene physScene = pPhysScene; - physScene.TaintedObject("BSParam.ResetBroadphasePoolTainted", delegate() - { - physScene.PE.ResetBroadphasePool(physScene.World); - }); - } - - private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v) - { - BSScene physScene = pPhysScene; - physScene.TaintedObject("BSParam.ResetConstraintSolver", delegate() - { - physScene.PE.ResetConstraintSolver(physScene.World); - }); - } - // Search through the parameter definitions and return the matching // ParameterDefn structure. // Case does not matter as names are compared after converting to lower case. @@ -722,6 +704,22 @@ public static class BSParam } } + private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) + { + BSScene physScene = pPhysScene; + physScene.TaintedObject("BSParam.ResetBroadphasePoolTainted", delegate() + { + physScene.PE.ResetBroadphasePool(physScene.World); + }); + } + private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v) + { + BSScene physScene = pPhysScene; + physScene.TaintedObject("BSParam.ResetConstraintSolver", delegate() + { + physScene.PE.ResetConstraintSolver(physScene.World); + }); + } } } -- cgit v1.1 From 222040f1ec0d85b06de8271fd7eabc7dd0a2f7d4 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 8 Feb 2013 15:36:10 -0800 Subject: BulletSim: Change BSCharacter to use new base Density and Friction variables rather than own local varaibles. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 601c78c..6cb7434 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -424,7 +424,7 @@ public static class BSParam (s) => { return AvatarFriction; }, (s,p,l,v) => { AvatarFriction = v; } ), new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", - 10.0f, + 0.95f, (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, (s) => { return AvatarStandingFriction; }, (s,p,l,v) => { AvatarStandingFriction = v; } ), -- cgit v1.1 From 4808b8ee380d32c1b63654f9c0170a5f07b46bd0 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 8 Feb 2013 16:27:44 -0800 Subject: BulletSim: add parameter to set global contact breaking threshold. Update DLLs and SOs for setting same. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 6cb7434..3e0b4bc 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -87,6 +87,7 @@ public static class BSParam public static float NumberOfSolverIterations; public static bool UseSingleSidedMeshes { get { return UseSingleSidedMeshesF != ConfigurationParameters.numericFalse; } } public static float UseSingleSidedMeshesF; + public static float GlobalContactBreakingThreshold; // Avatar parameters public static float AvatarFriction { get; private set; } @@ -570,6 +571,11 @@ public static class BSParam (s,cf,p,v) => { UseSingleSidedMeshesF = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, (s) => { return UseSingleSidedMeshesF; }, (s,p,l,v) => { UseSingleSidedMeshesF = v; s.UnmanagedParams[0].useSingleSidedMeshes = v; } ), + new ParameterDefn("GlobalContactBreakingThreshold", "Amount of shape radius before breaking a collision contact (0 says Bullet default (0.2))", + 0f, + (s,cf,p,v) => { GlobalContactBreakingThreshold = cf.GetFloat(p, v); }, + (s) => { return GlobalContactBreakingThreshold; }, + (s,p,l,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", (float)BSLinkset.LinksetImplementation.Compound, -- cgit v1.1 From 0194a3d890b95c8a29fcdf130c378e3a8a629c77 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 12 Feb 2013 15:45:44 -0800 Subject: BulletSim: fix density since the simulator/viewer track density in a funny unit that is 100 times real density (default 1000). Fix avatar drifting slowly when stationary flying. Fix for physical prims getting corrected for being under terrain when it was just its geometric center that was below terrain. Add PreUpdatePropertyAction allowing plugable modifiction of phys parameters returned from Bullet. Fix an exception setting GravityMultiplier on initialization. Update DLLs and SOs for good measure (no functional change). --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 3e0b4bc..329169f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -49,6 +49,7 @@ public static class BSParam public static float MaxLinearVelocity { get; private set; } public static float MaxAngularVelocity { get; private set; } public static float MaxAddForceMagnitude { get; private set; } + public static float DensityScaleFactor { get; private set; } public static float LinearDamping { get; private set; } public static float AngularDamping { get; private set; } @@ -281,29 +282,35 @@ public static class BSParam new ParameterDefn("MinObjectMass", "Minimum object mass (0.0001)", 0.0001f, (s,cf,p,v) => { MinimumObjectMass = cf.GetFloat(p, v); }, - (s) => { return (float)MinimumObjectMass; }, + (s) => { return MinimumObjectMass; }, (s,p,l,v) => { MinimumObjectMass = v; } ), new ParameterDefn("MaxObjectMass", "Maximum object mass (10000.01)", 10000.01f, (s,cf,p,v) => { MaximumObjectMass = cf.GetFloat(p, v); }, - (s) => { return (float)MaximumObjectMass; }, + (s) => { return MaximumObjectMass; }, (s,p,l,v) => { MaximumObjectMass = v; } ), new ParameterDefn("MaxLinearVelocity", "Maximum velocity magnitude that can be assigned to an object", 1000.0f, (s,cf,p,v) => { MaxLinearVelocity = cf.GetFloat(p, v); }, - (s) => { return (float)MaxLinearVelocity; }, + (s) => { return MaxLinearVelocity; }, (s,p,l,v) => { MaxLinearVelocity = v; } ), new ParameterDefn("MaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to an object", 1000.0f, (s,cf,p,v) => { MaxAngularVelocity = cf.GetFloat(p, v); }, - (s) => { return (float)MaxAngularVelocity; }, + (s) => { return MaxAngularVelocity; }, (s,p,l,v) => { MaxAngularVelocity = v; } ), // LL documentation says thie number should be 20f for llApplyImpulse and 200f for llRezObject new ParameterDefn("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)", 20000.0f, (s,cf,p,v) => { MaxAddForceMagnitude = cf.GetFloat(p, v); }, - (s) => { return (float)MaxAddForceMagnitude; }, + (s) => { return MaxAddForceMagnitude; }, (s,p,l,v) => { MaxAddForceMagnitude = v; } ), + // Density is passed around as 100kg/m3. This scales that to 1kg/m3. + new ParameterDefn("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", + 0.01f, + (s,cf,p,v) => { DensityScaleFactor = cf.GetFloat(p, v); }, + (s) => { return DensityScaleFactor; }, + (s,p,l,v) => { DensityScaleFactor = v; } ), new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", 2200f, -- cgit v1.1 From 885b45b112607e3edf12838cf01cfefa6da884ae Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 16 Feb 2013 22:14:38 -0800 Subject: BulletSim: rework parameter setting for different types of values (like vectors or quaternions). --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 674 ++++++++++++------------ 1 file changed, 326 insertions(+), 348 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 329169f..c2a9671 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -37,6 +37,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin { public static class BSParam { + private static string LogHeader = "[BULLETSIM PARAMETERS]"; + // Level of Detail values kept as float because that's what the Meshmerizer wants public static float MeshLOD { get; private set; } public static float MeshCircularLOD { get; private set; } @@ -80,14 +82,13 @@ public static class BSParam // Physics Engine operation public static float MaxPersistantManifoldPoolSize; public static float MaxCollisionAlgorithmPoolSize; - public static float ShouldDisableContactPoolDynamicAllocation; - public static float ShouldForceUpdateAllAabbs; - public static float ShouldRandomizeSolverOrder; - public static float ShouldSplitSimulationIslands; - public static float ShouldEnableFrictionCaching; + 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 { get { return UseSingleSidedMeshesF != ConfigurationParameters.numericFalse; } } - public static float UseSingleSidedMeshesF; + public static bool UseSingleSidedMeshes; public static float GlobalContactBreakingThreshold; // Avatar parameters @@ -112,16 +113,14 @@ public static class BSParam public static float VehicleAngularDamping { get; private set; } public static float VehicleFriction { get; private set; } public static float VehicleRestitution { get; private set; } - public static float VehicleLinearFactor { get; private set; } - public static Vector3 VehicleLinearFactorV { get; private set; } - public static float VehicleAngularFactor { get; private set; } - public static Vector3 VehicleAngularFactorV { get; private set; } + public static Vector3 VehicleLinearFactor { get; private set; } + public static Vector3 VehicleAngularFactor { get; private set; } public static float VehicleGroundGravityFudge { get; private set; } - public static float VehicleDebuggingEnabled { get; private set; } + public static bool VehicleDebuggingEnabled { get; private set; } public static float LinksetImplementation { get; private set; } - public static float LinkConstraintUseFrameOffset { get; private set; } - public static float LinkConstraintEnableTransMotor { get; private set; } + public static bool LinkConstraintUseFrameOffset { get; private set; } + public static bool LinkConstraintEnableTransMotor { get; private set; } public static float LinkConstraintTransMotorMaxVel { get; private set; } public static float LinkConstraintTransMotorMaxForce { get; private set; } public static float LinkConstraintERP { get; private set; } @@ -141,40 +140,106 @@ public static class BSParam public const float MinRestitution = 0f; public const float MaxRestitution = 1f; - // =========================================================================== - 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); - public delegate void SetOnObject(BSScene scene, BSPhysObject obj, float val); + // ===================================================================================== + // ===================================================================================== - public struct ParameterDefn + // Base parameter definition that gets and sets parameter values via a string + public abstract class ParameterDefnBase { public string name; // string name of the parameter public string desc; // a short description of what the parameter means - public float defaultValue; // default value if not specified anywhere else - public ParamUser userParam; // get the value from the configuration file - public ParamGet getter; // return the current value stored for this parameter - public ParamSet setter; // set the current value for this parameter - public SetOnObject onObject; // set the value on an object in the physical domain - public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s) + public ParameterDefnBase(string pName, string pDesc) + { + name = pName; + desc = pDesc; + } + // Set the parameter value to the default + public abstract void AssignDefault(BSScene s); + // Get the value as a string + public abstract string GetValue(BSScene s); + // Set the value to this string value + public abstract void SetValue(BSScene s, string valAsString); + // set the value on a particular object (usually sets in physics engine) + public abstract void SetOnObject(BSScene s, BSPhysObject obj); + public abstract bool HasSetOnObject { get; } + } + + // Specific parameter definition for a parameter of a specific type. + public delegate T PGetValue(BSScene s); + public delegate void PSetValue(BSScene s, T val); + public delegate void PSetOnObject(BSScene scene, BSPhysObject obj); + public sealed class ParameterDefn : ParameterDefnBase + { + T defaultValue; + PSetValue setter; + PGetValue getter; + PSetOnObject objectSet; + public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue pGetter, PSetValue pSetter) + : base(pName, pDesc) + { + defaultValue = pDefault; + setter = pSetter; + getter = pGetter; + objectSet = null; + } + public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue pGetter, PSetValue pSetter, PSetOnObject pObjSetter) + : base(pName, pDesc) + { + defaultValue = pDefault; + setter = pSetter; + getter = pGetter; + objectSet = pObjSetter; + } + public override void AssignDefault(BSScene s) + { + setter(s, defaultValue); + } + public override string GetValue(BSScene s) + { + return String.Format("{0}", getter(s)); + } + public override void SetValue(BSScene s, string valAsString) { - name = n; - desc = d; - defaultValue = v; - userParam = u; - getter = g; - setter = s; - onObject = null; + // Get the generic type of the setter + Type genericType = setter.GetType().GetGenericArguments()[0]; + // Find the 'Parse' method on that type + System.Reflection.MethodInfo parser = null; + try + { + parser = genericType.GetMethod("Parse", new Type[] { typeof(String) } ); + } + catch (Exception e) + { + s.Logger.ErrorFormat("{0} Exception getting parser for type '{1}': {2}", LogHeader, genericType, e); + parser = null; + } + if (parser != null) + { + // Parse the input string + try + { + T setValue = (T)parser.Invoke(genericType, new Object[] { valAsString }); + setter(s, setValue); + // s.Logger.DebugFormat("{0} Parameter {1} = {2}", LogHeader, name, setValue); + } + catch + { + s.Logger.ErrorFormat("{0} Failed parsing parameter value '{1}' as type '{2}'", LogHeader, valAsString, genericType); + } + } + else + { + s.Logger.ErrorFormat("{0} Could not find parameter parser for type '{1}'", LogHeader, genericType); + } + } + public override bool HasSetOnObject + { + get { return objectSet != null; } } - public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s, SetOnObject o) + public override void SetOnObject(BSScene s, BSPhysObject obj) { - name = n; - desc = d; - defaultValue = v; - userParam = u; - getter = g; - setter = s; - onObject = o; + if (objectSet != null) + objectSet(s, obj); } } @@ -184,462 +249,375 @@ public static class BSParam // location somewhere in the program and make an entry in this table with the // getters and setters. // It is easiest to find an existing definition and copy it. - // Parameter values are floats. Booleans are converted to a floating value. // - // A ParameterDefn() takes the following parameters: + // A ParameterDefn() takes the following parameters: // -- the text name of the parameter. This is used for console input and ini file. // -- a short text description of the parameter. This shows up in the console listing. - // -- a default value (float) - // -- a delegate for fetching the parameter from the ini file. - // Should handle fetching the right type from the ini file and converting it. - // -- a delegate for getting the value as a float - // -- a delegate for setting the value from a float + // -- a default value + // -- a delegate for getting the value + // -- a delegate for setting the value // -- an optional delegate to update the value in the world. Most often used to // push the new value to an in-world object. // // The single letter parameters for the delegates are: // s = BSScene // o = BSPhysObject - // p = string parameter name - // l = localID of referenced object // v = value (float) - // cf = parameter configuration class (for fetching values from ini file) - private static ParameterDefn[] ParameterDefinitions = + private static ParameterDefnBase[] ParameterDefinitions = { - new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { ShouldMeshSculptedPrim = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, - (s) => { return BSParam.NumericBool(ShouldMeshSculptedPrim); }, - (s,p,l,v) => { ShouldMeshSculptedPrim = BSParam.BoolNumeric(v); } ), - new ParameterDefn("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects", - ConfigurationParameters.numericFalse, - (s,cf,p,v) => { ShouldForceSimplePrimMeshing = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, - (s) => { return BSParam.NumericBool(ShouldForceSimplePrimMeshing); }, - (s,p,l,v) => { ShouldForceSimplePrimMeshing = BSParam.BoolNumeric(v); } ), - new ParameterDefn("UseHullsForPhysicalObjects", "If true, create hulls for physical objects", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, - (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, - (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), - new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, - (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); }, - (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ), - - new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", + new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", + true, + (s) => { return ShouldMeshSculptedPrim; }, + (s,v) => { ShouldMeshSculptedPrim = v; } ), + new ParameterDefn("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects", + false, + (s) => { return ShouldForceSimplePrimMeshing; }, + (s,v) => { ShouldForceSimplePrimMeshing = v; } ), + new ParameterDefn("UseHullsForPhysicalObjects", "If true, create hulls for physical objects", + true, + (s) => { return ShouldUseHullsForPhysicalObjects; }, + (s,v) => { ShouldUseHullsForPhysicalObjects = v; } ), + new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", + true, + (s) => { return ShouldRemoveZeroWidthTriangles; }, + (s,v) => { ShouldRemoveZeroWidthTriangles = v; } ), + + new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", 32f, - (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); }, (s) => { return MeshLOD; }, - (s,p,l,v) => { MeshLOD = v; } ), - new ParameterDefn("MeshLevelOfDetailCircular", "Level of detail for prims with circular cuts or shapes", + (s,v) => { MeshLOD = v; } ), + new ParameterDefn("MeshLevelOfDetailCircular", "Level of detail for prims with circular cuts or shapes", 32f, - (s,cf,p,v) => { MeshCircularLOD = (float)cf.GetInt(p, (int)v); }, (s) => { return MeshCircularLOD; }, - (s,p,l,v) => { MeshCircularLOD = v; } ), - new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", + (s,v) => { MeshCircularLOD = v; } ), + new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", 10f, - (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); }, (s) => { return MeshMegaPrimThreshold; }, - (s,p,l,v) => { MeshMegaPrimThreshold = v; } ), - new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", + (s,v) => { MeshMegaPrimThreshold = v; } ), + new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", 32f, - (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); }, (s) => { return MeshMegaPrimLOD; }, - (s,p,l,v) => { MeshMegaPrimLOD = v; } ), - new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", + (s,v) => { MeshMegaPrimLOD = v; } ), + new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", 32f, - (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); }, (s) => { return SculptLOD; }, - (s,p,l,v) => { SculptLOD = v; } ), + (s,v) => { SculptLOD = v; } ), - new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps", - 10f, - (s,cf,p,v) => { s.m_maxSubSteps = cf.GetInt(p, (int)v); }, - (s) => { return (float)s.m_maxSubSteps; }, - (s,p,l,v) => { s.m_maxSubSteps = (int)v; } ), - new ParameterDefn("FixedTimeStep", "In simulation step, seconds of one substep (1/60)", + new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps", + 10, + (s) => { return s.m_maxSubSteps; }, + (s,v) => { s.m_maxSubSteps = (int)v; } ), + new ParameterDefn("FixedTimeStep", "In simulation step, seconds of one substep (1/60)", 1f / 60f, - (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); }, - (s) => { return (float)s.m_fixedTimeStep; }, - (s,p,l,v) => { s.m_fixedTimeStep = v; } ), - new ParameterDefn("NominalFrameRate", "The base frame rate we claim", + (s) => { return s.m_fixedTimeStep; }, + (s,v) => { s.m_fixedTimeStep = v; } ), + new ParameterDefn("NominalFrameRate", "The base frame rate we claim", 55f, - (s,cf,p,v) => { s.NominalFrameRate = cf.GetInt(p, (int)v); }, - (s) => { return (float)s.NominalFrameRate; }, - (s,p,l,v) => { s.NominalFrameRate = (int)v; } ), - new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", - 2048f, - (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); }, - (s) => { return (float)s.m_maxCollisionsPerFrame; }, - (s,p,l,v) => { s.m_maxCollisionsPerFrame = (int)v; } ), - new ParameterDefn("MaxUpdatesPerFrame", "Max updates returned at end of each frame", - 8000f, - (s,cf,p,v) => { s.m_maxUpdatesPerFrame = cf.GetInt(p, (int)v); }, - (s) => { return (float)s.m_maxUpdatesPerFrame; }, - (s,p,l,v) => { s.m_maxUpdatesPerFrame = (int)v; } ), - - new ParameterDefn("MinObjectMass", "Minimum object mass (0.0001)", + (s) => { return s.NominalFrameRate; }, + (s,v) => { s.NominalFrameRate = (int)v; } ), + new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", + 2048, + (s) => { return s.m_maxCollisionsPerFrame; }, + (s,v) => { s.m_maxCollisionsPerFrame = (int)v; } ), + new ParameterDefn("MaxUpdatesPerFrame", "Max updates returned at end of each frame", + 8000, + (s) => { return s.m_maxUpdatesPerFrame; }, + (s,v) => { s.m_maxUpdatesPerFrame = (int)v; } ), + + new ParameterDefn("MinObjectMass", "Minimum object mass (0.0001)", 0.0001f, - (s,cf,p,v) => { MinimumObjectMass = cf.GetFloat(p, v); }, (s) => { return MinimumObjectMass; }, - (s,p,l,v) => { MinimumObjectMass = v; } ), - new ParameterDefn("MaxObjectMass", "Maximum object mass (10000.01)", + (s,v) => { MinimumObjectMass = v; } ), + new ParameterDefn("MaxObjectMass", "Maximum object mass (10000.01)", 10000.01f, - (s,cf,p,v) => { MaximumObjectMass = cf.GetFloat(p, v); }, (s) => { return MaximumObjectMass; }, - (s,p,l,v) => { MaximumObjectMass = v; } ), - new ParameterDefn("MaxLinearVelocity", "Maximum velocity magnitude that can be assigned to an object", + (s,v) => { MaximumObjectMass = v; } ), + new ParameterDefn("MaxLinearVelocity", "Maximum velocity magnitude that can be assigned to an object", 1000.0f, - (s,cf,p,v) => { MaxLinearVelocity = cf.GetFloat(p, v); }, (s) => { return MaxLinearVelocity; }, - (s,p,l,v) => { MaxLinearVelocity = v; } ), - new ParameterDefn("MaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to an object", + (s,v) => { MaxLinearVelocity = v; } ), + new ParameterDefn("MaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to an object", 1000.0f, - (s,cf,p,v) => { MaxAngularVelocity = cf.GetFloat(p, v); }, (s) => { return MaxAngularVelocity; }, - (s,p,l,v) => { MaxAngularVelocity = v; } ), + (s,v) => { MaxAngularVelocity = v; } ), // LL documentation says thie number should be 20f for llApplyImpulse and 200f for llRezObject - new ParameterDefn("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)", + new ParameterDefn("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)", 20000.0f, - (s,cf,p,v) => { MaxAddForceMagnitude = cf.GetFloat(p, v); }, (s) => { return MaxAddForceMagnitude; }, - (s,p,l,v) => { MaxAddForceMagnitude = v; } ), + (s,v) => { MaxAddForceMagnitude = v; } ), // Density is passed around as 100kg/m3. This scales that to 1kg/m3. - new ParameterDefn("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", + new ParameterDefn("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", 0.01f, - (s,cf,p,v) => { DensityScaleFactor = cf.GetFloat(p, v); }, (s) => { return DensityScaleFactor; }, - (s,p,l,v) => { DensityScaleFactor = v; } ), + (s,v) => { DensityScaleFactor = v; } ), - new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", + new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", 2200f, - (s,cf,p,v) => { PID_D = cf.GetFloat(p, v); }, (s) => { return (float)PID_D; }, - (s,p,l,v) => { PID_D = v; } ), - new ParameterDefn("PID_P", "Parameteric factor for motion smoothing", + (s,v) => { PID_D = v; } ), + new ParameterDefn("PID_P", "Parameteric factor for motion smoothing", 900f, - (s,cf,p,v) => { PID_P = cf.GetFloat(p, v); }, (s) => { return (float)PID_P; }, - (s,p,l,v) => { PID_P = v; } ), + (s,v) => { PID_P = v; } ), - new ParameterDefn("DefaultFriction", "Friction factor used on new objects", + new ParameterDefn("DefaultFriction", "Friction factor used on new objects", 0.2f, - (s,cf,p,v) => { DefaultFriction = cf.GetFloat(p, v); }, (s) => { return DefaultFriction; }, - (s,p,l,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), - new ParameterDefn("DefaultDensity", "Density for new objects" , + (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), + new ParameterDefn("DefaultDensity", "Density for new objects" , 10.000006836f, // Aluminum g/cm3 - (s,cf,p,v) => { DefaultDensity = cf.GetFloat(p, v); }, (s) => { return DefaultDensity; }, - (s,p,l,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), - new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , + (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), + new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , 0f, - (s,cf,p,v) => { DefaultRestitution = cf.GetFloat(p, v); }, (s) => { return DefaultRestitution; }, - (s,p,l,v) => { DefaultRestitution = v; s.UnmanagedParams[0].defaultRestitution = v; } ), - new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", + (s,v) => { DefaultRestitution = v; s.UnmanagedParams[0].defaultRestitution = v; } ), + new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", 0.04f, - (s,cf,p,v) => { CollisionMargin = cf.GetFloat(p, v); }, (s) => { return CollisionMargin; }, - (s,p,l,v) => { CollisionMargin = v; s.UnmanagedParams[0].collisionMargin = v; } ), - new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", + (s,v) => { CollisionMargin = v; s.UnmanagedParams[0].collisionMargin = v; } ), + new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", -9.80665f, - (s,cf,p,v) => { Gravity = cf.GetFloat(p, v); }, (s) => { return Gravity; }, - (s,p,l,v) => { Gravity = v; s.UnmanagedParams[0].gravity = v; }, - (s,o,v) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,v)); } ), + (s,v) => { Gravity = v; s.UnmanagedParams[0].gravity = v; }, + (s,o) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,Gravity)); } ), - new ParameterDefn("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", + new ParameterDefn("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", 0f, - (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, (s) => { return LinearDamping; }, - (s,p,l,v) => { LinearDamping = v; }, - (s,o,v) => { s.PE.SetDamping(o.PhysBody, v, AngularDamping); } ), - new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", + (s,v) => { LinearDamping = v; }, + (s,o) => { s.PE.SetDamping(o.PhysBody, LinearDamping, AngularDamping); } ), + new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", 0f, - (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, (s) => { return AngularDamping; }, - (s,p,l,v) => { AngularDamping = v; }, - (s,o,v) => { s.PE.SetDamping(o.PhysBody, LinearDamping, v); } ), - new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", + (s,v) => { AngularDamping = v; }, + (s,o) => { s.PE.SetDamping(o.PhysBody, LinearDamping, AngularDamping); } ), + new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", 0.2f, - (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, (s) => { return DeactivationTime; }, - (s,p,l,v) => { DeactivationTime = v; }, - (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ), - new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", + (s,v) => { DeactivationTime = v; }, + (s,o) => { s.PE.SetDeactivationTime(o.PhysBody, DeactivationTime); } ), + new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", 0.8f, - (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, (s) => { return LinearSleepingThreshold; }, - (s,p,l,v) => { LinearSleepingThreshold = v;}, - (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), - new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", + (s,v) => { LinearSleepingThreshold = v;}, + (s,o) => { s.PE.SetSleepingThresholds(o.PhysBody, LinearSleepingThreshold, AngularSleepingThreshold); } ), + new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", 1.0f, - (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, (s) => { return AngularSleepingThreshold; }, - (s,p,l,v) => { AngularSleepingThreshold = v;}, - (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), - new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , + (s,v) => { AngularSleepingThreshold = v;}, + (s,o) => { s.PE.SetSleepingThresholds(o.PhysBody, LinearSleepingThreshold, AngularSleepingThreshold); } ), + new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , 0.0f, // set to zero to disable - (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, (s) => { return CcdMotionThreshold; }, - (s,p,l,v) => { CcdMotionThreshold = v;}, - (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), - new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , + (s,v) => { CcdMotionThreshold = v;}, + (s,o) => { s.PE.SetCcdMotionThreshold(o.PhysBody, CcdMotionThreshold); } ), + new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , 0.2f, - (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, (s) => { return CcdSweptSphereRadius; }, - (s,p,l,v) => { CcdSweptSphereRadius = v;}, - (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ), - new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" , + (s,v) => { CcdSweptSphereRadius = v;}, + (s,o) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, CcdSweptSphereRadius); } ), + new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" , 0.0f, - (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, (s) => { return ContactProcessingThreshold; }, - (s,p,l,v) => { ContactProcessingThreshold = v;}, - (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ), + (s,v) => { ContactProcessingThreshold = v;}, + (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), - new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", + new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", (float)BSTerrainPhys.TerrainImplementation.Mesh, - (s,cf,p,v) => { TerrainImplementation = cf.GetFloat(p,v); }, (s) => { return TerrainImplementation; }, - (s,p,l,v) => { TerrainImplementation = v; } ), - new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , + (s,v) => { TerrainImplementation = v; } ), + new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , 0.3f, - (s,cf,p,v) => { TerrainFriction = cf.GetFloat(p, v); }, (s) => { return TerrainFriction; }, - (s,p,l,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), - new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , + (s,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), + new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , 0.8f, - (s,cf,p,v) => { TerrainHitFraction = cf.GetFloat(p, v); }, (s) => { return TerrainHitFraction; }, - (s,p,l,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), - new ParameterDefn("TerrainRestitution", "Bouncyness" , + (s,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), + new ParameterDefn("TerrainRestitution", "Bouncyness" , 0f, - (s,cf,p,v) => { TerrainRestitution = cf.GetFloat(p, v); }, (s) => { return TerrainRestitution; }, - (s,p,l,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), - new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , + (s,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), + new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , 0.08f, - (s,cf,p,v) => { TerrainCollisionMargin = cf.GetFloat(p, v); }, (s) => { return TerrainCollisionMargin; }, - (s,p,l,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), + (s,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), - new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", + new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", 0.2f, - (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); }, (s) => { return AvatarFriction; }, - (s,p,l,v) => { AvatarFriction = v; } ), - new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", + (s,v) => { AvatarFriction = v; } ), + new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", 0.95f, - (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, (s) => { return AvatarStandingFriction; }, - (s,p,l,v) => { AvatarStandingFriction = v; } ), - new ParameterDefn("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", + (s,v) => { AvatarStandingFriction = v; } ), + new ParameterDefn("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", 1.3f, - (s,cf,p,v) => { AvatarAlwaysRunFactor = cf.GetFloat(p, v); }, (s) => { return AvatarAlwaysRunFactor; }, - (s,p,l,v) => { AvatarAlwaysRunFactor = v; } ), - new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", + (s,v) => { AvatarAlwaysRunFactor = v; } ), + new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", 3.5f, - (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, (s) => { return AvatarDensity; }, - (s,p,l,v) => { AvatarDensity = v; } ), - new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", + (s,v) => { AvatarDensity = v; } ), + new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 0f, - (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); }, (s) => { return AvatarRestitution; }, - (s,p,l,v) => { AvatarRestitution = v; } ), - new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", + (s,v) => { AvatarRestitution = v; } ), + new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", 0.6f, - (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); }, (s) => { return AvatarCapsuleWidth; }, - (s,p,l,v) => { AvatarCapsuleWidth = v; } ), - new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", + (s,v) => { AvatarCapsuleWidth = v; } ), + new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", 0.45f, - (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); }, (s) => { return AvatarCapsuleDepth; }, - (s,p,l,v) => { AvatarCapsuleDepth = v; } ), - new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", + (s,v) => { AvatarCapsuleDepth = v; } ), + new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", 1.5f, - (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); }, (s) => { return AvatarCapsuleHeight; }, - (s,p,l,v) => { AvatarCapsuleHeight = v; } ), - new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", + (s,v) => { AvatarCapsuleHeight = v; } ), + new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 0.1f, - (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, (s) => { return AvatarContactProcessingThreshold; }, - (s,p,l,v) => { AvatarContactProcessingThreshold = v; } ), - new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", + (s,v) => { AvatarContactProcessingThreshold = v; } ), + new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", 0.3f, - (s,cf,p,v) => { AvatarStepHeight = cf.GetFloat(p, v); }, (s) => { return AvatarStepHeight; }, - (s,p,l,v) => { AvatarStepHeight = v; } ), - new ParameterDefn("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", + (s,v) => { AvatarStepHeight = v; } ), + new ParameterDefn("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", 0.6f, - (s,cf,p,v) => { AvatarStepApproachFactor = cf.GetFloat(p, v); }, (s) => { return AvatarStepApproachFactor; }, - (s,p,l,v) => { AvatarStepApproachFactor = v; } ), - new ParameterDefn("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", + (s,v) => { AvatarStepApproachFactor = v; } ), + new ParameterDefn("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", 2.0f, - (s,cf,p,v) => { AvatarStepForceFactor = cf.GetFloat(p, v); }, (s) => { return AvatarStepForceFactor; }, - (s,p,l,v) => { AvatarStepForceFactor = v; } ), + (s,v) => { AvatarStepForceFactor = v; } ), - new ParameterDefn("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", + new ParameterDefn("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", 1000.0f, - (s,cf,p,v) => { VehicleMaxLinearVelocity = cf.GetFloat(p, v); }, (s) => { return (float)VehicleMaxLinearVelocity; }, - (s,p,l,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySq = v * v; } ), - new ParameterDefn("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", + (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySq = v * v; } ), + new ParameterDefn("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", 12.0f, - (s,cf,p,v) => { VehicleMaxAngularVelocity = cf.GetFloat(p, v); }, (s) => { return (float)VehicleMaxAngularVelocity; }, - (s,p,l,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ), - new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", + (s,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ), + new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", 0.0f, - (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, (s) => { return VehicleAngularDamping; }, - (s,p,l,v) => { VehicleAngularDamping = v; } ), - new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (0.0 - 1.0)", - 1.0f, - (s,cf,p,v) => { VehicleLinearFactor = cf.GetFloat(p, v); }, + (s,v) => { VehicleAngularDamping = v; } ), + new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (<0,0,0> to <1,1,1>)", + new Vector3(1f, 1f, 1f), (s) => { return VehicleLinearFactor; }, - (s,p,l,v) => { VehicleLinearFactor = v; VehicleLinearFactorV = new Vector3(v, v, v); } ), - new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (0.0 - 1.0)", - 1.0f, - (s,cf,p,v) => { VehicleAngularFactor = cf.GetFloat(p, v); }, + (s,v) => { VehicleLinearFactor = v; } ), + new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (<0,0,0> to <1,1,1>)", + new Vector3(1f, 1f, 1f), (s) => { return VehicleAngularFactor; }, - (s,p,l,v) => { VehicleAngularFactor = v; VehicleAngularFactorV = new Vector3(v, v, v); } ), - new ParameterDefn("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", + (s,v) => { VehicleAngularFactor = v; } ), + new ParameterDefn("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", 0.0f, - (s,cf,p,v) => { VehicleFriction = cf.GetFloat(p, v); }, (s) => { return VehicleFriction; }, - (s,p,l,v) => { VehicleFriction = v; } ), - new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", + (s,v) => { VehicleFriction = v; } ), + new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", 0.0f, - (s,cf,p,v) => { VehicleRestitution = cf.GetFloat(p, v); }, (s) => { return VehicleRestitution; }, - (s,p,l,v) => { VehicleRestitution = v; } ), - new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", + (s,v) => { VehicleRestitution = v; } ), + new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", 0.2f, - (s,cf,p,v) => { VehicleGroundGravityFudge = cf.GetFloat(p, v); }, (s) => { return VehicleGroundGravityFudge; }, - (s,p,l,v) => { VehicleGroundGravityFudge = v; } ), - new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", - ConfigurationParameters.numericFalse, - (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s,v) => { VehicleGroundGravityFudge = v; } ), + new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", + false, (s) => { return VehicleDebuggingEnabled; }, - (s,p,l,v) => { VehicleDebuggingEnabled = v; } ), + (s,v) => { VehicleDebuggingEnabled = v; } ), - new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", + new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", 0f, - (s,cf,p,v) => { MaxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, (s) => { return MaxPersistantManifoldPoolSize; }, - (s,p,l,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), - new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", + (s,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), + new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", 0f, - (s,cf,p,v) => { MaxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, (s) => { return MaxCollisionAlgorithmPoolSize; }, - (s,p,l,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), - new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", - ConfigurationParameters.numericFalse, - (s,cf,p,v) => { ShouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), + new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", + false, (s) => { return ShouldDisableContactPoolDynamicAllocation; }, - (s,p,l,v) => { ShouldDisableContactPoolDynamicAllocation = v; s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), - new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", - ConfigurationParameters.numericFalse, - (s,cf,p,v) => { ShouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s,v) => { ShouldDisableContactPoolDynamicAllocation = v; + s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = NumericBool(v); } ), + new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", + false, (s) => { return ShouldForceUpdateAllAabbs; }, - (s,p,l,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), - new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { ShouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = NumericBool(v); } ), + new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", + true, (s) => { return ShouldRandomizeSolverOrder; }, - (s,p,l,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), - new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { ShouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = NumericBool(v); } ), + new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", + true, (s) => { return ShouldSplitSimulationIslands; }, - (s,p,l,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), - new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { ShouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = NumericBool(v); } ), + new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", + true, (s) => { return ShouldEnableFrictionCaching; }, - (s,p,l,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), - new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", + (s,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = NumericBool(v); } ), + new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", 0f, // zero says use Bullet default - (s,cf,p,v) => { NumberOfSolverIterations = cf.GetFloat(p, v); }, (s) => { return NumberOfSolverIterations; }, - (s,p,l,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ), - new ParameterDefn("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { UseSingleSidedMeshesF = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, - (s) => { return UseSingleSidedMeshesF; }, - (s,p,l,v) => { UseSingleSidedMeshesF = v; s.UnmanagedParams[0].useSingleSidedMeshes = v; } ), - new ParameterDefn("GlobalContactBreakingThreshold", "Amount of shape radius before breaking a collision contact (0 says Bullet default (0.2))", + (s,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ), + new ParameterDefn("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.", + true, + (s) => { return UseSingleSidedMeshes; }, + (s,v) => { UseSingleSidedMeshes = v; s.UnmanagedParams[0].useSingleSidedMeshes = NumericBool(v); } ), + new ParameterDefn("GlobalContactBreakingThreshold", "Amount of shape radius before breaking a collision contact (0 says Bullet default (0.2))", 0f, - (s,cf,p,v) => { GlobalContactBreakingThreshold = cf.GetFloat(p, v); }, (s) => { return GlobalContactBreakingThreshold; }, - (s,p,l,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), + (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), - new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", + new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", (float)BSLinkset.LinksetImplementation.Compound, - (s,cf,p,v) => { LinksetImplementation = cf.GetFloat(p,v); }, (s) => { return LinksetImplementation; }, - (s,p,l,v) => { LinksetImplementation = v; } ), - new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", - ConfigurationParameters.numericFalse, - (s,cf,p,v) => { LinkConstraintUseFrameOffset = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s,v) => { LinksetImplementation = v; } ), + new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", + false, (s) => { return LinkConstraintUseFrameOffset; }, - (s,p,l,v) => { LinkConstraintUseFrameOffset = v; } ), - new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", - ConfigurationParameters.numericTrue, - (s,cf,p,v) => { LinkConstraintEnableTransMotor = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, + (s,v) => { LinkConstraintUseFrameOffset = v; } ), + new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", + true, (s) => { return LinkConstraintEnableTransMotor; }, - (s,p,l,v) => { LinkConstraintEnableTransMotor = v; } ), - new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", + (s,v) => { LinkConstraintEnableTransMotor = v; } ), + new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", 5.0f, - (s,cf,p,v) => { LinkConstraintTransMotorMaxVel = cf.GetFloat(p, v); }, (s) => { return LinkConstraintTransMotorMaxVel; }, - (s,p,l,v) => { LinkConstraintTransMotorMaxVel = v; } ), - new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", + (s,v) => { LinkConstraintTransMotorMaxVel = v; } ), + new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", 0.1f, - (s,cf,p,v) => { LinkConstraintTransMotorMaxForce = cf.GetFloat(p, v); }, (s) => { return LinkConstraintTransMotorMaxForce; }, - (s,p,l,v) => { LinkConstraintTransMotorMaxForce = v; } ), - new ParameterDefn("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", + (s,v) => { LinkConstraintTransMotorMaxForce = v; } ), + new ParameterDefn("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", 0.1f, - (s,cf,p,v) => { LinkConstraintCFM = cf.GetFloat(p, v); }, (s) => { return LinkConstraintCFM; }, - (s,p,l,v) => { LinkConstraintCFM = v; } ), - new ParameterDefn("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", + (s,v) => { LinkConstraintCFM = v; } ), + new ParameterDefn("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", 0.1f, - (s,cf,p,v) => { LinkConstraintERP = cf.GetFloat(p, v); }, (s) => { return LinkConstraintERP; }, - (s,p,l,v) => { LinkConstraintERP = v; } ), - new ParameterDefn("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", + (s,v) => { LinkConstraintERP = v; } ), + new ParameterDefn("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", 40, - (s,cf,p,v) => { LinkConstraintSolverIterations = cf.GetFloat(p, v); }, (s) => { return LinkConstraintSolverIterations; }, - (s,p,l,v) => { LinkConstraintSolverIterations = v; } ), + (s,v) => { LinkConstraintSolverIterations = v; } ), - new ParameterDefn("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)", - 0f, - (s,cf,p,v) => { s.PhysicsMetricDumpFrames = cf.GetFloat(p, (int)v); }, - (s) => { return (float)s.PhysicsMetricDumpFrames; }, - (s,p,l,v) => { s.PhysicsMetricDumpFrames = (int)v; } ), - new ParameterDefn("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool", + new ParameterDefn("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)", + 0, + (s) => { return s.PhysicsMetricDumpFrames; }, + (s,v) => { s.PhysicsMetricDumpFrames = v; } ), + new ParameterDefn("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool", 0f, - (s,cf,p,v) => { ; }, (s) => { return 0f; }, - (s,p,l,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ), - new ParameterDefn("ResetConstraintSolver", "Setting this is any value resets the constraint solver", + (s,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ), + new ParameterDefn("ResetConstraintSolver", "Setting this is any value resets the constraint solver", 0f, - (s,cf,p,v) => { ; }, (s) => { return 0f; }, - (s,p,l,v) => { BSParam.ResetConstraintSolverTainted(s, v); } ), + (s,v) => { BSParam.ResetConstraintSolverTainted(s, v); } ), }; // Convert a boolean to our numeric true and false values @@ -658,13 +636,13 @@ public static class BSParam // ParameterDefn structure. // Case does not matter as names are compared after converting to lower case. // Returns 'false' if the parameter is not found. - internal static bool TryGetParameter(string paramName, out ParameterDefn defn) + internal static bool TryGetParameter(string paramName, out ParameterDefnBase defn) { bool ret = false; - ParameterDefn foundDefn = new ParameterDefn(); + ParameterDefnBase foundDefn = null; string pName = paramName.ToLower(); - foreach (ParameterDefn parm in ParameterDefinitions) + foreach (ParameterDefnBase parm in ParameterDefinitions) { if (pName == parm.name.ToLower()) { @@ -680,18 +658,18 @@ public static class BSParam // Pass through the settable parameters and set the default values internal static void SetParameterDefaultValues(BSScene physicsScene) { - foreach (ParameterDefn parm in ParameterDefinitions) + foreach (ParameterDefnBase parm in ParameterDefinitions) { - parm.setter(physicsScene, parm.name, PhysParameterEntry.APPLY_TO_NONE, parm.defaultValue); + parm.AssignDefault(physicsScene); } } // Get user set values out of the ini file. internal static void SetParameterConfigurationValues(BSScene physicsScene, IConfig cfg) { - foreach (ParameterDefn parm in ParameterDefinitions) + foreach (ParameterDefnBase parm in ParameterDefinitions) { - parm.userParam(physicsScene, cfg, parm.name, parm.defaultValue); + parm.SetValue(physicsScene, cfg.GetString(parm.name, parm.GetValue(physicsScene))); } } @@ -706,11 +684,11 @@ public static class BSParam List entries = new List(); for (int ii = 0; ii < ParameterDefinitions.Length; ii++) { - ParameterDefn pd = ParameterDefinitions[ii]; + ParameterDefnBase pd = ParameterDefinitions[ii]; entries.Add(new PhysParameterEntry(pd.name, pd.desc)); } - // make the list alphabetical for estetic reasons + // make the list alphabetical for ease of finding anything entries.Sort((ppe1, ppe2) => { return ppe1.name.CompareTo(ppe2.name); }); SettableParameters = entries.ToArray(); -- cgit v1.1 From efb5da0aa672551a8a68e16066f3dd3991f75da4 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 21 Feb 2013 08:52:11 -0800 Subject: BulletSim: add OutOfBounds logic and some position sanity checking to eliminate some of the "cannot find terrain height" warning messages. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 43 ++++++++++++++++--------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') 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 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("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", + 5, + (s) => { return CrossingFailuresBeforeOutOfBounds; }, + (s,v) => { CrossingFailuresBeforeOutOfBounds = v; } ), + new ParameterDefn("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; -- cgit v1.1 From 1c740798b45dddb3e056b2e281fe98de6bf35143 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 1 Mar 2013 08:52:06 -0800 Subject: BulletSim: add parameters, code cleanup around checking and enforcing maximum velocity and angular velocity values for prims. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index dc57b67..fa58109 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -47,12 +47,16 @@ public static class BSParam public static float SculptLOD { get; private set; } public static int CrossingFailuresBeforeOutOfBounds { get; private set; } + public static float UpdateVelocityChangeThreshold { get; private set; } public static float MinimumObjectMass { get; private set; } public static float MaximumObjectMass { get; private set; } public static float MaxLinearVelocity { get; private set; } + public static float MaxLinearVelocitySquared { get; private set; } public static float MaxAngularVelocity { get; private set; } + public static float MaxAngularVelocitySquared { get; private set; } public static float MaxAddForceMagnitude { get; private set; } + public static float MaxAddForceMagnitudeSquared { get; private set; } public static float DensityScaleFactor { get; private set; } public static float LinearDamping { get; private set; } @@ -109,7 +113,7 @@ public static class BSParam // Vehicle parameters public static float VehicleMaxLinearVelocity { get; private set; } - public static float VehicleMaxLinearVelocitySq { get; private set; } + public static float VehicleMaxLinearVelocitySquared { get; private set; } public static float VehicleMaxAngularVelocity { get; private set; } public static float VehicleMaxAngularVelocitySq { get; private set; } public static float VehicleAngularDamping { get; private set; } @@ -265,7 +269,7 @@ public static class BSParam // The single letter parameters for the delegates are: // s = BSScene // o = BSPhysObject - // v = value (float) + // v = value (appropriate type) private static ParameterDefnBase[] ParameterDefinitions = { new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", @@ -289,6 +293,10 @@ public static class BSParam 5, (s) => { return CrossingFailuresBeforeOutOfBounds; }, (s,v) => { CrossingFailuresBeforeOutOfBounds = v; } ), + new ParameterDefn("UpdateVelocityChangeThreshold", "Change in updated velocity required before reporting change to simulator", + 0.1f, + (s) => { return UpdateVelocityChangeThreshold; }, + (s,v) => { UpdateVelocityChangeThreshold = v; } ), new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", 32f, @@ -343,16 +351,16 @@ public static class BSParam new ParameterDefn("MaxLinearVelocity", "Maximum velocity magnitude that can be assigned to an object", 1000.0f, (s) => { return MaxLinearVelocity; }, - (s,v) => { MaxLinearVelocity = v; } ), + (s,v) => { MaxLinearVelocity = v; MaxLinearVelocitySquared = v * v; } ), new ParameterDefn("MaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to an object", 1000.0f, (s) => { return MaxAngularVelocity; }, - (s,v) => { MaxAngularVelocity = v; } ), + (s,v) => { MaxAngularVelocity = v; MaxAngularVelocitySquared = v * v; } ), // LL documentation says thie number should be 20f for llApplyImpulse and 200f for llRezObject new ParameterDefn("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)", 20000.0f, (s) => { return MaxAddForceMagnitude; }, - (s,v) => { MaxAddForceMagnitude = v; } ), + (s,v) => { MaxAddForceMagnitude = v; MaxAddForceMagnitudeSquared = v * v; } ), // Density is passed around as 100kg/m3. This scales that to 1kg/m3. new ParameterDefn("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", 0.01f, @@ -505,7 +513,7 @@ public static class BSParam new ParameterDefn("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", 1000.0f, (s) => { return (float)VehicleMaxLinearVelocity; }, - (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySq = v * v; } ), + (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySquared = v * v; } ), new ParameterDefn("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", 12.0f, (s) => { return (float)VehicleMaxAngularVelocity; }, -- cgit v1.1 From 1120bcf123b5aa159e966a80254794f6af66f2a3 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 9 Mar 2013 14:15:14 -0800 Subject: BulletSim: remove the ability for avatars to fly off the edge of regions when there are no region neighbors. Add some terrain location processing routines to support above. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index fa58109..2af8468 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -107,6 +107,7 @@ public static class BSParam public static float AvatarCapsuleDepth { get; private set; } public static float AvatarCapsuleHeight { get; private set; } public static float AvatarContactProcessingThreshold { get; private set; } + public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } public static float AvatarStepHeight { get; private set; } public static float AvatarStepApproachFactor { get; private set; } public static float AvatarStepForceFactor { get; private set; } @@ -497,6 +498,10 @@ public static class BSParam 0.1f, (s) => { return AvatarContactProcessingThreshold; }, (s,v) => { AvatarContactProcessingThreshold = v; } ), + new ParameterDefn("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", + 1.0f, + (s) => { return AvatarBelowGroundUpCorrectionMeters; }, + (s,v) => { AvatarBelowGroundUpCorrectionMeters = v; } ), new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", 0.3f, (s) => { return AvatarStepHeight; }, -- cgit v1.1 From 464201b41d5f5fdd7c88ab5e95dd7b6fbae6d766 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 16 Mar 2013 15:34:07 -0700 Subject: BulletSim: add INI parameter for angular banking timescale fudge parameter. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 2af8468..77bdacb 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -123,6 +123,7 @@ public static class BSParam public static Vector3 VehicleLinearFactor { get; private set; } public static Vector3 VehicleAngularFactor { get; private set; } public static float VehicleGroundGravityFudge { get; private set; } + public static float VehicleAngularBankingTimescaleFudge { get; private set; } public static bool VehicleDebuggingEnabled { get; private set; } // Linkset implementation parameters @@ -543,10 +544,14 @@ public static class BSParam 0.0f, (s) => { return VehicleRestitution; }, (s,v) => { VehicleRestitution = v; } ), - new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", + new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", 0.2f, (s) => { return VehicleGroundGravityFudge; }, (s,v) => { VehicleGroundGravityFudge = v; } ), + new ParameterDefn("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", + 60.0f, + (s) => { return VehicleAngularBankingTimescaleFudge; }, + (s,v) => { VehicleAngularBankingTimescaleFudge = v; } ), new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", false, (s) => { return VehicleDebuggingEnabled; }, -- cgit v1.1 From 8510f57ad48db5f97dacc2a9be63c64e62477d14 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 17 Mar 2013 18:44:09 -0700 Subject: BulletSim: add terrain contact processing threshold parameter. Initialize contact processing threshold for static object as well as mesh terrain. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 77bdacb..cb0d929 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -39,6 +39,20 @@ public static class BSParam { private static string LogHeader = "[BULLETSIM PARAMETERS]"; + // Tuning notes: + // From: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=6575 + // Contact points can be added even if the distance is positive. The constraint solver can deal with + // contacts with positive distances as well as negative (penetration). Contact points are discarded + // if the distance exceeds a certain threshold. + // Bullet has a contact processing threshold and a contact breaking threshold. + // If the distance is larger than the contact breaking threshold, it will be removed after one frame. + // If the distance is larger than the contact processing threshold, the constraint solver will ignore it. + + // This is separate/independent from the collision margin. The collision margin increases the object a bit + // to improve collision detection performance and accuracy. + // =================== + // From: + // Level of Detail values kept as float because that's what the Meshmerizer wants public static float MeshLOD { get; private set; } public static float MeshCircularLOD { get; private set; } @@ -77,6 +91,7 @@ public static class BSParam public static float TerrainFriction { get; private set; } public static float TerrainHitFraction { get; private set; } public static float TerrainRestitution { get; private set; } + public static float TerrainContactProcessingThreshold { get; private set; } public static float TerrainCollisionMargin { get; private set; } public static float DefaultFriction { get; private set; } @@ -458,6 +473,10 @@ public static class BSParam 0f, (s) => { return TerrainRestitution; }, (s,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), + new ParameterDefn("TerrainContactProcessingThreshold", "Distance from terrain to stop processing collisions" , + 0.0f, + (s) => { return TerrainContactProcessingThreshold; }, + (s,v) => { TerrainContactProcessingThreshold = v; /* TODO: set on real terrain */ } ), new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , 0.08f, (s) => { return TerrainCollisionMargin; }, -- cgit v1.1 From 8360223fedc5a5521878806f40bdb0c3244241cc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 18 Mar 2013 23:58:21 -0700 Subject: BulletSim: code to generate a higher resolution terrain mesh. Parameter TerrainMeshMagnification controls number of vertices generated per heightmap point. Default is 3. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index cb0d929..4d89a88 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -88,6 +88,7 @@ public static class BSParam public static bool ShouldRemoveZeroWidthTriangles { get; private set; } public static float TerrainImplementation { get; private set; } + public static int TerrainMeshMagnification { get; private set; } public static float TerrainFriction { get; private set; } public static float TerrainHitFraction { get; private set; } public static float TerrainRestitution { get; private set; } @@ -461,6 +462,10 @@ public static class BSParam (float)BSTerrainPhys.TerrainImplementation.Mesh, (s) => { return TerrainImplementation; }, (s,v) => { TerrainImplementation = v; } ), + new ParameterDefn("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , + 3, + (s) => { return TerrainMeshMagnification; }, + (s,v) => { TerrainMeshMagnification = v; } ), new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , 0.3f, (s) => { return TerrainFriction; }, -- cgit v1.1 From f783b9169fbc0544ec6c634900cb34bf48c6b2a9 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 22 Mar 2013 16:50:56 -0700 Subject: BulletSim: parameterize C# HACD hull creation. Add feature of reducing max hull count for simple (non-cut prims) meshes. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 4d89a88..26d2d60 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -142,6 +142,14 @@ public static class BSParam public static float VehicleAngularBankingTimescaleFudge { get; private set; } public static bool VehicleDebuggingEnabled { get; private set; } + // Convex Hulls + public static int CSHullMaxDepthSplit { get; private set; } + public static int CSHullMaxDepthSplitForSimpleShapes { get; private set; } + public static float CSHullConcavityThresholdPercent { get; private set; } + public static float CSHullVolumeConservationThresholdPercent { get; private set; } + public static int CSHullMaxVertices { get; private set; } + public static float CSHullMaxSkinWidth { get; private set; } + // Linkset implementation parameters public static float LinksetImplementation { get; private set; } public static bool LinkConstraintUseFrameOffset { get; private set; } @@ -623,6 +631,31 @@ public static class BSParam (s) => { return GlobalContactBreakingThreshold; }, (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), + new ParameterDefn("CSHullMaxDepthSplit", "CS impl: max depth to split for hull. 1-10 but > 7 is iffy", + 7, + (s) => { return CSHullMaxDepthSplit; }, + (s,v) => { CSHullMaxDepthSplit = v; } ), + new ParameterDefn("CSHullMaxDepthSplitForSimpleShapes", "CS impl: max depth setting for simple prim shapes", + 2, + (s) => { return CSHullMaxDepthSplitForSimpleShapes; }, + (s,v) => { CSHullMaxDepthSplitForSimpleShapes = v; } ), + new ParameterDefn("CSHullConcavityThresholdPercent", "CS impl: concavity threshold percent (0-20)", + 5f, + (s) => { return CSHullConcavityThresholdPercent; }, + (s,v) => { CSHullConcavityThresholdPercent = v; } ), + new ParameterDefn("CSHullVolumeConservationThresholdPercent", "percent volume conservation to collapse hulls (0-30)", + 5f, + (s) => { return CSHullVolumeConservationThresholdPercent; }, + (s,v) => { CSHullVolumeConservationThresholdPercent = v; } ), + new ParameterDefn("CSHullMaxVertices", "CS impl: maximum number of vertices in output hulls. Keep < 50.", + 32, + (s) => { return CSHullMaxVertices; }, + (s,v) => { CSHullMaxVertices = v; } ), + new ParameterDefn("CSHullMaxSkinWidth", "CS impl: skin width to apply to output hulls.", + 0, + (s) => { return CSHullMaxSkinWidth; }, + (s,v) => { CSHullMaxSkinWidth = v; } ), + new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", (float)BSLinkset.LinksetImplementation.Compound, (s) => { return LinksetImplementation; }, -- cgit v1.1 From c96a6f1de6d5e66dd2055365c26144d7a92f2fc5 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 23 Mar 2013 11:03:59 -0700 Subject: BulletSim: small tweaks and formatting in the parameter fetching code. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 26d2d60..f3454c8 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -203,10 +203,10 @@ public static class BSParam public delegate void PSetOnObject(BSScene scene, BSPhysObject obj); public sealed class ParameterDefn : ParameterDefnBase { - T defaultValue; - PSetValue setter; - PGetValue getter; - PSetOnObject objectSet; + private T defaultValue; + private PSetValue setter; + private PGetValue getter; + private PSetOnObject objectSet; public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue pGetter, PSetValue pSetter) : base(pName, pDesc) { @@ -223,13 +223,23 @@ public static class BSParam getter = pGetter; objectSet = pObjSetter; } + /* Wish I could simplify using this definition but CLR doesn't store references so closure around delegates of references won't work + public ParameterDefn(string pName, string pDesc, T pDefault, ref T loc) + : base(pName, pDesc) + { + defaultValue = pDefault; + setter = (s, v) => { loc = v; }; + getter = (s) => { return loc; }; + objectSet = null; + } + */ public override void AssignDefault(BSScene s) { setter(s, defaultValue); } public override string GetValue(BSScene s) { - return String.Format("{0}", getter(s)); + return getter(s).ToString(); } public override void SetValue(BSScene s, string valAsString) { @@ -252,6 +262,7 @@ public static class BSParam try { T setValue = (T)parser.Invoke(genericType, new Object[] { valAsString }); + // Store the parsed value setter(s, setValue); // s.Logger.DebugFormat("{0} Parameter {1} = {2}", LogHeader, name, setValue); } -- cgit v1.1 From 6a9630d2bdc27ed702936f4c44e6978f728a9ef0 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 28 Mar 2013 10:56:21 -0700 Subject: BulletSim: fix race condition when creating very large mega-regions. The symptom was exceptions while creating physical terrain. Reduce default terrain mesh magnification to 2 from 3 because the higher resolution uses a lot of memory and doesn't solve the terrain smoothness for vehicles. Added comments here and there and improved some debugging log messages. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index f3454c8..385ed9e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -482,7 +482,7 @@ public static class BSParam (s) => { return TerrainImplementation; }, (s,v) => { TerrainImplementation = v; } ), new ParameterDefn("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , - 3, + 2, (s) => { return TerrainMeshMagnification; }, (s,v) => { TerrainMeshMagnification = v; } ), new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , -- cgit v1.1 From 59135c9a31875dc514b3ea2fe14021571807701d Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 9 Apr 2013 16:32:54 -0700 Subject: BulletSim: add Bullet HACD library invocation. Turned off by default as not totally debugged. Updated DLLs and SOs with more debugged HACD library code. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 53 ++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 385ed9e..06df85e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -86,6 +86,7 @@ public static class BSParam public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects public static bool ShouldRemoveZeroWidthTriangles { get; private set; } + public static bool ShouldUseBulletHACD { get; set; } public static float TerrainImplementation { get; private set; } public static int TerrainMeshMagnification { get; private set; } @@ -149,6 +150,15 @@ public static class BSParam public static float CSHullVolumeConservationThresholdPercent { get; private set; } public static int CSHullMaxVertices { get; private set; } public static float CSHullMaxSkinWidth { get; private set; } + public static float BHullMaxVerticesPerHull { get; private set; } // 100 + public static float BHullMinClusters { get; private set; } // 2 + public static float BHullCompacityWeight { get; private set; } // 0.1 + public static float BHullVolumeWeight { get; private set; } // 0.0 + public static float BHullConcavity { get; private set; } // 100 + public static bool BHullAddExtraDistPoints { get; private set; } // false + public static bool BHullAddNeighboursDistPoints { get; private set; } // false + public static bool BHullAddFacesPoints { get; private set; } // false + public static bool BHullShouldAdjustCollisionMargin { get; private set; } // false // Linkset implementation parameters public static float LinksetImplementation { get; private set; } @@ -325,6 +335,10 @@ public static class BSParam true, (s) => { return ShouldRemoveZeroWidthTriangles; }, (s,v) => { ShouldRemoveZeroWidthTriangles = v; } ), + new ParameterDefn("ShouldUseBulletHACD", "If true, use the Bullet version of HACD", + false, + (s) => { return ShouldUseBulletHACD; }, + (s,v) => { ShouldUseBulletHACD = v; } ), new ParameterDefn("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", 5, @@ -663,10 +677,47 @@ public static class BSParam (s) => { return CSHullMaxVertices; }, (s,v) => { CSHullMaxVertices = v; } ), new ParameterDefn("CSHullMaxSkinWidth", "CS impl: skin width to apply to output hulls.", - 0, + 0f, (s) => { return CSHullMaxSkinWidth; }, (s,v) => { CSHullMaxSkinWidth = v; } ), + new ParameterDefn("BHullMaxVerticesPerHull", "Bullet impl: max number of vertices per created hull", + 100f, + (s) => { return BHullMaxVerticesPerHull; }, + (s,v) => { BHullMaxVerticesPerHull = v; } ), + new ParameterDefn("BHullMinClusters", "Bullet impl: minimum number of hulls to create per mesh", + 2f, + (s) => { return BHullMinClusters; }, + (s,v) => { BHullMinClusters = v; } ), + new ParameterDefn("BHullCompacityWeight", "Bullet impl: weight factor for how compact to make hulls", + 2f, + (s) => { return BHullCompacityWeight; }, + (s,v) => { BHullCompacityWeight = v; } ), + new ParameterDefn("BHullVolumeWeight", "Bullet impl: weight factor for volume in created hull", + 0.1f, + (s) => { return BHullVolumeWeight; }, + (s,v) => { BHullVolumeWeight = v; } ), + new ParameterDefn("BHullConcavity", "Bullet impl: weight factor for how convex a created hull can be", + 100f, + (s) => { return BHullConcavity; }, + (s,v) => { BHullConcavity = v; } ), + new ParameterDefn("BHullAddExtraDistPoints", "Bullet impl: whether to add extra vertices for long distance vectors", + false, + (s) => { return BHullAddExtraDistPoints; }, + (s,v) => { BHullAddExtraDistPoints = v; } ), + new ParameterDefn("BHullAddNeighboursDistPoints", "Bullet impl: whether to add extra vertices between neighbor hulls", + false, + (s) => { return BHullAddNeighboursDistPoints; }, + (s,v) => { BHullAddNeighboursDistPoints = v; } ), + new ParameterDefn("BHullAddFacesPoints", "Bullet impl: whether to add extra vertices to break up hull faces", + false, + (s) => { return BHullAddFacesPoints; }, + (s,v) => { BHullAddFacesPoints = v; } ), + new ParameterDefn("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin", + false, + (s) => { return BHullShouldAdjustCollisionMargin; }, + (s,v) => { BHullShouldAdjustCollisionMargin = v; } ), + new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", (float)BSLinkset.LinksetImplementation.Compound, (s) => { return LinksetImplementation; }, -- cgit v1.1 From 522ab85045066cb58bb76881032adab7cc6a2d68 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 23 Apr 2013 18:31:12 -0700 Subject: BulletSim: improve avatar stair walking up. Add more parameters to control force of both position change and up force that move avatars over barrier. Default parameters are for steps up to 0.5m in height. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 06df85e..980d405 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -128,6 +128,8 @@ public static class BSParam public static float AvatarStepHeight { get; private set; } public static float AvatarStepApproachFactor { get; private set; } public static float AvatarStepForceFactor { get; private set; } + public static float AvatarStepUpCorrectionFactor { get; private set; } + public static int AvatarStepSmoothingSteps { get; private set; } // Vehicle parameters public static float VehicleMaxLinearVelocity { get; private set; } @@ -234,6 +236,7 @@ public static class BSParam objectSet = pObjSetter; } /* Wish I could simplify using this definition but CLR doesn't store references so closure around delegates of references won't work + * TODO: Maybe use reflection and the name of the variable to create a reference for the getter/setter. public ParameterDefn(string pName, string pDesc, T pDefault, ref T loc) : base(pName, pDesc) { @@ -561,7 +564,7 @@ public static class BSParam (s) => { return AvatarBelowGroundUpCorrectionMeters; }, (s,v) => { AvatarBelowGroundUpCorrectionMeters = v; } ), new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", - 0.3f, + 0.6f, (s) => { return AvatarStepHeight; }, (s,v) => { AvatarStepHeight = v; } ), new ParameterDefn("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", @@ -569,9 +572,17 @@ public static class BSParam (s) => { return AvatarStepApproachFactor; }, (s,v) => { AvatarStepApproachFactor = v; } ), new ParameterDefn("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", - 2.0f, + 1.0f, (s) => { return AvatarStepForceFactor; }, (s,v) => { AvatarStepForceFactor = v; } ), + new ParameterDefn("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step", + 1.0f, + (s) => { return AvatarStepUpCorrectionFactor; }, + (s,v) => { AvatarStepUpCorrectionFactor = v; } ), + new ParameterDefn("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs", + 2, + (s) => { return AvatarStepSmoothingSteps; }, + (s,v) => { AvatarStepSmoothingSteps = v; } ), new ParameterDefn("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", 1000.0f, -- cgit v1.1 From 92ee288d666963aae2a058cc964be009a504f084 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 29 Apr 2013 07:54:50 -0700 Subject: BulletSim: remove trailing white space to make git happier. No functional changes. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 980d405..5ebeace 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -37,7 +37,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin { public static class BSParam { - private static string LogHeader = "[BULLETSIM PARAMETERS]"; + private static string LogHeader = "[BULLETSIM PARAMETERS]"; // Tuning notes: // From: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=6575 @@ -51,7 +51,7 @@ public static class BSParam // This is separate/independent from the collision margin. The collision margin increases the object a bit // to improve collision detection performance and accuracy. // =================== - // From: + // From: // Level of Detail values kept as float because that's what the Meshmerizer wants public static float MeshLOD { get; private set; } @@ -636,7 +636,7 @@ public static class BSParam new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", false, (s) => { return ShouldDisableContactPoolDynamicAllocation; }, - (s,v) => { ShouldDisableContactPoolDynamicAllocation = v; + (s,v) => { ShouldDisableContactPoolDynamicAllocation = v; s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = NumericBool(v); } ), new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", false, -- cgit v1.1 From 4042c82a7293c40955a14d04d9e5ae05d35ef7cf Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 2 May 2013 12:27:30 -0700 Subject: BulletSim: prims with no cuts created with single convex hull shape. Parameter added to enable/disable this feature. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 5ebeace..2ac68e3 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -87,6 +87,7 @@ public static class BSParam public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects public static bool ShouldRemoveZeroWidthTriangles { get; private set; } public static bool ShouldUseBulletHACD { get; set; } + public static bool ShouldUseSingleConvexHullForPrims { get; set; } public static float TerrainImplementation { get; private set; } public static int TerrainMeshMagnification { get; private set; } @@ -342,6 +343,10 @@ public static class BSParam false, (s) => { return ShouldUseBulletHACD; }, (s,v) => { ShouldUseBulletHACD = v; } ), + new ParameterDefn("ShouldUseSingleConvexHullForPrims", "If true, use a single convex hull shape for physical prims", + true, + (s) => { return ShouldUseSingleConvexHullForPrims; }, + (s,v) => { ShouldUseSingleConvexHullForPrims = v; } ), new ParameterDefn("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", 5, -- cgit v1.1 From bf318969836bf38dbd0325f24fa3d1bd12f34d77 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 3 May 2013 17:14:31 -0700 Subject: BulletSim: simplify parameter specification by reducing the number of specifications required for simple properties with defaults. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 283 ++++++++---------------- 1 file changed, 93 insertions(+), 190 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 2ac68e3..3ca7e16 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -26,6 +26,7 @@ */ using System; using System.Collections.Generic; +using System.Reflection; using System.Text; using OpenSim.Region.Physics.Manager; @@ -144,7 +145,7 @@ public static class BSParam public static Vector3 VehicleAngularFactor { get; private set; } public static float VehicleGroundGravityFudge { get; private set; } public static float VehicleAngularBankingTimescaleFudge { get; private set; } - public static bool VehicleDebuggingEnabled { get; private set; } + public static bool VehicleDebuggingEnable { get; private set; } // Convex Hulls public static int CSHullMaxDepthSplit { get; private set; } @@ -236,17 +237,41 @@ public static class BSParam getter = pGetter; objectSet = pObjSetter; } - /* Wish I could simplify using this definition but CLR doesn't store references so closure around delegates of references won't work - * TODO: Maybe use reflection and the name of the variable to create a reference for the getter/setter. - public ParameterDefn(string pName, string pDesc, T pDefault, ref T loc) + // Simple parameter variable where property name is the same as the INI file name + // and the value is only a simple get and set. + public ParameterDefn(string pName, string pDesc, T pDefault) : base(pName, pDesc) { defaultValue = pDefault; - setter = (s, v) => { loc = v; }; - getter = (s) => { return loc; }; + setter = (s, v) => { SetValueByName(s, name, v); }; + getter = (s) => { return GetValueByName(s, name); }; objectSet = null; } - */ + // Use reflection to find the property named 'pName' in BSParam and assign 'val' to same. + private void SetValueByName(BSScene s, string pName, T val) + { + PropertyInfo prop = typeof(BSParam).GetProperty(pName, BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy); + if (prop == null) + { + // This should only be output when someone adds a new INI parameter and misspells the name. + s.Logger.ErrorFormat("{0} SetValueByName: did not find '{1}'. Verify specified property name is the same as the given INI parameters name.", LogHeader, pName); + } + else + { + prop.SetValue(null, val, null); + } + } + // Use reflection to find the property named 'pName' in BSParam and return the value in same. + private T GetValueByName(BSScene s, string pName) + { + PropertyInfo prop = typeof(BSParam).GetProperty(pName, BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy); + if (prop == null) + { + // This should only be output when someone adds a new INI parameter and misspells the name. + s.Logger.ErrorFormat("{0} GetValueByName: did not find '{1}'. Verify specified property name is the same as the given INI parameter name.", LogHeader, pName); + } + return (T)prop.GetValue(null, null); + } public override void AssignDefault(BSScene s) { setter(s, defaultValue); @@ -336,26 +361,16 @@ public static class BSParam (s) => { return ShouldUseHullsForPhysicalObjects; }, (s,v) => { ShouldUseHullsForPhysicalObjects = v; } ), new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", - true, - (s) => { return ShouldRemoveZeroWidthTriangles; }, - (s,v) => { ShouldRemoveZeroWidthTriangles = v; } ), + true ), new ParameterDefn("ShouldUseBulletHACD", "If true, use the Bullet version of HACD", - false, - (s) => { return ShouldUseBulletHACD; }, - (s,v) => { ShouldUseBulletHACD = v; } ), + false ), new ParameterDefn("ShouldUseSingleConvexHullForPrims", "If true, use a single convex hull shape for physical prims", - true, - (s) => { return ShouldUseSingleConvexHullForPrims; }, - (s,v) => { ShouldUseSingleConvexHullForPrims = v; } ), + true ), new ParameterDefn("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", - 5, - (s) => { return CrossingFailuresBeforeOutOfBounds; }, - (s,v) => { CrossingFailuresBeforeOutOfBounds = v; } ), + 5 ), new ParameterDefn("UpdateVelocityChangeThreshold", "Change in updated velocity required before reporting change to simulator", - 0.1f, - (s) => { return UpdateVelocityChangeThreshold; }, - (s,v) => { UpdateVelocityChangeThreshold = v; } ), + 0.1f ), new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", 32f, @@ -422,18 +437,12 @@ public static class BSParam (s,v) => { MaxAddForceMagnitude = v; MaxAddForceMagnitudeSquared = v * v; } ), // Density is passed around as 100kg/m3. This scales that to 1kg/m3. new ParameterDefn("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", - 0.01f, - (s) => { return DensityScaleFactor; }, - (s,v) => { DensityScaleFactor = v; } ), + 0.01f ), new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", - 2200f, - (s) => { return (float)PID_D; }, - (s,v) => { PID_D = v; } ), + 2200f ), new ParameterDefn("PID_P", "Parameteric factor for motion smoothing", - 900f, - (s) => { return (float)PID_P; }, - (s,v) => { PID_P = v; } ), + 900f ), new ParameterDefn("DefaultFriction", "Friction factor used on new objects", 0.2f, @@ -500,94 +509,50 @@ public static class BSParam (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", - (float)BSTerrainPhys.TerrainImplementation.Mesh, - (s) => { return TerrainImplementation; }, - (s,v) => { TerrainImplementation = v; } ), + (float)BSTerrainPhys.TerrainImplementation.Mesh ), new ParameterDefn("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , - 2, - (s) => { return TerrainMeshMagnification; }, - (s,v) => { TerrainMeshMagnification = v; } ), + 2 ), new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , - 0.3f, - (s) => { return TerrainFriction; }, - (s,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), + 0.3f ), new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , - 0.8f, - (s) => { return TerrainHitFraction; }, - (s,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), + 0.8f ), new ParameterDefn("TerrainRestitution", "Bouncyness" , - 0f, - (s) => { return TerrainRestitution; }, - (s,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), + 0f ), new ParameterDefn("TerrainContactProcessingThreshold", "Distance from terrain to stop processing collisions" , - 0.0f, - (s) => { return TerrainContactProcessingThreshold; }, - (s,v) => { TerrainContactProcessingThreshold = v; /* TODO: set on real terrain */ } ), + 0.0f ), new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , - 0.08f, - (s) => { return TerrainCollisionMargin; }, - (s,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), + 0.08f ), new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", - 0.2f, - (s) => { return AvatarFriction; }, - (s,v) => { AvatarFriction = v; } ), + 0.2f ), new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", - 0.95f, - (s) => { return AvatarStandingFriction; }, - (s,v) => { AvatarStandingFriction = v; } ), + 0.95f ), new ParameterDefn("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", - 1.3f, - (s) => { return AvatarAlwaysRunFactor; }, - (s,v) => { AvatarAlwaysRunFactor = v; } ), + 1.3f ), new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", - 3.5f, - (s) => { return AvatarDensity; }, - (s,v) => { AvatarDensity = v; } ), + 3.5f) , new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", - 0f, - (s) => { return AvatarRestitution; }, - (s,v) => { AvatarRestitution = v; } ), + 0f ), new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", - 0.6f, - (s) => { return AvatarCapsuleWidth; }, - (s,v) => { AvatarCapsuleWidth = v; } ), + 0.6f ) , new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", - 0.45f, - (s) => { return AvatarCapsuleDepth; }, - (s,v) => { AvatarCapsuleDepth = v; } ), + 0.45f ), new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", - 1.5f, - (s) => { return AvatarCapsuleHeight; }, - (s,v) => { AvatarCapsuleHeight = v; } ), + 1.5f ), new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", - 0.1f, - (s) => { return AvatarContactProcessingThreshold; }, - (s,v) => { AvatarContactProcessingThreshold = v; } ), + 0.1f ), new ParameterDefn("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", - 1.0f, - (s) => { return AvatarBelowGroundUpCorrectionMeters; }, - (s,v) => { AvatarBelowGroundUpCorrectionMeters = v; } ), + 1.0f ), new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", - 0.6f, - (s) => { return AvatarStepHeight; }, - (s,v) => { AvatarStepHeight = v; } ), + 0.6f ) , new ParameterDefn("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", - 0.6f, - (s) => { return AvatarStepApproachFactor; }, - (s,v) => { AvatarStepApproachFactor = v; } ), + 0.6f ), new ParameterDefn("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", - 1.0f, - (s) => { return AvatarStepForceFactor; }, - (s,v) => { AvatarStepForceFactor = v; } ), + 1.0f ), new ParameterDefn("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step", - 1.0f, - (s) => { return AvatarStepUpCorrectionFactor; }, - (s,v) => { AvatarStepUpCorrectionFactor = v; } ), + 1.0f ), new ParameterDefn("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs", - 2, - (s) => { return AvatarStepSmoothingSteps; }, - (s,v) => { AvatarStepSmoothingSteps = v; } ), + 2 ), new ParameterDefn("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", 1000.0f, @@ -598,37 +563,21 @@ public static class BSParam (s) => { return (float)VehicleMaxAngularVelocity; }, (s,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ), new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", - 0.0f, - (s) => { return VehicleAngularDamping; }, - (s,v) => { VehicleAngularDamping = v; } ), + 0.0f ), new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (<0,0,0> to <1,1,1>)", - new Vector3(1f, 1f, 1f), - (s) => { return VehicleLinearFactor; }, - (s,v) => { VehicleLinearFactor = v; } ), + new Vector3(1f, 1f, 1f) ), new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (<0,0,0> to <1,1,1>)", - new Vector3(1f, 1f, 1f), - (s) => { return VehicleAngularFactor; }, - (s,v) => { VehicleAngularFactor = v; } ), + new Vector3(1f, 1f, 1f) ), new ParameterDefn("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", - 0.0f, - (s) => { return VehicleFriction; }, - (s,v) => { VehicleFriction = v; } ), + 0.0f ), new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", - 0.0f, - (s) => { return VehicleRestitution; }, - (s,v) => { VehicleRestitution = v; } ), + 0.0f ), new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", - 0.2f, - (s) => { return VehicleGroundGravityFudge; }, - (s,v) => { VehicleGroundGravityFudge = v; } ), + 0.2f ), new ParameterDefn("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", - 60.0f, - (s) => { return VehicleAngularBankingTimescaleFudge; }, - (s,v) => { VehicleAngularBankingTimescaleFudge = v; } ), + 60.0f ), new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", - false, - (s) => { return VehicleDebuggingEnabled; }, - (s,v) => { VehicleDebuggingEnabled = v; } ), + false ), new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", 0f, @@ -673,99 +622,53 @@ public static class BSParam (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), new ParameterDefn("CSHullMaxDepthSplit", "CS impl: max depth to split for hull. 1-10 but > 7 is iffy", - 7, - (s) => { return CSHullMaxDepthSplit; }, - (s,v) => { CSHullMaxDepthSplit = v; } ), + 7 ), new ParameterDefn("CSHullMaxDepthSplitForSimpleShapes", "CS impl: max depth setting for simple prim shapes", - 2, - (s) => { return CSHullMaxDepthSplitForSimpleShapes; }, - (s,v) => { CSHullMaxDepthSplitForSimpleShapes = v; } ), + 2 ), new ParameterDefn("CSHullConcavityThresholdPercent", "CS impl: concavity threshold percent (0-20)", - 5f, - (s) => { return CSHullConcavityThresholdPercent; }, - (s,v) => { CSHullConcavityThresholdPercent = v; } ), + 5f ), new ParameterDefn("CSHullVolumeConservationThresholdPercent", "percent volume conservation to collapse hulls (0-30)", - 5f, - (s) => { return CSHullVolumeConservationThresholdPercent; }, - (s,v) => { CSHullVolumeConservationThresholdPercent = v; } ), + 5f ), new ParameterDefn("CSHullMaxVertices", "CS impl: maximum number of vertices in output hulls. Keep < 50.", - 32, - (s) => { return CSHullMaxVertices; }, - (s,v) => { CSHullMaxVertices = v; } ), + 32 ), new ParameterDefn("CSHullMaxSkinWidth", "CS impl: skin width to apply to output hulls.", - 0f, - (s) => { return CSHullMaxSkinWidth; }, - (s,v) => { CSHullMaxSkinWidth = v; } ), + 0f ), new ParameterDefn("BHullMaxVerticesPerHull", "Bullet impl: max number of vertices per created hull", - 100f, - (s) => { return BHullMaxVerticesPerHull; }, - (s,v) => { BHullMaxVerticesPerHull = v; } ), + 100f ), new ParameterDefn("BHullMinClusters", "Bullet impl: minimum number of hulls to create per mesh", - 2f, - (s) => { return BHullMinClusters; }, - (s,v) => { BHullMinClusters = v; } ), + 2f ), new ParameterDefn("BHullCompacityWeight", "Bullet impl: weight factor for how compact to make hulls", - 2f, - (s) => { return BHullCompacityWeight; }, - (s,v) => { BHullCompacityWeight = v; } ), + 0.1f ), new ParameterDefn("BHullVolumeWeight", "Bullet impl: weight factor for volume in created hull", - 0.1f, - (s) => { return BHullVolumeWeight; }, - (s,v) => { BHullVolumeWeight = v; } ), + 0f ), new ParameterDefn("BHullConcavity", "Bullet impl: weight factor for how convex a created hull can be", - 100f, - (s) => { return BHullConcavity; }, - (s,v) => { BHullConcavity = v; } ), + 100f ), new ParameterDefn("BHullAddExtraDistPoints", "Bullet impl: whether to add extra vertices for long distance vectors", - false, - (s) => { return BHullAddExtraDistPoints; }, - (s,v) => { BHullAddExtraDistPoints = v; } ), + false ), new ParameterDefn("BHullAddNeighboursDistPoints", "Bullet impl: whether to add extra vertices between neighbor hulls", - false, - (s) => { return BHullAddNeighboursDistPoints; }, - (s,v) => { BHullAddNeighboursDistPoints = v; } ), + false ), new ParameterDefn("BHullAddFacesPoints", "Bullet impl: whether to add extra vertices to break up hull faces", - false, - (s) => { return BHullAddFacesPoints; }, - (s,v) => { BHullAddFacesPoints = v; } ), + false ), new ParameterDefn("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin", - false, - (s) => { return BHullShouldAdjustCollisionMargin; }, - (s,v) => { BHullShouldAdjustCollisionMargin = v; } ), + false ), new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", - (float)BSLinkset.LinksetImplementation.Compound, - (s) => { return LinksetImplementation; }, - (s,v) => { LinksetImplementation = v; } ), + (float)BSLinkset.LinksetImplementation.Compound ), new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", - false, - (s) => { return LinkConstraintUseFrameOffset; }, - (s,v) => { LinkConstraintUseFrameOffset = v; } ), + false ), new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", - true, - (s) => { return LinkConstraintEnableTransMotor; }, - (s,v) => { LinkConstraintEnableTransMotor = v; } ), + true ), new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", - 5.0f, - (s) => { return LinkConstraintTransMotorMaxVel; }, - (s,v) => { LinkConstraintTransMotorMaxVel = v; } ), + 5.0f ), new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", - 0.1f, - (s) => { return LinkConstraintTransMotorMaxForce; }, - (s,v) => { LinkConstraintTransMotorMaxForce = v; } ), + 0.1f ), new ParameterDefn("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", - 0.1f, - (s) => { return LinkConstraintCFM; }, - (s,v) => { LinkConstraintCFM = v; } ), + 0.1f ), new ParameterDefn("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", - 0.1f, - (s) => { return LinkConstraintERP; }, - (s,v) => { LinkConstraintERP = v; } ), + 0.1f ), new ParameterDefn("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", - 40, - (s) => { return LinkConstraintSolverIterations; }, - (s,v) => { LinkConstraintSolverIterations = v; } ), + 40 ), new ParameterDefn("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)", 0, -- cgit v1.1 From 45f37e11ad6e9a9917a6ea07ec52dec9058393f0 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 13 May 2013 08:40:24 -0700 Subject: BulletSim: use heightmap terrain when using BulletXNA. Output messages on features disabled when using BulletXNA. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 3ca7e16..5504478 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -90,7 +90,7 @@ public static class BSParam public static bool ShouldUseBulletHACD { get; set; } public static bool ShouldUseSingleConvexHullForPrims { get; set; } - public static float TerrainImplementation { get; private set; } + public static float TerrainImplementation { get; set; } public static int TerrainMeshMagnification { get; private set; } public static float TerrainFriction { get; private set; } public static float TerrainHitFraction { get; private set; } -- cgit v1.1 From 15360cbb6ba83e40f474cca84082c908af49c58e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 13 May 2013 13:03:13 -0700 Subject: BulletSim: add adjustment for avatar capsule height scaling. Makes avatar standing on ground view better and enables tuning. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 5504478..d33292f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -125,6 +125,9 @@ public static class BSParam public static float AvatarCapsuleWidth { get; private set; } public static float AvatarCapsuleDepth { get; private set; } public static float AvatarCapsuleHeight { get; private set; } + public static float AvatarHeightLowFudge { get; private set; } + public static float AvatarHeightMidFudge { get; private set; } + public static float AvatarHeightHighFudge { get; private set; } public static float AvatarContactProcessingThreshold { get; private set; } public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } public static float AvatarStepHeight { get; private set; } @@ -539,6 +542,12 @@ public static class BSParam 0.45f ), new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", 1.5f ), + new ParameterDefn("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", + -0.2f ), + new ParameterDefn("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", + 0.1f ), + new ParameterDefn("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", + 0.1f ), new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 0.1f ), new ParameterDefn("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", -- cgit v1.1 From 9de3979f5b91ae4bf9b05b89ec59999c43514f90 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 17 May 2013 21:17:54 -0700 Subject: BulletSim: add gImpact shape type. Add logic to use gImpact shape for prims that have cuts or holes. Default logic to 'off' as it needs debugging. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index d33292f..9a9e527 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -89,6 +89,7 @@ public static class BSParam public static bool ShouldRemoveZeroWidthTriangles { get; private set; } public static bool ShouldUseBulletHACD { get; set; } public static bool ShouldUseSingleConvexHullForPrims { get; set; } + public static bool ShouldUseGImpactShapeForPrims { get; set; } public static float TerrainImplementation { get; set; } public static int TerrainMeshMagnification { get; private set; } @@ -369,6 +370,8 @@ public static class BSParam false ), new ParameterDefn("ShouldUseSingleConvexHullForPrims", "If true, use a single convex hull shape for physical prims", true ), + new ParameterDefn("ShouldUseGImpactShapeForPrims", "If true, use a GImpact shape for prims with cuts and twists", + false ), new ParameterDefn("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", 5 ), -- cgit v1.1 From 2fd8819a043269f9308cb46c71893e6eb35a426e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 21 May 2013 21:32:30 -0700 Subject: BulletSim: add code to experimentally use asset hull data. Default to 'off' as it needs debugging. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 9a9e527..5cff668 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -90,6 +90,7 @@ public static class BSParam public static bool ShouldUseBulletHACD { get; set; } public static bool ShouldUseSingleConvexHullForPrims { get; set; } public static bool ShouldUseGImpactShapeForPrims { get; set; } + public static bool ShouldUseAssetHulls { get; set; } public static float TerrainImplementation { get; set; } public static int TerrainMeshMagnification { get; private set; } @@ -372,6 +373,8 @@ public static class BSParam true ), new ParameterDefn("ShouldUseGImpactShapeForPrims", "If true, use a GImpact shape for prims with cuts and twists", false ), + new ParameterDefn("UseAssetHulls", "If true, use hull if specified in the mesh asset info", + false ), new ParameterDefn("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", 5 ), -- cgit v1.1 From 6596a1de806d1ec509f3a570a0944ab9aff5947c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 21 May 2013 22:16:18 -0700 Subject: Revert "BulletSim: add code to experimentally use asset hull data." This reverts commit 2fd8819a043269f9308cb46c71893e6eb35a426e. Remove this code until I can figure out why the references that are clearly in prebuild.xml doesn't work for the 'using OpenSim.Region.Physics.Meshing' in BSShape.cs. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 5cff668..9a9e527 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -90,7 +90,6 @@ public static class BSParam public static bool ShouldUseBulletHACD { get; set; } public static bool ShouldUseSingleConvexHullForPrims { get; set; } public static bool ShouldUseGImpactShapeForPrims { get; set; } - public static bool ShouldUseAssetHulls { get; set; } public static float TerrainImplementation { get; set; } public static int TerrainMeshMagnification { get; private set; } @@ -373,8 +372,6 @@ public static class BSParam true ), new ParameterDefn("ShouldUseGImpactShapeForPrims", "If true, use a GImpact shape for prims with cuts and twists", false ), - new ParameterDefn("UseAssetHulls", "If true, use hull if specified in the mesh asset info", - false ), new ParameterDefn("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", 5 ), -- cgit v1.1 From ffc9b3dda766c15e053b9296d15356533f7e99f8 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 21 May 2013 21:32:30 -0700 Subject: BulletSim: add code to experimentally use asset hull data. Default to 'off' as it needs debugging. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 9a9e527..5cff668 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -90,6 +90,7 @@ public static class BSParam public static bool ShouldUseBulletHACD { get; set; } public static bool ShouldUseSingleConvexHullForPrims { get; set; } public static bool ShouldUseGImpactShapeForPrims { get; set; } + public static bool ShouldUseAssetHulls { get; set; } public static float TerrainImplementation { get; set; } public static int TerrainMeshMagnification { get; private set; } @@ -372,6 +373,8 @@ public static class BSParam true ), new ParameterDefn("ShouldUseGImpactShapeForPrims", "If true, use a GImpact shape for prims with cuts and twists", false ), + new ParameterDefn("UseAssetHulls", "If true, use hull if specified in the mesh asset info", + false ), new ParameterDefn("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", 5 ), -- cgit v1.1 From 5efce21abc92fa1005fa8651a5622fe72cf83ff3 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 22 May 2013 21:57:07 -0700 Subject: BulletSim: correct errors caused by misspelled INI parameter spec. Add debugging messages for hull asset use. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 5cff668..c19eda1 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -373,7 +373,7 @@ public static class BSParam true ), new ParameterDefn("ShouldUseGImpactShapeForPrims", "If true, use a GImpact shape for prims with cuts and twists", false ), - new ParameterDefn("UseAssetHulls", "If true, use hull if specified in the mesh asset info", + new ParameterDefn("ShouldUseAssetHulls", "If true, use hull if specified in the mesh asset info", false ), new ParameterDefn("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", -- cgit v1.1 From 5f1f5ea5ab5badf5944471fefe0a45f7b4f41b91 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 24 May 2013 16:24:16 -0700 Subject: BulletSim: add VehicleInertiaFactor to allow modifying inertia. Another parameter for vehicle operation tuning. Default to <1,1,1> which means nothing is different under normal use. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index c19eda1..e98a7fb 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -148,6 +148,7 @@ public static class BSParam public static float VehicleRestitution { get; private set; } public static Vector3 VehicleLinearFactor { get; private set; } public static Vector3 VehicleAngularFactor { get; private set; } + public static Vector3 VehicleInertiaFactor { get; private set; } public static float VehicleGroundGravityFudge { get; private set; } public static float VehicleAngularBankingTimescaleFudge { get; private set; } public static bool VehicleDebuggingEnable { get; private set; } @@ -583,6 +584,8 @@ public static class BSParam new Vector3(1f, 1f, 1f) ), new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (<0,0,0> to <1,1,1>)", new Vector3(1f, 1f, 1f) ), + new ParameterDefn("VehicleInertiaFactor", "Fraction of physical inertia applied (<0,0,0> to <1,1,1>)", + new Vector3(1f, 1f, 1f) ), new ParameterDefn("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", 0.0f ), new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", -- cgit v1.1 From 0c35d28933ddb2cae7b4f095b35ed4e386a1b71b Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 26 May 2013 17:35:12 -0700 Subject: BulletSim: enable GImpact shape for prims with cuts. Include DLLs and SOs which recompute GImpact shape bounding box after creation as Bullet doesn't do that itself (something it does for nearly every other shape). Now, physical prims without cuts become single mesh convex meshes. Physical prims with cuts become GImpact meshes. Meshes become a set of convex hulls approximated from the mesh unless the hulls are specified in the mesh asset data. The use of GImpact shapes should make some mechanical physics more stable. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index e98a7fb..0f0a494 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -373,7 +373,7 @@ public static class BSParam new ParameterDefn("ShouldUseSingleConvexHullForPrims", "If true, use a single convex hull shape for physical prims", true ), new ParameterDefn("ShouldUseGImpactShapeForPrims", "If true, use a GImpact shape for prims with cuts and twists", - false ), + true ), new ParameterDefn("ShouldUseAssetHulls", "If true, use hull if specified in the mesh asset info", false ), -- cgit v1.1 From 7c3a46cceaf9dac694b1c387f37adc2c51c6ee40 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 27 May 2013 14:38:59 -0700 Subject: BulletSim: default using mesh asset hulls to 'true'. This means that, if the mesh asset specifies physics hulls, BulletSim will fetch and use same rather than approximating the hulls. If physics hulls are not specified, the representation will fall back to the regular physics mesh. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 0f0a494..2651e3b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -373,9 +373,9 @@ public static class BSParam new ParameterDefn("ShouldUseSingleConvexHullForPrims", "If true, use a single convex hull shape for physical prims", true ), new ParameterDefn("ShouldUseGImpactShapeForPrims", "If true, use a GImpact shape for prims with cuts and twists", - true ), - new ParameterDefn("ShouldUseAssetHulls", "If true, use hull if specified in the mesh asset info", false ), + new ParameterDefn("ShouldUseAssetHulls", "If true, use hull if specified in the mesh asset info", + true ), new ParameterDefn("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", 5 ), -- cgit v1.1 From 07058b044be59b6e07efedeca36b2b464e984195 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 1 Jun 2013 14:52:44 -0700 Subject: BulletSim: experimental movement of physics execution off of heartbeat thread. Off by default until more testing. Setting "[BulletSim]UseSeparatePhysicsThread=true" causes the physics engine to be called on its own thread and the heartbeat thread only handles the reporting of property updates and collisions. Physics frame rate is about right but physics execution time goes to zero as accounted by the heartbeat loop. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 2651e3b..afd547a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -54,6 +54,9 @@ public static class BSParam // =================== // From: + public static bool UseSeparatePhysicsThread { get; private set; } + public static float PhysicsTimeStep { get; private set; } + // Level of Detail values kept as float because that's what the Meshmerizer wants public static float MeshLOD { get; private set; } public static float MeshCircularLOD { get; private set; } @@ -354,6 +357,11 @@ public static class BSParam // v = value (appropriate type) private static ParameterDefnBase[] ParameterDefinitions = { + new ParameterDefn("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat", + false ), + new ParameterDefn("PhysicsTimeStep", "If separate thread, seconds to simulate each interval", + 0.1f ), + new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", true, (s) => { return ShouldMeshSculptedPrim; }, -- cgit v1.1 From b5d0ac4c42629812523f5af4384f61dee00ef495 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 5 Jun 2013 07:12:14 -0700 Subject: BulletSim: default PhysicsTimeStep to same as the simulator's heartbeat timestep when running the physics engine on a separate thread. This reduces the occurance of heartbeats that happen when there is no physics step which is seen as vehicle jerkyness. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index afd547a..aad1108 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -360,7 +360,7 @@ public static class BSParam new ParameterDefn("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat", false ), new ParameterDefn("PhysicsTimeStep", "If separate thread, seconds to simulate each interval", - 0.1f ), + 0.089f ), new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", true, -- cgit v1.1 From bbeff4b8ca34a4567f2215ed5e90637a00d8c81e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 20 Jun 2013 09:55:40 -0700 Subject: BulletSim: rework velocity updating when not colliding and not flying to prevent infinite jumps. Now jumps last only AvatarJumpFrames long (default 4) which is about as high as in SL. TODO: jumping should only depend on standing (collision with feet) rather than collision anywhere on the avatar. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index aad1108..6437b04 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -134,6 +134,7 @@ public static class BSParam public static float AvatarHeightMidFudge { get; private set; } public static float AvatarHeightHighFudge { get; private set; } public static float AvatarContactProcessingThreshold { get; private set; } + public static int AvatarJumpFrames { get; private set; } public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } public static float AvatarStepHeight { get; private set; } public static float AvatarStepApproachFactor { get; private set; } @@ -567,6 +568,8 @@ public static class BSParam 0.1f ), new ParameterDefn("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", 1.0f ), + new ParameterDefn("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.", + 4 ), new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", 0.6f ) , new ParameterDefn("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", -- cgit v1.1 From 2f4a729d408acfd311c8b7bc53d2cbff9d2ddfad Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 29 Jun 2013 06:42:38 -0700 Subject: BulletSim: add inTaintTime parameter to collision cache clear function. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 6437b04..d17c8e7 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -706,7 +706,7 @@ public static class BSParam new ParameterDefn("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool", 0f, (s) => { return 0f; }, - (s,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ), + (s,v) => { BSParam.ResetBroadphasePoolTainted(s, v, false /* inTaintTime */); } ), new ParameterDefn("ResetConstraintSolver", "Setting this is any value resets the constraint solver", 0f, (s) => { return 0f; }, @@ -792,10 +792,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) + private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v, bool inTaintTime) { BSScene physScene = pPhysScene; - physScene.TaintedObject("BSParam.ResetBroadphasePoolTainted", delegate() + physScene.TaintedObject(inTaintTime, "BSParam.ResetBroadphasePoolTainted", delegate() { physScene.PE.ResetBroadphasePool(physScene.World); }); -- cgit v1.1 From 03268d85c41c94e7b35802b9dea1ce08299e5426 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 2 Jun 2013 10:04:15 -0700 Subject: BulletSim: comments and non-functional changes working toward the center-of-gravity implementation. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index d17c8e7..0f84bf7 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -176,6 +176,7 @@ public static class BSParam // Linkset implementation parameters public static float LinksetImplementation { get; private set; } + public static bool LinksetOffsetCenterOfMass { get; private set; } public static bool LinkConstraintUseFrameOffset { get; private set; } public static bool LinkConstraintEnableTransMotor { get; private set; } public static float LinkConstraintTransMotorMaxVel { get; private set; } @@ -684,6 +685,8 @@ public static class BSParam new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", (float)BSLinkset.LinksetImplementation.Compound ), + new ParameterDefn("LinksetOffsetCenterOfMass", "If 'true', compute linkset center-of-mass and offset linkset position to account for same", + false ), new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", false ), new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", -- cgit v1.1 From fad4241e4ea898b0dca0176cc9b428d03ba44d1c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 8 Jul 2013 16:21:10 -0700 Subject: BulletSim: make all the different angularVerticalAttraction algorithms selectable from configuration paramters. Changed default algorithm to "1" from previous default as it seems to handle Y axis correction a little better. Add config file independent enablement of vehicle angular forces to make debugging easier (independent testing of forces). --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 0f84bf7..75c3399 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -155,7 +155,10 @@ public static class BSParam public static Vector3 VehicleInertiaFactor { get; private set; } public static float VehicleGroundGravityFudge { get; private set; } public static float VehicleAngularBankingTimescaleFudge { get; private set; } - public static bool VehicleDebuggingEnable { get; private set; } + public static bool VehicleEnableAngularVerticalAttraction { get; private set; } + public static int VehicleAngularVerticalAttractionAlgorithm { get; private set; } + public static bool VehicleEnableAngularDeflection { get; private set; } + public static bool VehicleEnableAngularBanking { get; private set; } // Convex Hulls public static int CSHullMaxDepthSplit { get; private set; } @@ -606,8 +609,14 @@ public static class BSParam 0.2f ), new ParameterDefn("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", 60.0f ), - new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", - false ), + new ParameterDefn("VehicleEnableAngularVerticalAttraction", "Turn on/off vehicle angular vertical attraction effect", + true ), + new ParameterDefn("VehicleAngularVerticalAttractionAlgorithm", "Select vertical attraction algo. You need to look at the source.", + 1 ), + new ParameterDefn("VehicleEnableAngularDeflection", "Turn on/off vehicle angular deflection effect", + true ), + new ParameterDefn("VehicleEnableAngularBanking", "Turn on/off vehicle angular banking effect", + true ), new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", 0f, -- cgit v1.1 From 2c761cef192670a6f54fe10bb5b5894b5371ea7c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 9 Jul 2013 09:33:46 -0700 Subject: BulletSim: add parameter to optionally disable vehicle linear deflection. Add parameter to not apply vehicle linear deflection Z forces if vehicle is not colliding. This defaults to 'true' so vehicles will fall even if there is some linear deflection to apply. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 75c3399..dcf1e83 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -155,6 +155,8 @@ public static class BSParam public static Vector3 VehicleInertiaFactor { get; private set; } public static float VehicleGroundGravityFudge { get; private set; } public static float VehicleAngularBankingTimescaleFudge { get; private set; } + public static bool VehicleEnableLinearDeflection { get; private set; } + public static bool VehicleLinearDeflectionNotCollidingNoZ { get; private set; } public static bool VehicleEnableAngularVerticalAttraction { get; private set; } public static int VehicleAngularVerticalAttractionAlgorithm { get; private set; } public static bool VehicleEnableAngularDeflection { get; private set; } @@ -609,10 +611,14 @@ public static class BSParam 0.2f ), new ParameterDefn("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", 60.0f ), + new ParameterDefn("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect", + true ), + new ParameterDefn("VehicleLinearDeflectionNotCollidingNoZ", "Turn on/off linear deflection Z effect on non-colliding vehicles", + true ), new ParameterDefn("VehicleEnableAngularVerticalAttraction", "Turn on/off vehicle angular vertical attraction effect", true ), new ParameterDefn("VehicleAngularVerticalAttractionAlgorithm", "Select vertical attraction algo. You need to look at the source.", - 1 ), + 0 ), new ParameterDefn("VehicleEnableAngularDeflection", "Turn on/off vehicle angular deflection effect", true ), new ParameterDefn("VehicleEnableAngularBanking", "Turn on/off vehicle angular banking effect", -- cgit v1.1 From aec8d1e6be43422b0f93de47d6e46cc3e17399cc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 23 Jul 2013 09:09:25 -0700 Subject: BulletSim: Turn on center-of-mass calculation by default. Reduce object density by factor of 100 to bring physical mass computations into a range better suited for Bullet. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index dcf1e83..0bdb5f1 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -461,8 +461,9 @@ public static class BSParam (s) => { return MaxAddForceMagnitude; }, (s,v) => { MaxAddForceMagnitude = v; MaxAddForceMagnitudeSquared = v * v; } ), // Density is passed around as 100kg/m3. This scales that to 1kg/m3. + // Reduce by power of 100 because Bullet doesn't seem to handle objects with large mass very well new ParameterDefn("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", - 0.01f ), + 0.0001f ), new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", 2200f ), @@ -607,8 +608,9 @@ public static class BSParam 0.0f ), new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", 0.0f ), + // Turn off fudge with DensityScaleFactor = 0.0001. Value used to be 0.2f; new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", - 0.2f ), + 1.0f ), new ParameterDefn("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", 60.0f ), new ParameterDefn("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect", @@ -701,7 +703,7 @@ public static class BSParam new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", (float)BSLinkset.LinksetImplementation.Compound ), new ParameterDefn("LinksetOffsetCenterOfMass", "If 'true', compute linkset center-of-mass and offset linkset position to account for same", - false ), + true ), new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", false ), new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", -- cgit v1.1 From 5a7784a0e6c3f549d0e7b59380ad05729cb93a4f Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 24 Jul 2013 10:52:54 -0700 Subject: BulletSim: make density display and return value consistant with how the simulator expects it (scaled to 100kg/m^3). --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 0bdb5f1..4520171 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -463,7 +463,7 @@ public static class BSParam // Density is passed around as 100kg/m3. This scales that to 1kg/m3. // Reduce by power of 100 because Bullet doesn't seem to handle objects with large mass very well new ParameterDefn("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", - 0.0001f ), + 0.01f ), new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", 2200f ), @@ -474,8 +474,9 @@ public static class BSParam 0.2f, (s) => { return DefaultFriction; }, (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), + // For historical reasons, the viewer and simulator multiply the density by 100 new ParameterDefn("DefaultDensity", "Density for new objects" , - 10.000006836f, // Aluminum g/cm3 + 1000.0006836f, // Aluminum g/cm3 * 100 (s) => { return DefaultDensity; }, (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , @@ -555,8 +556,9 @@ public static class BSParam 0.95f ), new ParameterDefn("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", 1.3f ), - new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", - 3.5f) , + // For historical reasons, density is reported * 100 + new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation. Scaled times 100.", + 3500f) , // 3.5 * 100 new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 0f ), new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", @@ -608,9 +610,8 @@ public static class BSParam 0.0f ), new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", 0.0f ), - // Turn off fudge with DensityScaleFactor = 0.0001. Value used to be 0.2f; new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", - 1.0f ), + 0.2f ), new ParameterDefn("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", 60.0f ), new ParameterDefn("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect", -- cgit v1.1 From 6410a25cefcb1e7f87b76f273f8c6569fbe17670 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 8 Aug 2013 13:53:12 -0700 Subject: BulletSim: adjust avatar position when the avatar's size is changed. This fixes the problem of avatars bouncing when logged in. Added a little height to the avatar height fudges to eliminate a problem of feet being in the ground a bit. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 4520171..fcb892a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -570,9 +570,9 @@ public static class BSParam new ParameterDefn("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", -0.2f ), new ParameterDefn("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", - 0.1f ), + 0.2f ), new ParameterDefn("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", - 0.1f ), + 0.2f ), new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 0.1f ), new ParameterDefn("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", -- cgit v1.1 From b2a1348adc2bd27d3266a7d7c7594a2aa8272100 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 8 Aug 2013 16:37:37 -0700 Subject: BulletSim: update C++ HACD parameters to values that handle enclosed hollow spaces better. This shouldn't affect many since this HACD routine is off by default. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index fcb892a..737dda1 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -683,21 +683,21 @@ public static class BSParam 0f ), new ParameterDefn("BHullMaxVerticesPerHull", "Bullet impl: max number of vertices per created hull", - 100f ), + 200f ), new ParameterDefn("BHullMinClusters", "Bullet impl: minimum number of hulls to create per mesh", - 2f ), + 10f ), new ParameterDefn("BHullCompacityWeight", "Bullet impl: weight factor for how compact to make hulls", - 0.1f ), + 20f ), new ParameterDefn("BHullVolumeWeight", "Bullet impl: weight factor for volume in created hull", - 0f ), + 0.1f ), new ParameterDefn("BHullConcavity", "Bullet impl: weight factor for how convex a created hull can be", - 100f ), + 10f ), new ParameterDefn("BHullAddExtraDistPoints", "Bullet impl: whether to add extra vertices for long distance vectors", - false ), + true ), new ParameterDefn("BHullAddNeighboursDistPoints", "Bullet impl: whether to add extra vertices between neighbor hulls", - false ), + true ), new ParameterDefn("BHullAddFacesPoints", "Bullet impl: whether to add extra vertices to break up hull faces", - false ), + true ), new ParameterDefn("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin", false ), -- cgit v1.1 From 6d83f3f02190509119f65da92def19d08ef825f9 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 19 Aug 2013 11:08:22 -0700 Subject: BulletSim: adjust avatar capsule height calculation to be closer to defined SL heights. Correct BSParam avatar height defaults to be what's in OpenSimDefaults.ini. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 737dda1..4e92e6d 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -570,9 +570,9 @@ public static class BSParam new ParameterDefn("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", -0.2f ), new ParameterDefn("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", - 0.2f ), + 0.1f ), new ParameterDefn("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", - 0.2f ), + 0.1f ), new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 0.1f ), new ParameterDefn("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", -- cgit v1.1 From 995314f91f72eef0048a58f30e8dd8051f6bf14e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 20 Aug 2013 09:20:48 -0700 Subject: BulletSim: add ID parameter to TaintedObject calls so logging will include LocalID of object which created the taint. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 4e92e6d..2f1799b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -826,7 +826,7 @@ public static class BSParam private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v) { BSScene physScene = pPhysScene; - physScene.TaintedObject("BSParam.ResetConstraintSolver", delegate() + physScene.TaintedObject(BSScene.DetailLogZero, "BSParam.ResetConstraintSolver", delegate() { physScene.PE.ResetConstraintSolver(physScene.World); }); -- cgit v1.1 From 35a6361b2431abf9d49b4413c5b9eaac51934134 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 20 Sep 2013 09:23:12 -0700 Subject: BulletSim: reduce avatar walking stopped threshold. Add parameter for setting the walking stopped threshold. This fixes the slight jump when an avatar stops walking. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 2f1799b..43aa63e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -134,6 +134,7 @@ public static class BSParam public static float AvatarHeightMidFudge { get; private set; } public static float AvatarHeightHighFudge { get; private set; } public static float AvatarContactProcessingThreshold { get; private set; } + public static float AvatarStopZeroThreshold { get; private set; } public static int AvatarJumpFrames { get; private set; } public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } public static float AvatarStepHeight { get; private set; } @@ -575,6 +576,8 @@ public static class BSParam 0.1f ), new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 0.1f ), + new ParameterDefn("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", + 0.1f ), new ParameterDefn("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", 1.0f ), new ParameterDefn("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.", -- cgit v1.1 From 511122834b5cd95839029d28365e479dc25eae9d Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 23 Oct 2013 16:07:03 -0700 Subject: BulletSim: change collision flags for groundplane to not interact with static objects. Reorder collision flag setting code for terrain to fit pattern used elsewhere. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 43aa63e..834228e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -120,6 +120,7 @@ public static class BSParam public static float NumberOfSolverIterations { get; private set; } public static bool UseSingleSidedMeshes { get; private set; } public static float GlobalContactBreakingThreshold { get; private set; } + public static float PhysicsUnmanLoggingFrames { get; private set; } // Avatar parameters public static float AvatarFriction { get; private set; } @@ -671,6 +672,10 @@ public static class BSParam 0f, (s) => { return GlobalContactBreakingThreshold; }, (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), + new ParameterDefn("PhysicsUnmanLoggingFrames", "If non-zero, frames between output of detailed unmanaged physics statistics", + 0f, + (s) => { return PhysicsUnmanLoggingFrames; }, + (s,v) => { PhysicsUnmanLoggingFrames = v; s.UnmanagedParams[0].physicsLoggingFrames = v; } ), new ParameterDefn("CSHullMaxDepthSplit", "CS impl: max depth to split for hull. 1-10 but > 7 is iffy", 7 ), -- cgit v1.1 From 0842e2e15b6af6f940648b0b74488f2da88ce920 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 29 Jan 2014 06:44:14 -0800 Subject: BulletSim: default physical terrain implementation to heightmap. It originally looked like mesh terrain would perform better for vehicles but, after much use, heightmap is the clear winner. Force terrain implementation to heightmap if the physics region is larger than legacy region size. This solves running out of memory for very large regions. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 834228e..d993e6a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -538,7 +538,7 @@ public static class BSParam (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", - (float)BSTerrainPhys.TerrainImplementation.Mesh ), + (float)BSTerrainPhys.TerrainImplementation.Heightmap ), new ParameterDefn("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , 2 ), new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , -- cgit v1.1 From 3a7c8d1f3265941105f9d7a5edc4f82057099a83 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 8 Feb 2014 16:11:43 -0800 Subject: BulletSim: the minimum vehicle velocity was set too low so moving slow was getting zeroed too easily. Added VehicleMinVelocity parameter. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index d993e6a..860193f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -147,6 +147,8 @@ public static class BSParam // Vehicle parameters public static float VehicleMaxLinearVelocity { get; private set; } public static float VehicleMaxLinearVelocitySquared { get; private set; } + public static float VehicleMinLinearVelocity { get; private set; } + public static float VehicleMinLinearVelocitySquared { get; private set; } public static float VehicleMaxAngularVelocity { get; private set; } public static float VehicleMaxAngularVelocitySq { get; private set; } public static float VehicleAngularDamping { get; private set; } @@ -598,6 +600,10 @@ public static class BSParam 1000.0f, (s) => { return (float)VehicleMaxLinearVelocity; }, (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySquared = v * v; } ), + new ParameterDefn("VehicleMinLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", + 0.001f, + (s) => { return (float)VehicleMinLinearVelocity; }, + (s,v) => { VehicleMinLinearVelocity = v; VehicleMinLinearVelocitySquared = v * v; } ), new ParameterDefn("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", 12.0f, (s) => { return (float)VehicleMaxAngularVelocity; }, -- cgit v1.1 From 65c4cb48ac49bd6aa9e813a401411be5226d01a7 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 2 Apr 2014 21:53:58 -0700 Subject: BulletSim: make avatar physical shape to be a rectangle rather than a capsule. Set the default to be the rectangle shape and adjust the parameters in OpenSimDefaults.ini for the new shape. The rectangle shape will perform better and avatar height can be computed more accurately. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 860193f..4d14a9e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -128,6 +128,7 @@ public static class BSParam public static float AvatarAlwaysRunFactor { get; private set; } public static float AvatarDensity { get; private set; } public static float AvatarRestitution { get; private set; } + public static int AvatarShape { get; private set; } public static float AvatarCapsuleWidth { get; private set; } public static float AvatarCapsuleDepth { get; private set; } public static float AvatarCapsuleHeight { get; private set; } @@ -565,6 +566,8 @@ public static class BSParam 3500f) , // 3.5 * 100 new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 0f ), + new ParameterDefn("AvatarShape", "Code for avatar physical shape: 0:capsule, 1:cube, 2:ovoid, 2:mesh", + BSShapeCollection.AvatarShapeCube ) , new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", 0.6f ) , new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", @@ -572,11 +575,11 @@ public static class BSParam new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", 1.5f ), new ParameterDefn("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", - -0.2f ), + 0f ), new ParameterDefn("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", - 0.1f ), + -0.1f ), new ParameterDefn("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", - 0.1f ), + 0f ), new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 0.1f ), new ParameterDefn("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", -- cgit v1.1 From 562a3cb3389ae67e6f7e63c7bf1ff9b882e358a9 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 10 Apr 2014 06:53:36 -0700 Subject: BulletSim: small tweek to avatar height reduce feet embedded into prims. This adjustment makes a default, shoeless avatar stand properly on a prim for the various heights (0% to 100% in the appearance adjustment). --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 4d14a9e..c977a5d 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -577,7 +577,7 @@ public static class BSParam new ParameterDefn("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", 0f ), new ParameterDefn("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", - -0.1f ), + 0f ), new ParameterDefn("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", 0f ), new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", -- cgit v1.1 From c8914d22ebb66fd9601161c9826d8b29ff6cb561 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 12 Apr 2014 17:37:57 -0700 Subject: BulletSim: reduce the terrain collison margin to be the same as other objects in the world. This was originally changed in an attempt to make vehicles work better but the effect was not that large and it causes avatars to float above the terrain. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index c977a5d..f2ad528 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -553,7 +553,7 @@ public static class BSParam new ParameterDefn("TerrainContactProcessingThreshold", "Distance from terrain to stop processing collisions" , 0.0f ), new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , - 0.08f ), + 0.04f ), new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", 0.2f ), -- cgit v1.1 From 63aea3a5f281ac396787beab5615214b36e2332e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 28 Apr 2014 11:08:47 -0700 Subject: BUlletSim: move safeynet ground plane to lower altitude. Define new BulletSim parameter 'TerrainGroundPlane' which defaults to -500. BulletSim had assumed altitudes never went negative but that is not true. The ground plane is just a safety net so things wouldn't fall to infinity. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index f2ad528..6683446 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -97,6 +97,7 @@ public static class BSParam public static float TerrainImplementation { get; set; } public static int TerrainMeshMagnification { get; private set; } + public static float TerrainGroundPlane { get; private set; } public static float TerrainFriction { get; private set; } public static float TerrainHitFraction { get; private set; } public static float TerrainRestitution { get; private set; } @@ -544,6 +545,8 @@ public static class BSParam (float)BSTerrainPhys.TerrainImplementation.Heightmap ), new ParameterDefn("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , 2 ), + new ParameterDefn("TerrainGroundPlane", "Altitude of ground plane used to keep things from falling to infinity" , + -500.0f ), new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , 0.3f ), new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , -- cgit v1.1 From 0be9e3b079088829eec49d856980f14a6372fda4 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 17 May 2014 20:11:22 -0700 Subject: BulletSim: adjust avatar step up parameters to better walk up small staircases. This change is required because of the change in the avatar default shape from the capsule to the rectangle. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 6683446..de42a4c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -598,9 +598,9 @@ public static class BSParam new ParameterDefn("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", 1.0f ), new ParameterDefn("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step", - 1.0f ), + 2.0f ), new ParameterDefn("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs", - 2 ), + 1 ), new ParameterDefn("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", 1000.0f, -- cgit v1.1 From f348928590de1b7044801f72d3c415cb10175d45 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 18 Jun 2014 22:39:28 -0700 Subject: BulletSim: more tweeks to AliciaRaven's flying mods. Added parameters AvatarFlyingGroundMargin and AvatarFlyingGroundUpForce set to 5.0 and 2.0 respectively which seems to give about the same action as in SL. Also moved force addition to before the velocity to force computation so the upward velocity is properly applied to the avatar mass. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index de42a4c..042e8a4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -136,6 +136,8 @@ public static class BSParam public static float AvatarHeightLowFudge { get; private set; } public static float AvatarHeightMidFudge { get; private set; } public static float AvatarHeightHighFudge { get; private set; } + public static float AvatarFlyingGroundMargin { get; private set; } + public static float AvatarFlyingGroundUpForce { get; private set; } public static float AvatarContactProcessingThreshold { get; private set; } public static float AvatarStopZeroThreshold { get; private set; } public static int AvatarJumpFrames { get; private set; } @@ -583,6 +585,10 @@ public static class BSParam 0f ), new ParameterDefn("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", 0f ), + new ParameterDefn("AvatarFlyingGroundMargin", "Meters avatar is kept above the ground when flying", + 5f ), + new ParameterDefn("AvatarFlyingGroundUpForce", "Upward force applied to the avatar to keep it at flying ground margin", + 2.0f ), new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 0.1f ), new ParameterDefn("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", -- cgit v1.1 From abf85b7f192e167ed5f462ac8d1a8de365e4f03b Mon Sep 17 00:00:00 2001 From: Vegaslon Date: Fri, 20 Jun 2014 09:34:07 -0400 Subject: Bulletsim: Create AvatarTerminalVelocity to BulletSim like what ODE and SL has. Before this falling from really high caused the avatar to fall faster then the veiwer can handle and cause camera issues. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 042e8a4..8b4df05 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -138,6 +138,7 @@ public static class BSParam public static float AvatarHeightHighFudge { get; private set; } public static float AvatarFlyingGroundMargin { get; private set; } public static float AvatarFlyingGroundUpForce { get; private set; } + public static float AvatarTerminalVelocity { get; private set; } public static float AvatarContactProcessingThreshold { get; private set; } public static float AvatarStopZeroThreshold { get; private set; } public static int AvatarJumpFrames { get; private set; } @@ -589,6 +590,8 @@ public static class BSParam 5f ), new ParameterDefn("AvatarFlyingGroundUpForce", "Upward force applied to the avatar to keep it at flying ground margin", 2.0f ), + new ParameterDefn("AvatarTerminalVelocity", "Terminal Velocity of falling avatar", + -54.0f ), new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 0.1f ), new ParameterDefn("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", -- cgit v1.1 From 3654ae8d8cea0bf0455974efe18ff99e484d2893 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 29 Jul 2014 01:21:15 +0100 Subject: Allow the "debug scene set physics false|true" command to work when bulletsim physics is running in a separate thread. This will also allow the "disable physics" setting in the region debug viewer dialog to work in this circumstance. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 8b4df05..867d6ff 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -54,6 +54,14 @@ public static class BSParam // =================== // From: + /// + /// Set whether physics is active or not. + /// + /// + /// Can be enabled and disabled to start and stop physics. + /// + public static bool Active { get; private set; } + public static bool UseSeparatePhysicsThread { get; private set; } public static float PhysicsTimeStep { get; private set; } @@ -373,6 +381,8 @@ public static class BSParam // v = value (appropriate type) private static ParameterDefnBase[] ParameterDefinitions = { + new ParameterDefn("Active", "If 'true', false then physics is not active", + false ), new ParameterDefn("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat", false ), new ParameterDefn("PhysicsTimeStep", "If separate thread, seconds to simulate each interval", -- cgit v1.1 From 124be38f745b884fac5dbdb6ef963387235f6108 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 20 Nov 2014 21:28:12 +0000 Subject: Add [BulletSim] option AvatarToAvatarCollisionsByDefault to control whether avatars collide. This is true by default. This is implemented with a new collision type (PhantomToOthersAvatar) to potentially allow colliding and non-colliding avatars to be present in the same scene. So there is no provision yet for giving avatars different collision types. This commit replaces the temporary change in commit f3eaa6d8 where avatars would never collide when using BulletSim This is equivalent to the av_av_collisions_off option in ODE. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 867d6ff..e7f4def 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -132,6 +132,7 @@ public static class BSParam public static float PhysicsUnmanLoggingFrames { get; private set; } // Avatar parameters + public static bool AvatarToAvatarCollisionsByDefault { get; private set; } public static float AvatarFriction { get; private set; } public static float AvatarStandingFriction { get; private set; } public static float AvatarAlwaysRunFactor { get; private set; } @@ -571,6 +572,8 @@ public static class BSParam new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , 0.04f ), + new ParameterDefn("AvatarToAvatarCollisionsByDefault", "Should avatars collide with other avatars by default?", + true), new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", 0.2f ), new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", -- cgit v1.1 From 700543b161f653ea41faf3d125a1eb9be389ec23 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 7 Jan 2015 06:39:29 -0800 Subject: BulletSim: tweek step parameters and logic to make walking up steps closer to SL. This change should address small floor edges acting like walls, approaching a step at any angle (other than walking backwards) will allow walking up, and reducing the avatar pop-up when going up stairs. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index e7f4def..ef75e3f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -153,6 +153,8 @@ public static class BSParam public static int AvatarJumpFrames { get; private set; } public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } public static float AvatarStepHeight { get; private set; } + public static float AvatarStepAngle { get; private set; } + public static float AvatarStepGroundFudge { get; private set; } public static float AvatarStepApproachFactor { get; private set; } public static float AvatarStepForceFactor { get; private set; } public static float AvatarStepUpCorrectionFactor { get; private set; } @@ -614,13 +616,17 @@ public static class BSParam new ParameterDefn("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.", 4 ), new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", - 0.6f ) , + 0.999f ) , + new ParameterDefn("AvatarStepAngle", "The angle (in radians) for a vertical surface to be considered a step", + 0.3f ) , + new ParameterDefn("AvatarStepGroundFudge", "Fudge factor subtracted from avatar base when comparing collision height", + 0.1f ) , new ParameterDefn("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", - 0.6f ), + 2f ), new ParameterDefn("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", - 1.0f ), + 0f ), new ParameterDefn("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step", - 2.0f ), + 0.8f ), new ParameterDefn("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs", 1 ), -- cgit v1.1 From de7611662472ffcae3c18976037a87a384864308 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 25 Jan 2015 13:24:09 -0800 Subject: BulletSim: add parameters and parameter definitions for VHACD addition coming. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 44 +++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index ef75e3f..6d46fe6 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -183,6 +183,7 @@ public static class BSParam public static bool VehicleEnableAngularBanking { get; private set; } // Convex Hulls + // Parameters for convex hull routine that ships with Bullet public static int CSHullMaxDepthSplit { get; private set; } public static int CSHullMaxDepthSplitForSimpleShapes { get; private set; } public static float CSHullConcavityThresholdPercent { get; private set; } @@ -198,6 +199,22 @@ public static class BSParam public static bool BHullAddNeighboursDistPoints { get; private set; } // false public static bool BHullAddFacesPoints { get; private set; } // false public static bool BHullShouldAdjustCollisionMargin { get; private set; } // false + public static float WhichHACD { get; private set; } // zero if Bullet HACD, non-zero says VHACD + // Parameters for VHACD 2.0: http://code.google.com/p/v-hacd + // To enable, set both ShouldUseBulletHACD=true and WhichHACD=1 + // http://kmamou.blogspot.ca/2014/12/v-hacd-20-parameters-description.html + public static float VHACDresolution { get; private set; } // 100,000 max number of voxels generated during voxelization stage + public static float VHACDdepth { get; private set; } // 20 max number of clipping stages + public static float VHACDconcavity { get; private set; } // 0.0025 maximum concavity + public static float VHACDplaneDownsampling { get; private set; } // 4 granularity of search for best clipping plane + public static float VHACDconvexHullDownsampling { get; private set; } // 4 precision of hull gen process + public static float VHACDalpha { get; private set; } // 0.05 bias toward clipping along symmetry planes + public static float VHACDbeta { get; private set; } // 0.05 bias toward clipping along revolution axis + public static float VHACDgamma { get; private set; } // 0.00125 max concavity when merging + public static float VHACDpca { get; private set; } // 0 on/off normalizing mesh before decomp + public static float VHACDmode { get; private set; } // 0 0:voxel based, 1: tetrahedron based + public static float VHACDmaxNumVerticesPerCH { get; private set; } // 64 max triangles per convex hull + public static float VHACDminVolumePerCH { get; private set; } // 0.0001 sampling of generated convex hulls // Linkset implementation parameters public static float LinksetImplementation { get; private set; } @@ -749,6 +766,33 @@ public static class BSParam new ParameterDefn("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin", false ), + new ParameterDefn("WhichHACD", "zero if Bullet HACD, non-zero says VHACD", + 0f ), + new ParameterDefn("VHACDresolution", "max number of voxels generated during voxelization stage", + 100000f ), + new ParameterDefn("VHACDdepth", "max number of clipping stages", + 20f ), + new ParameterDefn("VHACDconcavity", "maximum concavity", + 0.0025f ), + new ParameterDefn("VHACDplaneDownsampling", "granularity of search for best clipping plane", + 4f ), + new ParameterDefn("VHACDconvexHullDownsampling", "precision of hull gen process", + 4f ), + new ParameterDefn("VHACDalpha", "bias toward clipping along symmetry planes", + 0.05f ), + new ParameterDefn("VHACDbeta", "bias toward clipping along revolution axis", + 0.05f ), + new ParameterDefn("VHACDgamma", "max concavity when merging", + 0.00125f ), + new ParameterDefn("VHACDpca", "on/off normalizing mesh before decomp", + 0f ), + new ParameterDefn("VHACDmode", "0:voxel based, 1: tetrahedron based", + 0f ), + new ParameterDefn("VHACDmaxNumVerticesPerCH", "max triangles per convex hull", + 64f ), + new ParameterDefn("VHACDminVolumePerCH", "sampling of generated convex hulls", + 0.0001f ), + new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", (float)BSLinkset.LinksetImplementation.Compound ), new ParameterDefn("LinksetOffsetCenterOfMass", "If 'true', compute linkset center-of-mass and offset linkset position to account for same", -- cgit v1.1