Represents some generic / high level Box2d simulation parameters.
コード例 #1
0
 /// <summary>
 /// Inititialise world.
 /// </summary>
 public override void InitSimulationWorld()
 {
     SimulationParameters simParams = new SimulationParameters();
     simParams._lowerBoundPhysics.Set(-_trackLengthHalf - 2f , -1f);
     simParams._upperBoundPhysics.Set(_trackLengthHalf + 2f, 2f);
     simParams._lowerBoundView.Set(-_trackLengthHalf - 1f, -1f);
     simParams._upperBoundView.Set(_trackLengthHalf + 1, 2f);
     base.InitSimulationWorld(simParams);
 }
コード例 #2
0
ファイル: SimulationWorld.cs プロジェクト: colgreen/sharpneat
        /// <summary>
        /// Initialise world with the specified SimulationParameters.
        /// </summary>
        /// <param name="simParams"></param>
        protected void InitSimulationWorld(SimulationParameters simParams)
        {
            _simParams = simParams;
            _world = CreateBox2DWorld();

            // Allow physics calcs to use values from previous timestep.
            _world.SetWarmStarting(_simParams._warmStarting);

            // Enable additional collision detection for high speed objects (that might not ever contact each other at a given timestep due to speed).
            _world.SetContinuousPhysics(_simParams._continuousPhysics);

            // Put stuff in the world.
            PopulateWorld();

            // Create contact listener.
            ContactListener contactListener = CreateContactListener();
            if(null != contactListener) {
                _world.SetContactListener(contactListener);
            }
        }