Esempio n. 1
0
        public static void ApplyPhysics(PhysicsSettings physicsSettings, Transform[] objects, SpawnSettings.AutoSimulationType autoSimulationType)
        {
            PhysicsSimulationGroup physicsSimulation = ScriptableObject.CreateInstance <PhysicsSimulationGroup>();

            physicsSimulation.ApplySettings(physicsSettings);

            if (autoSimulationType == SpawnSettings.AutoSimulationType.Continuous)
            {
                physicsSimulation.StartSimulation(objects);

                PhysicsSimulator.SetSimulationTime(physicsSettings.simulationTime);
                PhysicsSimulator.SetSimulationSteps(physicsSettings.simulationSteps);

                PhysicsSimulator.Activate();

                // consume the event or otherwise we'd get an error in PhysicsSimulator because of the UI display of the phyiscs timer
                // TODO: set flag and invoke in different pass
                Event.current.Use();
            }
        }
Esempio n. 2
0
 public static void RegisterGroup(PhysicsSimulationGroup group)
 {
     groupRegistry.Add(group);
 }