Пример #1
0
 static public int constructor(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.PhysicsScene o;
         o = new UnityEngine.PhysicsScene();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Пример #2
0
 static public int ctor_s(IntPtr l)
 {
     try {
         UnityEngine.PhysicsScene o;
         o = new UnityEngine.PhysicsScene();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #3
0
        public PhysicsScene(string sceneName)
        {
            _sceneName = sceneName;

            if (Application.isPlaying)
            {
                _scene = SceneManager.CreateScene(_sceneName, new CreateSceneParameters()
                {
                    localPhysicsMode = LocalPhysicsMode.Physics3D,
                });
            }
            else                                 //test
            {
                                #if UNITY_EDITOR //To use it inside unit test without play mode
                _scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
                                #endif
            }

            _physics = _scene.GetPhysicsScene();

            var go = new GameObject("Simulation-root");
            SceneManager.MoveGameObjectToScene(go, _scene);
            RootTransform = go.transform;
        }