// All default parameter values are set here. There should be no values set in the
        // variable definitions.
        private void GetInitialParameterValues(IConfigSource config)
        {
            ConfigurationParameters parms = new ConfigurationParameters();

            UnmanagedParams[0] = parms;

            BSParam.SetParameterDefaultValues(this);

            if (config != null)
            {
                // If there are specifications in the ini file, use those values
                IConfig pConfig = config.Configs["BulletSim"];
                if (pConfig != null)
                {
                    BSParam.SetParameterConfigurationValues(this, pConfig);

                    // There are two Bullet implementations to choose from
                    BulletEngineName = pConfig.GetString("BulletEngine", "BulletUnmanaged");

                    // Very detailed logging for physics debugging
                    // TODO: the boolean values can be moved to the normal parameter processing.
                    m_physicsLoggingEnabled      = pConfig.GetBoolean("PhysicsLoggingEnabled", false);
                    m_physicsLoggingDir          = pConfig.GetString("PhysicsLoggingDir", ".");
                    m_physicsLoggingPrefix       = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-");
                    m_physicsLoggingFileMinutes  = pConfig.GetInt("PhysicsLoggingFileMinutes", 5);
                    m_physicsLoggingDoFlush      = pConfig.GetBoolean("PhysicsLoggingDoFlush", false);
                    m_physicsPhysicalDumpEnabled = pConfig.GetBoolean("PhysicsPhysicalDumpEnabled", false);
                    // Very detailed logging for vehicle debugging
                    VehicleLoggingEnabled         = pConfig.GetBoolean("VehicleLoggingEnabled", false);
                    VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false);

                    // Do any replacements in the parameters
                    m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName);
                }
                else
                {
                    // Nothing in the configuration INI file so assume unmanaged and other defaults.
                    BulletEngineName        = "BulletUnmanaged";
                    m_physicsLoggingEnabled = false;
                    VehicleLoggingEnabled   = false;
                }

                // The material characteristics.
                BSMaterials.InitializeFromDefaults(Params);
                if (pConfig != null)
                {
                    // Let the user add new and interesting material property values.
                    BSMaterials.InitializefromParameters(pConfig);
                }
            }
        }
Beispiel #2
0
        // This is where all the default material attributes are defined.
        public static void InitializeFromDefaults(ConfigurationParameters parms)
        {
            // Values from http://wiki.secondlife.com/wiki/PRIM_MATERIAL
            float dDensity     = parms.defaultDensity;
            float dFriction    = parms.defaultFriction;
            float dRestitution = parms.defaultRestitution;

            Attributes[(int)MaterialAttributes.Material.Stone] =
                new MaterialAttributes("stone", dDensity, 0.8f, 0.4f);
            Attributes[(int)MaterialAttributes.Material.Metal] =
                new MaterialAttributes("metal", dDensity, 0.3f, 0.4f);
            Attributes[(int)MaterialAttributes.Material.Glass] =
                new MaterialAttributes("glass", dDensity, 0.2f, 0.7f);
            Attributes[(int)MaterialAttributes.Material.Wood] =
                new MaterialAttributes("wood", dDensity, 0.6f, 0.5f);
            Attributes[(int)MaterialAttributes.Material.Flesh] =
                new MaterialAttributes("flesh", dDensity, 0.9f, 0.3f);
            Attributes[(int)MaterialAttributes.Material.Plastic] =
                new MaterialAttributes("plastic", dDensity, 0.4f, 0.7f);
            Attributes[(int)MaterialAttributes.Material.Rubber] =
                new MaterialAttributes("rubber", dDensity, 0.9f, 0.9f);
            Attributes[(int)MaterialAttributes.Material.Light] =
                new MaterialAttributes("light", dDensity, dFriction, dRestitution);
            Attributes[(int)MaterialAttributes.Material.Avatar] =
                new MaterialAttributes("avatar", 3.5f, 0.2f, 0f);

            Attributes[(int)MaterialAttributes.Material.Stone + (int)MaterialAttributes.Material.NumberOfTypes] =
                new MaterialAttributes("stonePhysical", dDensity, 0.8f, 0.4f);
            Attributes[(int)MaterialAttributes.Material.Metal + (int)MaterialAttributes.Material.NumberOfTypes] =
                new MaterialAttributes("metalPhysical", dDensity, 0.3f, 0.4f);
            Attributes[(int)MaterialAttributes.Material.Glass + (int)MaterialAttributes.Material.NumberOfTypes] =
                new MaterialAttributes("glassPhysical", dDensity, 0.2f, 0.7f);
            Attributes[(int)MaterialAttributes.Material.Wood + (int)MaterialAttributes.Material.NumberOfTypes] =
                new MaterialAttributes("woodPhysical", dDensity, 0.6f, 0.5f);
            Attributes[(int)MaterialAttributes.Material.Flesh + (int)MaterialAttributes.Material.NumberOfTypes] =
                new MaterialAttributes("fleshPhysical", dDensity, 0.9f, 0.3f);
            Attributes[(int)MaterialAttributes.Material.Plastic + (int)MaterialAttributes.Material.NumberOfTypes] =
                new MaterialAttributes("plasticPhysical", dDensity, 0.4f, 0.7f);
            Attributes[(int)MaterialAttributes.Material.Rubber + (int)MaterialAttributes.Material.NumberOfTypes] =
                new MaterialAttributes("rubberPhysical", dDensity, 0.9f, 0.9f);
            Attributes[(int)MaterialAttributes.Material.Light + (int)MaterialAttributes.Material.NumberOfTypes] =
                new MaterialAttributes("lightPhysical", dDensity, dFriction, dRestitution);
            Attributes[(int)MaterialAttributes.Material.Avatar + (int)MaterialAttributes.Material.NumberOfTypes] =
                new MaterialAttributes("avatarPhysical", 3.5f, 0.2f, 0f);
        }
