示例#1
0
        public void InitalizePhysics()
        {
            // Construct engine objects
            this.Camera = new Camera(this);

            //_visualizationEffect = new BasicEffect(this.Device)
            //{
            //    VertexColorEnabled = true
            //};
            //_vertexDeclaration = VertexPositionColor.VertexDeclaration;

            // Construct physics objects
            CoreDescription coreDesc = new CoreDescription();
            UserOutput      output   = new UserOutput();

            this.Core = new Core(coreDesc, output);

            Core core = this.Core;

            core.SetParameter(PhysicsParameter.VisualizationScale, 2.0f);
            core.SetParameter(PhysicsParameter.VisualizeCollisionShapes, true);
            core.SetParameter(PhysicsParameter.VisualizeClothMesh, true);
            core.SetParameter(PhysicsParameter.VisualizeJointLocalAxes, true);
            core.SetParameter(PhysicsParameter.VisualizeJointLimits, true);
            core.SetParameter(PhysicsParameter.VisualizeFluidPosition, true);
            core.SetParameter(PhysicsParameter.VisualizeFluidEmitters, false);             // Slows down rendering a bit too much
            core.SetParameter(PhysicsParameter.VisualizeForceFields, true);
            core.SetParameter(PhysicsParameter.VisualizeSoftBodyMesh, true);

            SceneDescription sceneDesc = new SceneDescription()
            {
                //SimulationType = SimulationType.Hardware,
                Gravity            = new Vector3(0, -9.81f, 0).AsPhysX(),
                GroundPlaneEnabled = true
            };

            this.Scene = core.CreateScene(sceneDesc);

            HardwareVersion ver     = Core.HardwareVersion;
            SimulationType  simType = this.Scene.SimulationType;

            // Connect to the remote debugger if it's there
            core.Foundation.RemoteDebugger.Connect("localhost");
        }
示例#2
0
		public void InitalizePhysics()
		{
			// Construct engine objects
			this.Camera = new Camera(this);

			//_visualizationEffect = new BasicEffect(this.Device)
			//{
			//    VertexColorEnabled = true
			//};
			//_vertexDeclaration = VertexPositionColor.VertexDeclaration;

			// Construct physics objects
			CoreDescription coreDesc = new CoreDescription();
			UserOutput output = new UserOutput();

			this.Core = new Core(coreDesc, output);

			Core core = this.Core;
			core.SetParameter(PhysicsParameter.VisualizationScale, 2.0f);
			core.SetParameter(PhysicsParameter.VisualizeCollisionShapes, true);
			core.SetParameter(PhysicsParameter.VisualizeClothMesh, true);
			core.SetParameter(PhysicsParameter.VisualizeJointLocalAxes, true);
			core.SetParameter(PhysicsParameter.VisualizeJointLimits, true);
			core.SetParameter(PhysicsParameter.VisualizeFluidPosition, true);
			core.SetParameter(PhysicsParameter.VisualizeFluidEmitters, false); // Slows down rendering a bit too much
			core.SetParameter(PhysicsParameter.VisualizeForceFields, true);
			core.SetParameter(PhysicsParameter.VisualizeSoftBodyMesh, true);

			SceneDescription sceneDesc = new SceneDescription()
			{
				//SimulationType = SimulationType.Hardware,
				Gravity = new Vector3(0, -9.81f, 0).AsPhysX(),
				GroundPlaneEnabled = true
			};

			this.Scene = core.CreateScene(sceneDesc);

			HardwareVersion ver = Core.HardwareVersion;
			SimulationType simType = this.Scene.SimulationType;

			// Connect to the remote debugger if it's there
			core.Foundation.RemoteDebugger.Connect("localhost");
		}