Esempio n. 1
0
        /// <summary>
        /// Constructor.
        /// Initializes default values for various materials. The default
        /// values are from http://wiki.secondlife.com/wiki/PRIM_MATERIAL
        /// <summary>
        public PxMaterialLibrary(PxConfiguration config)
        {
            float defaultDensity;

            // Retrieve the default density for objects
            defaultDensity = config.DefaultDensity;

            // Initialize each of the default material attributes using the
            // values from http://wiki.secondlife.com/wiki/PRIM_MATERIAL
            m_attributes[(int)Material.Stone] = new
                                                PxMaterialAttributes("Stone", defaultDensity, 0.8f, 0.4f);
            m_attributes[(int)Material.Metal] = new
                                                PxMaterialAttributes("Metal", defaultDensity, 0.3f, 0.4f);
            m_attributes[(int)Material.Glass] = new
                                                PxMaterialAttributes("Glass", defaultDensity, 0.2f, 0.7f);
            m_attributes[(int)Material.Wood] = new
                                               PxMaterialAttributes("Wood", defaultDensity, 0.6f, 0.5f);
            m_attributes[(int)Material.Flesh] = new
                                                PxMaterialAttributes("Flesh", defaultDensity, 0.9f, 0.3f);
            m_attributes[(int)Material.Plastic] = new
                                                  PxMaterialAttributes("Plastic", defaultDensity, 0.4f, 0.7f);
            m_attributes[(int)Material.Rubber] = new
                                                 PxMaterialAttributes("Rubber", defaultDensity, 0.9f, 0.9f);
            m_attributes[(int)Material.Light] = new
                                                PxMaterialAttributes("Light", defaultDensity,
                                                                     config.DefaultFriction, config.DefaultRestitution);
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor for the PhysX scene.
        /// </summary>
        /// <param name="engineType">Name of physics engine</param>
        /// <param name="name">Name of region</param>
        /// <param name="physX">PhysX class interface</param>
        public PxScene(string engineType, string name, PxAPIManager physX)
        {
            // The name of the region that we're working for is passed to us;
            // keep for identification
            RegionName = name;

            // Set the identifying variables in the PhysicsScene interface
            EngineType = engineType;
            Name       = EngineType + "/" + RegionName;

            // Save reference to the PhysX interface for future calls to the
            // PhysX engine
            PhysX = physX;

            // Create the configuration with default values
            UserConfig = new PxConfiguration();
        }