Beispiel #3
0
    // This is where all the default material attributes are defined.
    public static void InitializeFromDefaults(ConfigurationParameters parms)
    {
        // Values from http://wiki.secondlife.com/wiki/PRIM_MATERIAL
        float dDensity = parms.defaultDensity;
        float dFriction = parms.defaultFriction;
        float dRestitution = parms.defaultRestitution;
        Attributes[(int)MaterialAttributes.Material.Stone] =
                    new MaterialAttributes("stone",dDensity, 0.8f, 0.4f);
        Attributes[(int)MaterialAttributes.Material.Metal] =
                    new MaterialAttributes("metal",dDensity, 0.3f, 0.4f);
        Attributes[(int)MaterialAttributes.Material.Glass] =
                    new MaterialAttributes("glass",dDensity, 0.2f, 0.7f);
        Attributes[(int)MaterialAttributes.Material.Wood] =
                    new MaterialAttributes("wood",dDensity, 0.6f, 0.5f);
        Attributes[(int)MaterialAttributes.Material.Flesh] =
                    new MaterialAttributes("flesh",dDensity, 0.9f, 0.3f);
        Attributes[(int)MaterialAttributes.Material.Plastic] =
                    new MaterialAttributes("plastic",dDensity, 0.4f, 0.7f);
        Attributes[(int)MaterialAttributes.Material.Rubber] =
                    new MaterialAttributes("rubber",dDensity, 0.9f, 0.9f);
        Attributes[(int)MaterialAttributes.Material.Light] =
                    new MaterialAttributes("light",dDensity, dFriction, dRestitution);
        Attributes[(int)MaterialAttributes.Material.Avatar] =
                    new MaterialAttributes("avatar",3.5f, 0.2f, 0f);

        Attributes[(int)MaterialAttributes.Material.Stone + (int)MaterialAttributes.Material.NumberOfTypes] =
                    new MaterialAttributes("stonePhysical",dDensity, 0.8f, 0.4f);
        Attributes[(int)MaterialAttributes.Material.Metal + (int)MaterialAttributes.Material.NumberOfTypes] =
                    new MaterialAttributes("metalPhysical",dDensity, 0.3f, 0.4f);
        Attributes[(int)MaterialAttributes.Material.Glass + (int)MaterialAttributes.Material.NumberOfTypes] =
                    new MaterialAttributes("glassPhysical",dDensity, 0.2f, 0.7f);
        Attributes[(int)MaterialAttributes.Material.Wood + (int)MaterialAttributes.Material.NumberOfTypes] =
                    new MaterialAttributes("woodPhysical",dDensity, 0.6f, 0.5f);
        Attributes[(int)MaterialAttributes.Material.Flesh + (int)MaterialAttributes.Material.NumberOfTypes] =
                    new MaterialAttributes("fleshPhysical",dDensity, 0.9f, 0.3f);
        Attributes[(int)MaterialAttributes.Material.Plastic + (int)MaterialAttributes.Material.NumberOfTypes] =
                    new MaterialAttributes("plasticPhysical",dDensity, 0.4f, 0.7f);
        Attributes[(int)MaterialAttributes.Material.Rubber + (int)MaterialAttributes.Material.NumberOfTypes] =
                    new MaterialAttributes("rubberPhysical",dDensity, 0.9f, 0.9f);
        Attributes[(int)MaterialAttributes.Material.Light + (int)MaterialAttributes.Material.NumberOfTypes] =
                    new MaterialAttributes("lightPhysical",dDensity, dFriction, dRestitution);
        Attributes[(int)MaterialAttributes.Material.Avatar + (int)MaterialAttributes.Material.NumberOfTypes] =
                    new MaterialAttributes("avatarPhysical",3.5f, 0.2f, 0f);
    }
