示例#1
0
        private agxSDK.Simulation GetOrCreateSimulation()
        {
            if (m_simulation == null)
            {
                NativeHandler.Instance.MakeMainThread();

                m_simulation = new agxSDK.Simulation();
                m_space      = m_simulation.getSpace();
                m_system     = m_simulation.getDynamicsSystem();

                // Since AGXUnity.Simulation is optional in the hierarchy
                // we have to synchronize fixedDeltaTime here if SimulationTool
                // never has been seen in the inspector.
                if (AutoSteppingMode == AutoSteppingModes.FixedUpdate)
                {
                    TimeStep = Time.fixedDeltaTime;
                }

                // Solver settings will assign number of threads.
                if (m_solverSettings != null)
                {
                    m_solverSettings.SetSimulation(m_simulation);
                    m_solverSettings.GetInitialized <SolverSettings>();
                }
                // No solver settings - set the default.
                else
                {
                    agx.agxSWIG.setNumThreads(Convert.ToUInt32(SolverSettings.DefaultNumberOfThreads));
                }

                StepCallbacks.OnInitialize(m_simulation);
            }

            return(m_simulation);
        }
示例#2
0
        private agxSDK.Simulation GetOrCreateSimulation()
        {
            if (m_simulation == null)
            {
                NativeHandler.Instance.MakeMainThread();

                m_simulation = new agxSDK.Simulation();
                m_space      = m_simulation.getSpace();
                m_system     = m_simulation.getDynamicsSystem();

                // Solver settings will assign number of threads.
                if (m_solverSettings != null)
                {
                    m_solverSettings.SetSimulation(m_simulation);
                    m_solverSettings.GetInitialized <SolverSettings>();
                }
                // No solver settings - set the default.
                else
                {
                    agx.agxSWIG.setNumThreads(Convert.ToUInt32(SolverSettings.DefaultNumberOfThreads));
                }
            }

            return(m_simulation);
        }
示例#3
0
        private agxSDK.Simulation GetOrCreateSimulation()
        {
            if (m_simulation == null)
            {
                NativeHandler.Instance.MakeMainThread();

                m_simulation = new agxSDK.Simulation();

                m_defaultNumDryFrictionIterations = (int)m_simulation.getSolver().getNumDryFrictionIterations();
                m_defaultNumRestingIterations     = (int)m_simulation.getSolver().getNumRestingIterations();

                m_space  = m_simulation.getSpace();
                m_system = m_simulation.getDynamicsSystem();

                m_system.setEnableContactWarmstarting(m_warmStartingDirectContacts);
            }

            return(m_simulation);
        }