Пример #1
0
        private PhysX()
        {
            try
            {
                Core = new StillDesign.PhysX.Core();
            }
            catch (Exception exception)
            {
                //ScreenManager.Graphics.IsFullScreen = false;
                //ScreenManager.Graphics.ApplyChanges();

                //MessageBox.Show("Error initializing PhysX.\n- Did you install the nVidia PhysX System Software?\n\n" + exception.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }

            //Core.SetParameter(PhysicsParameter.SkinWidth, (float)0.01f);
            Core.SetParameter(PhysicsParameter.VisualizationScale, (float)0f);
            Core.SetParameter(PhysicsParameter.ContinuousCollisionDetection, false);
            Core.SetParameter(PhysicsParameter.VisualizeCollisionShapes, true);
            Core.SetParameter(PhysicsParameter.VisualizeCollisionAxes, false);
            Core.SetParameter(PhysicsParameter.VisualizeBodyAxes, false);
            Core.SetParameter(PhysicsParameter.VisualizeContactNormal, false);
            Core.SetParameter(PhysicsParameter.VisualizeContactForce, false);
            Core.SetParameter(PhysicsParameter.VisualizeActorAxes, false);

            SceneDescription sceneDescription = new SceneDescription();

            sceneDescription.Gravity        = new Vector3(0f, Gravity, 0f);
            sceneDescription.TimestepMethod = TimestepMethod.Fixed;

            sceneDescription.Flags      = SceneFlag.SimulateSeparateThread;
            sceneDescription.ThreadMask = 0xfffffffe;
            Scene = Core.CreateScene(sceneDescription);

            Scene.UserContactReport = ContactReport.Instance;
            Scene.UserTriggerReport = TriggerReport.Instance;

            MaterialDescription description = new MaterialDescription();

            description.Restitution     = 0.1f;
            description.DynamicFriction = 0.2f;
            Scene.DefaultMaterial.LoadFromDescription(description);
            InitScene();
        }
Пример #2
0
        private PhysX()
        {
            try
            {
                Core = new StillDesign.PhysX.Core();
            }
            catch (Exception exception)
            {
                //ScreenManager.Graphics.IsFullScreen = false;
                //ScreenManager.Graphics.ApplyChanges();

                //MessageBox.Show("Error initializing PhysX.\n- Did you install the nVidia PhysX System Software?\n\n" + exception.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }

            //Core.SetParameter(PhysicsParameter.SkinWidth, (float)0.01f);
            Core.SetParameter(PhysicsParameter.VisualizationScale, (float)0f);
            Core.SetParameter(PhysicsParameter.ContinuousCollisionDetection, false);
            Core.SetParameter(PhysicsParameter.VisualizeCollisionShapes, true);
            Core.SetParameter(PhysicsParameter.VisualizeCollisionAxes, false);
            Core.SetParameter(PhysicsParameter.VisualizeBodyAxes, false);
            Core.SetParameter(PhysicsParameter.VisualizeContactNormal, false);
            Core.SetParameter(PhysicsParameter.VisualizeContactForce, false);
            Core.SetParameter(PhysicsParameter.VisualizeActorAxes, false);

            SceneDescription sceneDescription = new SceneDescription();
            sceneDescription.Gravity = new Vector3(0f, Gravity, 0f);
            sceneDescription.TimestepMethod = TimestepMethod.Fixed;

            sceneDescription.Flags = SceneFlag.SimulateSeparateThread;
            sceneDescription.ThreadMask = 0xfffffffe;
            Scene = Core.CreateScene(sceneDescription);

            Scene.UserContactReport = ContactReport.Instance;
            Scene.UserTriggerReport = TriggerReport.Instance;

            MaterialDescription description = new MaterialDescription();
            description.Restitution = 0.1f;
            description.DynamicFriction = 0.2f;
            Scene.DefaultMaterial.LoadFromDescription(description);
            InitScene();
        }
Пример #3
0
        public PEngine()
        {
            Stoped    = true;
            Paused    = false;
            Time      = 0;
            LastTime  = 0;
            DeltaTime = 0;
            Ph.CoreDescription CoreDesc = new Ph.CoreDescription();

            PUserOutput UserOut = new PUserOutput();

            Ph.Core core = new Ph.Core(CoreDesc, UserOut);
            Core = core;

            Ph.SceneDescription SceneDesc = new Ph.SceneDescription();
            //grawitacja
            SceneDesc.Gravity            = new PhMath.Vector3(0, 0, 0);
            SceneDesc.TimestepMethod     = Ph.TimestepMethod.Fixed;
            SceneDesc.GroundPlaneEnabled = true;
            Ph.Scene scene = Core.CreateScene(SceneDesc);
            Scene = scene;

            Scene.DefaultMaterial.DynamicFriction        = 0.5f;
            Scene.DefaultMaterial.StaticFriction         = 0.5f;
            Scene.DefaultMaterial.Restitution            = 0f;
            Scene.DefaultMaterial.RestitutionCombineMode = Ph.CombineMode.Minimum;
            Scene.DefaultMaterial.FrictionCombineMode    = Ph.CombineMode.Max;

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

            Core.Foundation.RemoteDebugger.Connect("localhost");
        }