Beispiel #4
0
    // All default parameter values are set here. There should be no values set in the
    // variable definitions.
    private void GetInitialParameterValues(IConfigSource config)
    {
        ConfigurationParameters parms = new ConfigurationParameters();
        UnmanagedParams[0] = parms;

        BSParam.SetParameterDefaultValues(this);

        if (config != null)
        {
            // If there are specifications in the ini file, use those values
            IConfig pConfig = config.Configs["BulletSim"];
            if (pConfig != null)
            {
                BSParam.SetParameterConfigurationValues(this, pConfig);

                // There are two Bullet implementations to choose from
                BulletEngineName = pConfig.GetString("BulletEngine", "BulletUnmanaged");

                // Very detailed logging for physics debugging
                // TODO: the boolean values can be moved to the normal parameter processing.
                m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false);
                m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", ".");
                m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-");
                m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5);
                m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false);
                m_physicsPhysicalDumpEnabled = pConfig.GetBoolean("PhysicsPhysicalDumpEnabled", false);
                // Very detailed logging for vehicle debugging
                VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false);
                VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false);

                // Do any replacements in the parameters
                m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName);
            }
            else
            {
                // Nothing in the configuration INI file so assume unmanaged and other defaults.
                BulletEngineName = "BulletUnmanaged";
                m_physicsLoggingEnabled = false;
                VehicleLoggingEnabled = false;
            }

            // The material characteristics.
            BSMaterials.InitializeFromDefaults(Params);
            if (pConfig != null)
            {
                // Let the user add new and interesting material property values.
                BSMaterials.InitializefromParameters(pConfig);
            }
        }
    }
 // Initialization and simulation
 public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
                                        int maxCollisions, ref CollisionDesc[] collisionArray,
                                        int maxUpdates, ref EntityProperties[] updateArray
                                        );
Beispiel #6
0
 // Initialization and simulation
 public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
     int maxCollisions,  ref CollisionDesc[] collisionArray,
     int maxUpdates, ref EntityProperties[] updateArray
     );
