public void Create() { string sceneInstanceIndexName = name + instanceIndexName; if (demo.Engine.Factory.PhysicsSceneManager.Find(sceneInstanceIndexName) != null) { return; } scene = demo.Engine.Factory.PhysicsSceneManager.Create(sceneInstanceIndexName); // Initialize maximum number of solver iterations for the scene scene.MaxIterationCount = 10; // Initialize time of simulation for the scene scene.TimeOfSimulation = 1.0f / 15.0f; Initialize(); // Initialize objects in the scene skyInstance1.Initialize(scene); quadInstance1.Initialize(scene); cursorInstance.Initialize(scene); shotInstance.Initialize(scene); plant2Instance1.Initialize(scene); building1Instance1.Initialize(scene); car1Instance1.Initialize(scene); ragdoll3Instance1.Initialize(scene); box1Instance1.Initialize(scene); lamp1Instance1.Initialize(scene); lamp1Instance2.Initialize(scene); camera2Instance1.Initialize(scene); lightInstance.Initialize(scene); // Initialize controllers in the scene skyDraw1Instance1.Initialize(scene); cursorDraw1Instance.Initialize(scene); car1Animation1Instance1.Initialize(scene); lamp1Animation1Instance1.Initialize(scene); lamp1Animation1Instance2.Initialize(scene); camera2Animation1Instance1.Initialize(scene); camera2Draw1Instance1.Initialize(scene); // Create shapes shared for all physics objects in the scene // These shapes are used by all objects in the scene Demo.CreateSharedShapes(demo, scene); // Create shapes for objects in the scene Sky.CreateShapes(demo, scene); Quad.CreateShapes(demo, scene); Cursor.CreateShapes(demo, scene); Shot.CreateShapes(demo, scene); Plant2.CreateShapes(demo, scene); Building1.CreateShapes(demo, scene); Car1.CreateShapes(demo, scene); Ragdoll3.CreateShapes(demo, scene); Box1.CreateShapes(demo, scene); Lamp1.CreateShapes(demo, scene); Camera2.CreateShapes(demo, scene); Lights.CreateShapes(demo, scene); // Create physics objects for objects in the scene skyInstance1.Create(new Vector3(0.0f, 0.0f, 0.0f)); quadInstance1.Create(new Vector3(0.0f, -40.0f, 20.0f), new Vector3(1000.0f, 31.0f, 1000.0f), Quaternion.Identity); cursorInstance.Create(); shotInstance.Create(); plant2Instance1.Create(new Vector3(-30.0f, -9.0f, 20.0f), Vector3.One, Quaternion.FromAxisAngle(Vector3.UnitY, MathHelper.DegreesToRadians(10.0f))); building1Instance1.Create(new Vector3(0.0f, 0.0f, 100.0f), Vector3.One, Quaternion.Identity); car1Instance1.Create(new Vector3(10.0f, 0.0f, 40.0f), Vector3.One, Quaternion.FromAxisAngle(Vector3.UnitY, MathHelper.DegreesToRadians(180.0f))); ragdoll3Instance1.Create(new Vector3(-10.0f, -10.0f, 0.0f), Vector3.One, Quaternion.FromAxisAngle(Vector3.UnitX, MathHelper.DegreesToRadians(0.0f)), false, false, 0.5f); box1Instance1.Create(new Vector3(40.0f, 0.0f, 50.0f), Vector3.One, Quaternion.Identity, 4, new Vector3(1.0f, 4.0f, 0.1f), 0.02f); lamp1Instance1.Create(new Vector3(-96.0f, 5.0f, 140.0f), Vector3.One, Quaternion.Identity, PhysicsScene.Factory.PhysicsObjectManager.Find("Building 1 Level 1 Wall 3 1")); lamp1Instance2.Create(new Vector3(-96.0f, 5.0f, 220.0f), Vector3.One, Quaternion.Identity, PhysicsScene.Factory.PhysicsObjectManager.Find("Building 1 Level 1 Wall 3 1")); camera2Instance1.Create(new Vector3(0.0f, 5.0f, -22.0f), Quaternion.Identity, Quaternion.Identity, Quaternion.Identity, true); lightInstance.CreateLightPoint(0, "Glass", new Vector3(-30.0f, -3.0f, 90.0f), new Vector3(1.0f, 0.7f, 0.5f), 20.0f, 1.0f); lightInstance.CreateLightPoint(1, "Glass", new Vector3(0.0f, -3.0f, 90.0f), new Vector3(0.3f, 0.7f, 0.2f), 20.0f, 1.0f); lightInstance.CreateLightPoint(2, "Glass", new Vector3(30.0f, -3.0f, 90.0f), new Vector3(0.3f, 0.7f, 0.5f), 20.0f, 1.0f); lightInstance.CreateLightPoint(3, "Glass", new Vector3(-20.0f, -3.0f, 20.0f), new Vector3(1.0f, 0.7f, 0.0f), 20.0f, 1.0f); lightInstance.CreateLightPoint(4, "Glass", new Vector3(20.0f, -3.0f, 10.0f), new Vector3(1.0f, 1.0f, 0.5f), 20.0f, 1.0f); lightInstance.CreateLightPoint(5, "Glass", new Vector3(30.0f, -3.0f, 40.0f), new Vector3(1.0f, 0.7f, 0.0f), 20.0f, 1.0f); lightInstance.CreateLightSpot(0, "Glass", new Vector3(-30.0f, -3.0f, 15.0f), new Vector3(0.1f, 0.7f, 1.0f), 20.0f, 1.0f); lightInstance.CreateLightSpot(1, "Glass", new Vector3(0.0f, 8.0f, 20.0f), new Vector3(1.0f, 0.5f, 0.2f), 20.0f, 1.0f); lightInstance.CreateLightSpot(2, "Glass", new Vector3(45.0f, 0.0f, 45.0f), new Vector3(0.5f, 1.0f, 0.2f), 20.0f, 1.0f); // Set controllers for objects in the scene SetControllers(); }
public void Create() { string sceneInstanceIndexName = name + instanceIndexName; if (demo.Engine.Factory.PhysicsSceneManager.Find(sceneInstanceIndexName) != null) { return; } scene = demo.Engine.Factory.PhysicsSceneManager.Create(sceneInstanceIndexName); // Initialize maximum number of solver iterations for the scene scene.MaxIterationCount = 10; // Initialize time of simulation for the scene scene.TimeOfSimulation = 1.0f / 15.0f; Initialize(); // Initialize objects in the scene skyInstance1.Initialize(scene); quadInstance1.Initialize(scene); cursorInstance.Initialize(scene); shotInstance.Initialize(scene); building1Instance1.Initialize(scene); building2Instance1.Initialize(scene); bridge2Instance1.Initialize(scene); camera2Instance1.Initialize(scene); lightInstance.Initialize(scene); // Initialize controllers in the scene skyDraw1Instance1.Initialize(scene); cursorDraw1Instance.Initialize(scene); camera2Animation1Instance1.Initialize(scene); camera2Draw1Instance1.Initialize(scene); pointLightAnimation1Instance1.Initialize(scene); // Create shapes shared for all physics objects in the scene // These shapes are used by all objects in the scene Demo.CreateSharedShapes(demo, scene); // Create shapes for objects in the scene Sky.CreateShapes(demo, scene); Quad.CreateShapes(demo, scene); Cursor.CreateShapes(demo, scene); Shot.CreateShapes(demo, scene); Building1.CreateShapes(demo, scene); Building2.CreateShapes(demo, scene); Bridge2.CreateShapes(demo, scene); Camera2.CreateShapes(demo, scene); Lights.CreateShapes(demo, scene); // Create physics objects for objects in the scene skyInstance1.Create(new Vector3(0.0f, 0.0f, 0.0f)); quadInstance1.Create(new Vector3(0.0f, -40.0f, 20.0f), new Vector3(1000.0f, 31.0f, 1000.0f), Quaternion.Identity); cursorInstance.Create(); shotInstance.Create(); building1Instance1.Create(new Vector3(0.0f, 0.0f, 100.0f), Vector3.One, Quaternion.Identity); building2Instance1.Create(new Vector3(0.0f, 0.0f, -100.0f), Vector3.One, Quaternion.FromAxisAngle(Vector3.UnitY, MathHelper.DegreesToRadians(180.0f))); PhysicsObject startObject = PhysicsScene.Factory.PhysicsObjectManager.Find("Building 2 Level 2 Wall 42 1"); PhysicsObject endObject = PhysicsScene.Factory.PhysicsObjectManager.Find("Building 1 Level 3 Wall 43 1"); startObject.MainWorldTransform.GetPosition(ref startPosition); startObject.MainWorldTransform.GetScale(ref startScale); endObject.MainWorldTransform.GetPosition(ref endPosition); endObject.MainWorldTransform.GetScale(ref endScale); startPosition += new Vector3(0.0f, startScale.Z, startScale.Y); endPosition += new Vector3(0.0f, endScale.Y, -endScale.Z); bridge2Instance1.Create(startObject, endObject, startPosition, endPosition, 20, new Vector2(15.0f, 0.4f)); camera2Instance1.Create(new Vector3(0.0f, 120.0f, -22.0f), Quaternion.Identity, Quaternion.Identity, Quaternion.Identity, true); lightInstance.CreateLightPoint(0, "Glass", new Vector3(60.0f, 115.0f, -200.0f), new Vector3(1.0f, 0.7f, 0.0f), 20.0f, 1.0f); lightInstance.CreateLightPoint(1, "Glass", new Vector3(40.0f, 102.0f, -180.0f), new Vector3(1.0f, 0.7f, 0.0f), 20.0f, 1.0f); lightInstance.CreateLightPoint(2, "Glass", new Vector3(40.0f, 102.0f, -220.0f), new Vector3(1.0f, 0.2f, 0.1f), 20.0f, 1.0f); lightInstance.CreateLightPoint(3, "Glass", new Vector3(-40.0f, 46.0f, -298.0f), new Vector3(0.3f, 0.7f, 0.5f), 20.0f, 1.0f); lightInstance.CreateLightPoint(4, "Glass", new Vector3(-15.0f, 28.0f, -298.0f), new Vector3(0.0f, 0.7f, 0.8f), 20.0f, 1.0f); lightInstance.CreateLightPoint(5, "Glass", new Vector3(10.0f, 5.0f, -298.0f), new Vector3(1.0f, 0.7f, 0.0f), 20.0f, 1.0f); lightInstance.CreateLightPoint(6, "Glass", new Vector3(-30.0f, -3.0f, -90.0f), new Vector3(1.0f, 0.9f, 0.0f), 20.0f, 1.0f); lightInstance.CreateLightPoint(7, "Glass", new Vector3(0.0f, -3.0f, -90.0f), new Vector3(0.5f, 0.7f, 0.1f), 20.0f, 1.0f); lightInstance.CreateLightPoint(8, "Glass", new Vector3(30.0f, -3.0f, -90.0f), new Vector3(1.0f, 0.7f, 0.0f), 20.0f, 1.0f); lightInstance.CreateLightPoint(9, "Glass", new Vector3(-30.0f, -3.0f, 90.0f), new Vector3(1.0f, 0.7f, 0.5f), 20.0f, 1.0f); lightInstance.CreateLightPoint(10, "Glass", new Vector3(0.0f, -3.0f, 90.0f), new Vector3(0.3f, 0.7f, 0.5f), 20.0f, 1.0f); lightInstance.CreateLightPoint(11, "Glass", new Vector3(30.0f, -3.0f, 90.0f), new Vector3(1.0f, 1.0f, 0.5f), 20.0f, 1.0f); lightInstance.CreateLightPoint(12, "Field", new Vector3(0.0f, -3.0f, 0.0f), new Vector3(0.2f, 1.0f, 0.0f), 20.0f, 0.0001f); lightInstance.CreateLightSpot(0, "Glass", new Vector3(-30.0f, 117.0f, 180.0f), new Vector3(0.1f, 0.7f, 1.0f), 20.0f, 1.0f); lightInstance.CreateLightSpot(1, "Glass", new Vector3(0.0f, 117.0f, 150.0f), new Vector3(1.0f, 0.5f, 0.2f), 20.0f, 1.0f); lightInstance.CreateLightSpot(2, "Glass", new Vector3(30.0f, 117.0f, 180.0f), new Vector3(0.5f, 1.0f, 0.2f), 20.0f, 1.0f); // Set controllers for objects in the scene SetControllers(); }