public static void DestroyPreviewObjects(Component_Scene scene) { foreach (var c in scene.GetComponents <Component_MeshInSpace>()) { c.Dispose(); } }
public void Simulate() { ////update settings //if( physicsWorldData.world.SolverInfo.NumIterations != PhysicsNumberIterations ) // physicsWorldData.world.SolverInfo.NumIterations = PhysicsNumberIterations; //simulate float invStep = ProjectSettings.Get.SimulationStepsPerSecondInv; world.Step(invStep); //int steps = PhysicsSimulationSteps; //if( steps == 0 ) // steps = 1; //for( int n = 0; n < steps; n++ ) //{ // int substepsPassed = physicsWorldData.world.StepSimulation( invStep / steps, 1, invStep / steps ); //} ////int substepsPassed = physicsWorldData.world.StepSimulation( invStep, 1, invStep ); ////int substepsPassed = physicsWorld.StepSimulation( (float)ProjectSettings.Get.SimulationStepsPerSecondInv, 1, 0.0166666675F ); //get updated data { //!!!!slowly. update only updated foreach (var body in scene.GetComponents <Component_PhysicalBody2D>(false, true, true)) { body.UpdateDataFromPhysicsEngine(); } foreach (var constraint in scene.GetComponents <Component_Constraint2D>(false, true, true)) { constraint.UpdateDataFromPhysicsEngine(); } } }