Beispiel #7
0
        private static DiscreteDynamicsWorld Initialize2(Vector3 worldExtent, 
            ConfigurationParameters[] o,
            int mMaxCollisionsPerFrame, ref CollisionDesc[] collisionArray,
            int mMaxUpdatesPerFrame, ref EntityProperties[] updateArray,
            object mDebugLogCallbackHandle)
        {
            CollisionWorld.WorldData.ParamData p = new CollisionWorld.WorldData.ParamData();

            p.angularDamping = BSParam.AngularDamping;
            p.defaultFriction = o[0].defaultFriction;
            p.defaultFriction = o[0].defaultFriction;
            p.defaultDensity = o[0].defaultDensity;
            p.defaultRestitution = o[0].defaultRestitution;
            p.collisionMargin = o[0].collisionMargin;
            p.gravity = o[0].gravity;

            p.linearDamping = BSParam.LinearDamping;
            p.angularDamping = BSParam.AngularDamping;
            p.deactivationTime = BSParam.DeactivationTime;
            p.linearSleepingThreshold = BSParam.LinearSleepingThreshold;
            p.angularSleepingThreshold = BSParam.AngularSleepingThreshold;
            p.ccdMotionThreshold = BSParam.CcdMotionThreshold;
            p.ccdSweptSphereRadius = BSParam.CcdSweptSphereRadius;
            p.contactProcessingThreshold = BSParam.ContactProcessingThreshold;

            p.terrainImplementation = BSParam.TerrainImplementation;
            p.terrainFriction = BSParam.TerrainFriction;

            p.terrainHitFraction = BSParam.TerrainHitFraction;
            p.terrainRestitution = BSParam.TerrainRestitution;
            p.terrainCollisionMargin = BSParam.TerrainCollisionMargin;

            p.avatarFriction = BSParam.AvatarFriction;
            p.avatarStandingFriction = BSParam.AvatarStandingFriction;
            p.avatarDensity = BSParam.AvatarDensity;
            p.avatarRestitution = BSParam.AvatarRestitution;
            p.avatarCapsuleWidth = BSParam.AvatarCapsuleWidth;
            p.avatarCapsuleDepth = BSParam.AvatarCapsuleDepth;
            p.avatarCapsuleHeight = BSParam.AvatarCapsuleHeight;
            p.avatarContactProcessingThreshold = BSParam.AvatarContactProcessingThreshold;

            p.vehicleAngularDamping = BSParam.VehicleAngularDamping;

            p.maxPersistantManifoldPoolSize = o[0].maxPersistantManifoldPoolSize;
            p.maxCollisionAlgorithmPoolSize = o[0].maxCollisionAlgorithmPoolSize;
            p.shouldDisableContactPoolDynamicAllocation = o[0].shouldDisableContactPoolDynamicAllocation;
            p.shouldForceUpdateAllAabbs = o[0].shouldForceUpdateAllAabbs;
            p.shouldRandomizeSolverOrder = o[0].shouldRandomizeSolverOrder;
            p.shouldSplitSimulationIslands = o[0].shouldSplitSimulationIslands;
            p.shouldEnableFrictionCaching = o[0].shouldEnableFrictionCaching;
            p.numberOfSolverIterations = o[0].numberOfSolverIterations;

            p.linksetImplementation = BSParam.LinksetImplementation;
            p.linkConstraintUseFrameOffset = BSParam.NumericBool(BSParam.LinkConstraintUseFrameOffset);
            p.linkConstraintEnableTransMotor = BSParam.NumericBool(BSParam.LinkConstraintEnableTransMotor);
            p.linkConstraintTransMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel;
            p.linkConstraintTransMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce;
            p.linkConstraintERP = BSParam.LinkConstraintERP;
            p.linkConstraintCFM = BSParam.LinkConstraintCFM;
            p.linkConstraintSolverIterations = BSParam.LinkConstraintSolverIterations;
            p.physicsLoggingFrames = o[0].physicsLoggingFrames;
            // 20131224 not used        DefaultCollisionConstructionInfo ccci = new DefaultCollisionConstructionInfo();

            DefaultCollisionConfiguration cci = new DefaultCollisionConfiguration();
            CollisionDispatcher m_dispatcher = new CollisionDispatcher(cci);

            if (p.maxPersistantManifoldPoolSize > 0)
            cci.m_persistentManifoldPoolSize = (int)p.maxPersistantManifoldPoolSize;
            if (p.shouldDisableContactPoolDynamicAllocation !=0)
            m_dispatcher.SetDispatcherFlags(DispatcherFlags.CD_DISABLE_CONTACTPOOL_DYNAMIC_ALLOCATION);
            //if (p.maxCollisionAlgorithmPoolSize >0 )

            DbvtBroadphase m_broadphase = new DbvtBroadphase();
            //IndexedVector3 aabbMin = new IndexedVector3(0, 0, 0);
            //IndexedVector3 aabbMax = new IndexedVector3(256, 256, 256);

            //AxisSweep3Internal m_broadphase2 = new AxisSweep3Internal(ref aabbMin, ref aabbMax, Convert.ToInt32(0xfffe), 0xffff, ushort.MaxValue/2, null, true);
            m_broadphase.GetOverlappingPairCache().SetInternalGhostPairCallback(new GhostPairCallback());

            SequentialImpulseConstraintSolver m_solver = new SequentialImpulseConstraintSolver();

            DiscreteDynamicsWorld world = new DiscreteDynamicsWorld(m_dispatcher, m_broadphase, m_solver, cci);

            world.LastCollisionDesc = 0;
            world.LastEntityProperty = 0;

            world.WorldSettings.Params = p;
            world.SetForceUpdateAllAabbs(p.shouldForceUpdateAllAabbs != 0);
            world.GetSolverInfo().m_solverMode = SolverMode.SOLVER_USE_WARMSTARTING | SolverMode.SOLVER_SIMD;
            if (p.shouldRandomizeSolverOrder != 0)
            world.GetSolverInfo().m_solverMode |= SolverMode.SOLVER_RANDMIZE_ORDER;

            world.GetSimulationIslandManager().SetSplitIslands(p.shouldSplitSimulationIslands != 0);
            //world.GetDispatchInfo().m_enableSatConvex Not implemented in C# port

            if (p.shouldEnableFrictionCaching != 0)
            world.GetSolverInfo().m_solverMode |= SolverMode.SOLVER_ENABLE_FRICTION_DIRECTION_CACHING;

            if (p.numberOfSolverIterations > 0)
            world.GetSolverInfo().m_numIterations = (int) p.numberOfSolverIterations;

            world.GetSolverInfo().m_damping = world.WorldSettings.Params.linearDamping;
            world.GetSolverInfo().m_restitution = world.WorldSettings.Params.defaultRestitution;
            world.GetSolverInfo().m_globalCfm = 0.0f;
            world.GetSolverInfo().m_tau = 0.6f;
            world.GetSolverInfo().m_friction = 0.3f;
            world.GetSolverInfo().m_maxErrorReduction = 20f;
            world.GetSolverInfo().m_numIterations = 10;
            world.GetSolverInfo().m_erp = 0.2f;
            world.GetSolverInfo().m_erp2 = 0.1f;
            world.GetSolverInfo().m_sor = 1.0f;
            world.GetSolverInfo().m_splitImpulse = false;
            world.GetSolverInfo().m_splitImpulsePenetrationThreshold = -0.02f;
            world.GetSolverInfo().m_linearSlop = 0.0f;
            world.GetSolverInfo().m_warmstartingFactor = 0.85f;
            world.GetSolverInfo().m_restingContactRestitutionThreshold = 2;
            world.SetForceUpdateAllAabbs(true);

            //BSParam.TerrainImplementation = 0;
            world.SetGravity(new IndexedVector3(0,0,p.gravity));

            return world;
        }
Beispiel #8
0
        public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
            int maxCollisions, ref CollisionDesc[] collisionArray,
            int maxUpdates, ref EntityProperties[] updateArray
            )
        {
            UpdatedObjects = updateArray;
            UpdatedCollisions = collisionArray;
            /* TODO */
            ConfigurationParameters[] configparms = new ConfigurationParameters[1];
            configparms[0] = parms;
            Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
            m_maxCollisions = maxCollisions;
            m_maxUpdatesPerFrame = maxUpdates;
            specialCollisionObjects = new Dictionary<uint, GhostObject>();

            return new BulletWorldXNA(1, PhysicsScene, BSAPIXNA.Initialize2(worldExtent, configparms, maxCollisions, ref collisionArray, maxUpdates, ref updateArray, null));
        }
