コード例 #1
0
        /// <inheritdoc />
        protected override void OnRender()
        {
            var force = _joint.GetMotorForce(TestSettings.Hertz);

            DrawString($"Motor Force = {force}");
            ImGui.SetNextWindowPos(new Vector2(10.0f, 100.0f));
            ImGui.SetNextWindowSize(new Vector2(200.0f, 100.0f));
            ImGui.Begin("Joint Controls", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize);

            if (ImGui.Checkbox("Limit", ref _enableLimit))
            {
                _joint.EnableLimit(_enableLimit);
            }

            if (ImGui.Checkbox("Motor", ref _enableMotor))
            {
                _joint.EnableMotor(_enableMotor);
            }

            if (ImGui.SliderFloat("Speed", ref _motorSpeed, -100.0f, 100.0f, "%.0f"))
            {
                _joint.SetMotorSpeed(_motorSpeed);
            }

            ImGui.End();
        }
コード例 #2
0
        //void UpdateUI()
        //{
        //	ImGui::SetNextWindowPos(ImVec2(10.0f, 100.0f));
        //	ImGui::SetNextWindowSize(ImVec2(200.0f, 100.0f));
        //	ImGui::Begin("Joint Controls", nullptr, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize);

        //	if (ImGui::Checkbox("Limit", _enableLimit))
        //	{
        //		_joint.EnableLimit(_enableLimit);
        //	}

        //	if (ImGui::Checkbox("Motor", _enableMotor))
        //	{
        //		_joint.EnableMotor(_enableMotor);
        //	}

        //	if (ImGui::SliderFloat("Speed", _motorSpeed, -100.0f, 100.0f, "%.0f"))
        //	{
        //		_joint.SetMotorSpeed(_motorSpeed);
        //	}

        //	ImGui::End();
        //}

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            base.Update(settings, gameTime);

            float force = _joint.GetMotorForce(settings.Hz);

            DrawString("Motor Force = " + force);
        }
コード例 #3
0
ファイル: Prismatic.cs プロジェクト: CrazyLiu00/GMap
        public override void Step(Framework.Settings settings)
        {
            base.Step(settings);
            _debugDraw.DrawString(50, _textLine, "Keys: (l) limits, (m) motors, (p) speed");
            _textLine += 15;
            double force = _joint.GetMotorForce();

            _debugDraw.DrawString(50, _textLine, "Motor Force = {0:n}", (double)force);
            _textLine += 15;
        }
コード例 #4
0
        /// <inheritdoc />
        public override void OnRender()
        {
            DrawString("Keys: (l) limits, (m) motors, (s) speed");

            var force = _joint.GetMotorForce(1 / TestSettings.Dt);

            DrawString($"Motor Force = {force}");

            if (Input.GetKeyDown(KeyCode.L))
            {
                _joint.EnableLimit(!_joint.IsLimitEnabled());
            }

            if (Input.GetKeyDown(KeyCode.L))
            {
                _joint.EnableMotor(!_joint.IsMotorEnabled());
            }

            if (Input.GetKeyDown(KeyCode.L))
            {
                _joint.SetMotorSpeed(-_joint.GetMotorSpeed());
            }
        }
コード例 #5
0
ファイル: Prismatic.cs プロジェクト: yuyixiaoxiang/Box2DSharp
        /// <inheritdoc />
        protected override void PreStep()
        {
            DrawString("Keys: (l) limits, (m) motors, (s) speed");

            var force = _joint.GetMotorForce(TestSettings.Frequency);

            DrawString($"Motor Force = {force}");

            if (Input.GetKeyDown(KeyCode.L))
            {
                _joint.EnableLimit(!_joint.IsLimitEnabled());
            }

            if (Input.GetKeyDown(KeyCode.L))
            {
                _joint.EnableMotor(!_joint.IsMotorEnabled());
            }

            if (Input.GetKeyDown(KeyCode.L))
            {
                _joint.SetMotorSpeed(-_joint.GetMotorSpeed());
            }
        }
コード例 #6
0
        /// <inheritdoc />
        protected override void OnRender()
        {
            var force = Joint.GetMotorForce(TestSettings.Hertz);

            DrawString($"Motor Force = {force}");
        }