Beispiel #9
0
// Initialization and simulation
public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
											int maxCollisions,  ref CollisionDesc[] collisionArray,
											int maxUpdates, ref EntityProperties[] updateArray
                                            )
{
    // Pin down the memory that will be used to pass object collisions and updates back from unmanaged code
    m_paramsHandle = GCHandle.Alloc(parms, GCHandleType.Pinned);
    m_collisionArrayPinnedHandle = GCHandle.Alloc(collisionArray, GCHandleType.Pinned);
    m_updateArrayPinnedHandle = GCHandle.Alloc(updateArray, GCHandleType.Pinned);

    // If Debug logging level, enable logging from the unmanaged code
    m_DebugLogCallbackHandle = null;
    if (BSScene.m_log.IsDebugEnabled && PhysicsScene.PhysicsLogging.Enabled)
    {
        BSScene.m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", BSScene.LogHeader);
        if (PhysicsScene.PhysicsLogging.Enabled)
            // The handle is saved in a variable to make sure it doesn't get freed after this call
            m_DebugLogCallbackHandle = new BSAPICPP.DebugLogCallback(BulletLoggerPhysLog);
        else
            m_DebugLogCallbackHandle = new BSAPICPP.DebugLogCallback(BulletLogger);
    }

    // Get the version of the DLL
    // TODO: this doesn't work yet. Something wrong with marshaling the returned string.
    // BulletEngineVersion = BulletSimAPI.GetVersion2();
    BulletEngineVersion = "";

    // Call the unmanaged code with the buffers and other information
    return new BulletWorldUnman(0, PhysicsScene, BSAPICPP.Initialize2(maxPosition, m_paramsHandle.AddrOfPinnedObject(),
                                    maxCollisions, m_collisionArrayPinnedHandle.AddrOfPinnedObject(),
                                    maxUpdates, m_updateArrayPinnedHandle.AddrOfPinnedObject(),
                                    m_DebugLogCallbackHandle));

}
Beispiel #10
0
    // All default parameter values are set here. There should be no values set in the
    // variable definitions.
    private void GetInitialParameterValues(IConfigSource config)
    {
        ConfigurationParameters parms = new ConfigurationParameters();
        m_params[0] = parms;

        SetParameterDefaultValues();

        if (config != null)
        {
            // If there are specifications in the ini file, use those values
            IConfig pConfig = config.Configs["BulletSim"];
            if (pConfig != null)
            {
                SetParameterConfigurationValues(pConfig);

                // Very detailed logging for physics debugging
                m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false);
                m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", ".");
                m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-");
                m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5);
                // Very detailed logging for vehicle debugging
                VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false);

                // Do any replacements in the parameters
                m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName);
            }
        }
    }
Beispiel #11
0
        // All default parameter values are set here. There should be no values set in the
        // variable definitions.
        private void GetInitialParameterValues(IConfigSource config)
        {
            ConfigurationParameters parms = new ConfigurationParameters();

            _meshSculptedPrim = true; // mesh sculpted prims
            _forceSimplePrimMeshing = false; // use complex meshing if called for

            m_meshLOD = 32;

            m_maxSubSteps = 10;
            m_fixedTimeStep = 1f/60f;
            m_maxCollisionsPerFrame = 2048;
            m_maxUpdatesPerFrame = 2048;
            _maximumObjectMass = 10000.01f;

            parms.defaultFriction = 0.70f;
            parms.defaultDensity = 10.000006836f; // Aluminum g/cm3
            parms.defaultRestitution = 0f;
            parms.collisionMargin = 0.0f;
            parms.gravity = -9.80665f;

            parms.linearDamping = 0.0f;
            parms.angularDamping = 0.0f;
            parms.deactivationTime = 0.2f;
            parms.linearSleepingThreshold = 0.8f;
            parms.angularSleepingThreshold = 1.0f;
            parms.ccdMotionThreshold = 0.5f; // set to zero to disable
            parms.ccdSweptSphereRadius = 0.2f;

            parms.terrainFriction = 0.85f;
            parms.terrainHitFriction = 0.8f;
            parms.terrainRestitution = 0.2f;
            parms.avatarFriction = 0.85f;
            parms.avatarDensity = 60f;
            parms.avatarCapsuleRadius = 0.37f;
            parms.avatarCapsuleHeight = 1.5f; // 2.140599f

            if (config != null)
            {
                // If there are specifications in the ini file, use those values
                // WHEN ADDING OR UPDATING THIS SECTION, BE SURE TO ALSO UPDATE OpenSimDefaults.ini
                IConfig pConfig = config.Configs["ModifiedBulletSim"];
                if (pConfig != null)
                {
                    _meshSculptedPrim = pConfig.GetBoolean("MeshSculptedPrim", _meshSculptedPrim);
                    _forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing);

                    m_meshLOD = pConfig.GetInt("MeshLevelOfDetail", m_meshLOD);

                    m_maxSubSteps = pConfig.GetInt("MaxSubSteps", m_maxSubSteps);
                    m_fixedTimeStep = pConfig.GetFloat("FixedTimeStep", m_fixedTimeStep);
                    m_maxCollisionsPerFrame = pConfig.GetInt("MaxCollisionsPerFrame", m_maxCollisionsPerFrame);
                    m_maxUpdatesPerFrame = pConfig.GetInt("MaxUpdatesPerFrame", m_maxUpdatesPerFrame);
                    _maximumObjectMass = pConfig.GetFloat("MaxObjectMass", _maximumObjectMass);

                    _allowJump = pConfig.GetBoolean("AllowJump", _allowJump);
                    _allowPreJump = pConfig.GetBoolean("AllowPreJump", _allowPreJump);
                    _preJumpForceMultiplier = pConfig.GetFloat("PreJumpMultiplier", _preJumpForceMultiplier);
                    _delayingVelocityMultiplier = pConfig.GetFloat("DelayingVelocityMultiplier",
                                                                   _delayingVelocityMultiplier);

                    parms.defaultFriction = pConfig.GetFloat("DefaultFriction", parms.defaultFriction);
                    parms.defaultDensity = pConfig.GetFloat("DefaultDensity", parms.defaultDensity);
                    parms.defaultRestitution = pConfig.GetFloat("DefaultRestitution", parms.defaultRestitution);
                    parms.collisionMargin = pConfig.GetFloat("CollisionMargin", parms.collisionMargin);
                    parms.gravity = pConfig.GetFloat("Gravity", parms.gravity);

                    parms.linearDamping = pConfig.GetFloat("LinearDamping", parms.linearDamping);
                    parms.angularDamping = pConfig.GetFloat("AngularDamping", parms.angularDamping);
                    parms.deactivationTime = pConfig.GetFloat("DeactivationTime", parms.deactivationTime);
                    parms.linearSleepingThreshold = pConfig.GetFloat("LinearSleepingThreshold",
                                                                     parms.linearSleepingThreshold);
                    parms.angularSleepingThreshold = pConfig.GetFloat("AngularSleepingThreshold",
                                                                      parms.angularSleepingThreshold);
                    parms.ccdMotionThreshold = pConfig.GetFloat("CcdMotionThreshold", parms.ccdMotionThreshold);
                    parms.ccdSweptSphereRadius = pConfig.GetFloat("CcdSweptSphereRadius", parms.ccdSweptSphereRadius);

                    parms.terrainFriction = pConfig.GetFloat("TerrainFriction", parms.terrainFriction);
                    parms.terrainHitFriction = pConfig.GetFloat("TerrainHitFriction", parms.terrainHitFriction);
                    parms.terrainRestitution = pConfig.GetFloat("TerrainRestitution", parms.terrainRestitution);
                    parms.avatarFriction = pConfig.GetFloat("AvatarFriction", parms.avatarFriction);
                    parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity);
                    parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius);
                    parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight);
                }
            }
            m_params[0] = parms;
        }
Beispiel #12
0
        // All default parameter values are set here. There should be no values set in the
        // variable definitions.
        private void GetInitialParameterValues(IConfigSource config)
        {
            ConfigurationParameters parms = new ConfigurationParameters();

            _meshSculptedPrim       = true;  // mesh sculpted prims
            _forceSimplePrimMeshing = false; // use complex meshing if called for

            m_meshLOD = 32;

            m_maxSubSteps           = 10;
            m_fixedTimeStep         = 1f / 60f;
            m_maxCollisionsPerFrame = 2048;
            m_maxUpdatesPerFrame    = 2048;
            _maximumObjectMass      = 10000.01f;

            parms.defaultFriction    = 0.70f;
            parms.defaultDensity     = 10.000006836f; // Aluminum g/cm3
            parms.defaultRestitution = 0f;
            parms.collisionMargin    = 0.0f;
            parms.gravity            = -9.80665f;

            parms.linearDamping            = 0.0f;
            parms.angularDamping           = 0.0f;
            parms.deactivationTime         = 0.2f;
            parms.linearSleepingThreshold  = 0.8f;
            parms.angularSleepingThreshold = 1.0f;
            parms.ccdMotionThreshold       = 0.5f; // set to zero to disable
            parms.ccdSweptSphereRadius     = 0.2f;

            parms.terrainFriction     = 0.85f;
            parms.terrainHitFriction  = 0.8f;
            parms.terrainRestitution  = 0.2f;
            parms.avatarFriction      = 0.85f;
            parms.avatarDensity       = 60f;
            parms.avatarCapsuleRadius = 0.37f;
            parms.avatarCapsuleHeight = 1.5f; // 2.140599f

            if (config != null)
            {
                // If there are specifications in the ini file, use those values
                // WHEN ADDING OR UPDATING THIS SECTION, BE SURE TO ALSO UPDATE OpenSimDefaults.ini
                IConfig pConfig = config.Configs["ModifiedBulletSim"];
                if (pConfig != null)
                {
                    _meshSculptedPrim       = pConfig.GetBoolean("MeshSculptedPrim", _meshSculptedPrim);
                    _forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing);

                    m_meshLOD = pConfig.GetInt("MeshLevelOfDetail", m_meshLOD);

                    m_maxSubSteps           = pConfig.GetInt("MaxSubSteps", m_maxSubSteps);
                    m_fixedTimeStep         = pConfig.GetFloat("FixedTimeStep", m_fixedTimeStep);
                    m_maxCollisionsPerFrame = pConfig.GetInt("MaxCollisionsPerFrame", m_maxCollisionsPerFrame);
                    m_maxUpdatesPerFrame    = pConfig.GetInt("MaxUpdatesPerFrame", m_maxUpdatesPerFrame);
                    _maximumObjectMass      = pConfig.GetFloat("MaxObjectMass", _maximumObjectMass);

                    _allowJump                  = pConfig.GetBoolean("AllowJump", _allowJump);
                    _allowPreJump               = pConfig.GetBoolean("AllowPreJump", _allowPreJump);
                    _preJumpForceMultiplier     = pConfig.GetFloat("PreJumpMultiplier", _preJumpForceMultiplier);
                    _delayingVelocityMultiplier = pConfig.GetFloat("DelayingVelocityMultiplier",
                                                                   _delayingVelocityMultiplier);

                    parms.defaultFriction    = pConfig.GetFloat("DefaultFriction", parms.defaultFriction);
                    parms.defaultDensity     = pConfig.GetFloat("DefaultDensity", parms.defaultDensity);
                    parms.defaultRestitution = pConfig.GetFloat("DefaultRestitution", parms.defaultRestitution);
                    parms.collisionMargin    = pConfig.GetFloat("CollisionMargin", parms.collisionMargin);
                    parms.gravity            = pConfig.GetFloat("Gravity", parms.gravity);

                    parms.linearDamping           = pConfig.GetFloat("LinearDamping", parms.linearDamping);
                    parms.angularDamping          = pConfig.GetFloat("AngularDamping", parms.angularDamping);
                    parms.deactivationTime        = pConfig.GetFloat("DeactivationTime", parms.deactivationTime);
                    parms.linearSleepingThreshold = pConfig.GetFloat("LinearSleepingThreshold",
                                                                     parms.linearSleepingThreshold);
                    parms.angularSleepingThreshold = pConfig.GetFloat("AngularSleepingThreshold",
                                                                      parms.angularSleepingThreshold);
                    parms.ccdMotionThreshold   = pConfig.GetFloat("CcdMotionThreshold", parms.ccdMotionThreshold);
                    parms.ccdSweptSphereRadius = pConfig.GetFloat("CcdSweptSphereRadius", parms.ccdSweptSphereRadius);

                    parms.terrainFriction     = pConfig.GetFloat("TerrainFriction", parms.terrainFriction);
                    parms.terrainHitFriction  = pConfig.GetFloat("TerrainHitFriction", parms.terrainHitFriction);
                    parms.terrainRestitution  = pConfig.GetFloat("TerrainRestitution", parms.terrainRestitution);
                    parms.avatarFriction      = pConfig.GetFloat("AvatarFriction", parms.avatarFriction);
                    parms.avatarDensity       = pConfig.GetFloat("AvatarDensity", parms.avatarDensity);
                    parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius);
                    parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight);
                }
            }
            m_params[0] = parms;
        }
Beispiel #13
0
 public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
                                         int maxCollisions, ref CollisionDesc[] collisionArray,
                                         int maxUpdates, ref EntityProperties[] updateArray
                                         )
 {
     /* TODO */
     return new BulletWorldXNA(1, null, null);
 }
Beispiel #14
0
    // All default parameter values are set here. There should be no values set in the
    // variable definitions.
    private void GetInitialParameterValues(IConfigSource config)
    {
        ConfigurationParameters parms = new ConfigurationParameters();

        _meshSculptedPrim = true;           // mesh sculpted prims
        _forceSimplePrimMeshing = false;    // use complex meshing if called for

        m_meshLOD = 8f;
        m_sculptLOD = 32f;

        m_detailedStatsStep = 0;            // disabled

        m_maxSubSteps = 10;
        m_fixedTimeStep = 1f / 60f;
        m_maxCollisionsPerFrame = 2048;
        m_maxUpdatesPerFrame = 2048;
        m_maximumObjectMass = 10000.01f;

        parms.defaultFriction = 0.5f;
        parms.defaultDensity = 10.000006836f; // Aluminum g/cm3
        parms.defaultRestitution = 0f;
        parms.collisionMargin = 0.0f;
        parms.gravity = -9.80665f;

        parms.linearDamping = 0.0f;
        parms.angularDamping = 0.0f;
        parms.deactivationTime = 0.2f;
        parms.linearSleepingThreshold = 0.8f;
        parms.angularSleepingThreshold = 1.0f;
        parms.ccdMotionThreshold = 0.0f;    // set to zero to disable
        parms.ccdSweptSphereRadius = 0.0f;
        parms.contactProcessingThreshold = 0.1f;

        parms.terrainFriction = 0.5f;
        parms.terrainHitFraction = 0.8f;
        parms.terrainRestitution = 0f;
        parms.avatarFriction = 0.5f;
        parms.avatarRestitution = 0.0f;
        parms.avatarDensity = 60f;
        parms.avatarCapsuleRadius = 0.37f;
        parms.avatarCapsuleHeight = 1.5f; // 2.140599f
    	parms.avatarContactProcessingThreshold = 0.1f;

    	parms.maxPersistantManifoldPoolSize = 0f;
    	parms.shouldDisableContactPoolDynamicAllocation = ConfigurationParameters.numericTrue;
    	parms.shouldForceUpdateAllAabbs = ConfigurationParameters.numericFalse;
    	parms.shouldRandomizeSolverOrder = ConfigurationParameters.numericFalse;
    	parms.shouldSplitSimulationIslands = ConfigurationParameters.numericFalse;
    	parms.shouldEnableFrictionCaching = ConfigurationParameters.numericFalse;
    	parms.numberOfSolverIterations = 0f;    // means use default

        if (config != null)
        {
            // If there are specifications in the ini file, use those values
            // WHEN ADDING OR UPDATING THIS SECTION, BE SURE TO UPDATE OpenSimDefaults.ini
            // ALSO REMEMBER TO UPDATE THE RUNTIME SETTING OF THE PARAMETERS.
            IConfig pConfig = config.Configs["BulletSim"];
            if (pConfig != null)
            {
                _meshSculptedPrim = pConfig.GetBoolean("MeshSculptedPrim", _meshSculptedPrim);
                _forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing);

                m_detailedStatsStep = pConfig.GetInt("DetailedStatsStep", m_detailedStatsStep);
                m_meshLOD = pConfig.GetFloat("MeshLevelOfDetail", m_meshLOD);
                m_sculptLOD = pConfig.GetFloat("SculptLevelOfDetail", m_sculptLOD);

                m_maxSubSteps = pConfig.GetInt("MaxSubSteps", m_maxSubSteps);
                m_fixedTimeStep = pConfig.GetFloat("FixedTimeStep", m_fixedTimeStep);
                m_maxCollisionsPerFrame = pConfig.GetInt("MaxCollisionsPerFrame", m_maxCollisionsPerFrame);
                m_maxUpdatesPerFrame = pConfig.GetInt("MaxUpdatesPerFrame", m_maxUpdatesPerFrame);
                m_maximumObjectMass = pConfig.GetFloat("MaxObjectMass", m_maximumObjectMass);

                parms.defaultFriction = pConfig.GetFloat("DefaultFriction", parms.defaultFriction);
                parms.defaultDensity = pConfig.GetFloat("DefaultDensity", parms.defaultDensity);
                parms.defaultRestitution = pConfig.GetFloat("DefaultRestitution", parms.defaultRestitution);
                parms.collisionMargin = pConfig.GetFloat("CollisionMargin", parms.collisionMargin);
                parms.gravity = pConfig.GetFloat("Gravity", parms.gravity);

                parms.linearDamping = pConfig.GetFloat("LinearDamping", parms.linearDamping);
                parms.angularDamping = pConfig.GetFloat("AngularDamping", parms.angularDamping);
                parms.deactivationTime = pConfig.GetFloat("DeactivationTime", parms.deactivationTime);
                parms.linearSleepingThreshold = pConfig.GetFloat("LinearSleepingThreshold", parms.linearSleepingThreshold);
                parms.angularSleepingThreshold = pConfig.GetFloat("AngularSleepingThreshold", parms.angularSleepingThreshold);
                parms.ccdMotionThreshold = pConfig.GetFloat("CcdMotionThreshold", parms.ccdMotionThreshold);
                parms.ccdSweptSphereRadius = pConfig.GetFloat("CcdSweptSphereRadius", parms.ccdSweptSphereRadius);
                parms.contactProcessingThreshold = pConfig.GetFloat("ContactProcessingThreshold", parms.contactProcessingThreshold);

                parms.terrainFriction = pConfig.GetFloat("TerrainFriction", parms.terrainFriction);
                parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction);
                parms.terrainRestitution = pConfig.GetFloat("TerrainRestitution", parms.terrainRestitution);
                parms.avatarFriction = pConfig.GetFloat("AvatarFriction", parms.avatarFriction);
                parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution);
                parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity);
                parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius);
                parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight);
                parms.avatarContactProcessingThreshold = pConfig.GetFloat("AvatarContactProcessingThreshold", parms.avatarContactProcessingThreshold);

                parms.maxPersistantManifoldPoolSize = pConfig.GetFloat("MaxPersistantManifoldPoolSize", parms.maxPersistantManifoldPoolSize);
                parms.shouldDisableContactPoolDynamicAllocation = ParamBoolean(pConfig, "ShouldDisableContactPoolDynamicAllocation", parms.shouldDisableContactPoolDynamicAllocation);
	            parms.shouldForceUpdateAllAabbs = ParamBoolean(pConfig, "ShouldForceUpdateAllAabbs", parms.shouldForceUpdateAllAabbs);
	            parms.shouldRandomizeSolverOrder = ParamBoolean(pConfig, "ShouldRandomizeSolverOrder", parms.shouldRandomizeSolverOrder);
	            parms.shouldSplitSimulationIslands = ParamBoolean(pConfig, "ShouldSplitSimulationIslands", parms.shouldSplitSimulationIslands);
	            parms.shouldEnableFrictionCaching = ParamBoolean(pConfig, "ShouldEnableFrictionCaching", parms.shouldEnableFrictionCaching);
	            parms.numberOfSolverIterations = pConfig.GetFloat("NumberOfSolverIterations", parms.numberOfSolverIterations);
            }
        }
        m_params[0] = parms;
    }