Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualGroogy

Posted 30 January 2013 - 05:25 AM

Hi!

I'm currently in the process of tweaking our camera rotation for PC with the mouse. But I'm kind of stuck on getting a nice speed and acceleration to it that feels natural for the mouse. Got it pretty much nailed down the gamepad, a linear curve works pretty well for the camera rotation on the gamepad.

My question is if anybody fiddled around with this before that could help me out and might help me speed up my tweaking process.

We have an ad-hoc solution so you can attach an input controller whenever so we can support both keyboard/mouse and gamepad during a game and these can be used interchangeably. To give you a feel of how the rotation is done right now I'll provide a snippet of code:
namespace Input
{
    class MouseController : InputController
    {
        MouseState myLastState;
        const float MouseSensetivity = 0.5f;

        public MouseController()
        {
            myLastState = Mouse.GetState();
        }

        public InputState GetState()
        {
            MouseState mouse = Mouse.GetState();
            InputState state = new InputState();
            state.cameraRotation.X = ((float)mouse.X - myLastState.X) * MouseSensetivity;
            state.cameraRotation.Y = ((float)mouse.Y - myLastState.Y) * MouseSensetivity;

            /* ...A lot of more input code... */
            /* ...Not concerning rotation...  */

            Vector2 screenCenterPosition = new Vector2(Core.Instance.myDefaultViewPort.Width / 2, Core.Instance.myDefaultViewPort.Height / 2);
            if (Root.Instance.myGFXManager.IsFullScreen == false)
            {
                screenCenterPosition.X = Root.Instance.myWindow.ClientBounds.Center.X;
                screenCenterPosition.Y = Root.Instance.myWindow.ClientBounds.Center.Y;
            }
            Mouse.SetPosition((int)screenCenterPosition.X, (int)screenCenterPosition.Y);
            myLastState = Mouse.GetState();
            return state;
        }
    }
}
I've tried a lot of several modifications to the state.cameraRotation vector but haven't really found anything that feels nice. or even work at all.

Thanks on before hand!

#5Groogy

Posted 30 January 2013 - 05:24 AM

Hi!

I'm currently in the process of tweaking our camera rotation for PC with the mouse. But I'm kind of stuck on getting a nice speed and acceleration to it that feels natural for the mouse. Got it pretty much nailed down the gamepad, a linear curve works pretty well for the camera rotation on the gamepad.

My question is if anybody fiddled around with this before that could help me out and might help me speed up my tweaking process.

We have an ad-hoc solution so you can attach an input controller whenever so we can support both keyboard/mouse and gamepad during a game and these can be used interchangeably. To give you a feel of how the rotation is done right now I'll provide a snippet of code:
namespace Input{
    class MouseController : InputController
    {
        MouseState myLastState;
        const float MouseSensetivity = 0.5f;

        public MouseController()
        {
            myLastState = Mouse.GetState();
        }

        public InputState GetState()
        {
            MouseState mouse = Mouse.GetState();
            InputState state = new InputState();
            state.cameraRotation.X = ((float)mouse.X - myLastState.X) * MouseSensetivity;
            state.cameraRotation.Y = ((float)mouse.Y - myLastState.Y) * MouseSensetivity;

            /* ...A lot of more input code... */
            /* ...Not concerning rotation...  */

            Vector2 screenCenterPosition = new Vector2(Core.Instance.myDefaultViewPort.Width / 2, Core.Instance.myDefaultViewPort.Height / 2);
            if (Root.Instance.myGFXManager.IsFullScreen == false)
            {
                screenCenterPosition.X = Root.Instance.myWindow.ClientBounds.Center.X;
                screenCenterPosition.Y = Root.Instance.myWindow.ClientBounds.Center.Y;
            }
            Mouse.SetPosition((int)screenCenterPosition.X, (int)screenCenterPosition.Y);
            myLastState = Mouse.GetState();
            return state;
        }
    }
}
I've tried a lot of several modifications to the state.cameraRotation vector but haven't really found anything that feels nice. or even work at all.

Thanks on before hand!

#4Groogy

Posted 30 January 2013 - 05:24 AM

Hi!

I'm currently in the process of tweaking our camera rotation for PC with the mouse. But I'm kind of stuck on getting a nice speed and acceleration to it that feels natural for the mouse. Got it pretty much nailed down the gamepad, a linear curve works pretty well for the camera rotation on the gamepad.

My question is if anybody fiddled around with this before that could help me out and might help me speed up my tweaking process.

We have an ad-hoc solution so you can attach an input controller whenever so we can support both keyboard/mouse and gamepad during a game and these can be used interchangeably. To give you a feel of how the rotation is done right now I'll provide a snippet of code:
namespace Input{
    class MouseController : InputController
    {
        MouseState myLastState;
        const float MouseSensetivity = 0.5f;

        public MouseController()
        {
            myLastState = Mouse.GetState();
        }

        public InputState GetState()
        {
            MouseState mouse = Mouse.GetState();
            InputState state = new InputState();
            state.cameraRotation.X = ((float)mouse.X - myLastState.X) * MouseSensetivity;
            state.cameraRotation.Y = ((float)mouse.Y - myLastState.Y) * MouseSensetivity;

            /* ...A lot of more input code... */
            /* ...Not concerning rotation...  */

            Vector2 screenCenterPosition = new Vector2(Core.Instance.myDefaultViewPort.Width / 2, Core.Instance.myDefaultViewPort.Height / 2);
            if (Root.Instance.myGFXManager.IsFullScreen == false)
            {
                screenCenterPosition.X = Root.Instance.myWindow.ClientBounds.Center.X;
                screenCenterPosition.Y = Root.Instance.myWindow.ClientBounds.Center.Y;
            }
            Mouse.SetPosition((int)screenCenterPosition.X, (int)screenCenterPosition.Y);
            myLastState = Mouse.GetState();
            return state;
        }
    }
}
I've tried a lot of several modifications to the state.cameraRotation vector but haven't really found anything that feels nice. or even work at all.

Thanks on before hand!

#3Groogy

Posted 30 January 2013 - 05:21 AM

Hi!

I'm currently in the process of tweaking our camera rotation for PC with the mouse. But I'm kind of stuck on getting a nice speed and acceleration to it that feels natural for the mouse. Got it pretty much nailed down the gamepad, a linear curve works pretty well for the camera rotation on the gamepad.

My question is if anybody fiddled around with this before that could help me out and might help me speed up my tweaking process.

We have an ad-hoc solution so you can attach an input controller whenever so we can support both keyboard/mouse and gamepad during a game and these can be used interchangeably. To give you a feel of how the rotation is done right now I'll provide a snippet of code:
namespace Input{    class MouseController : InputController    {        MouseState myLastState;        const float MouseSensetivity = 0.5f;        public MouseController()        {            myLastState = Mouse.GetState();        }        public InputState GetState()        {            MouseState mouse = Mouse.GetState();            InputState state = new InputState();            state.cameraRotation.X = ((float)mouse.X - myLastState.X) * MouseSensetivity;            state.cameraRotation.Y = ((float)mouse.Y - myLastState.Y) * MouseSensetivity;            /* ...A lot of more input code... */            /* ...Not concerning rotation... */            Vector2 screenCenterPosition = new Vector2(Core.Instance.myDefaultViewPort.Width / 2, Core.Instance.myDefaultViewPort.Height / 2);            if (Root.Instance.myGFXManager.IsFullScreen == false)            {                screenCenterPosition.X = Root.Instance.myWindow.ClientBounds.Center.X;                screenCenterPosition.Y = Root.Instance.myWindow.ClientBounds.Center.Y;            }            Mouse.SetPosition((int)screenCenterPosition.X, (int)screenCenterPosition.Y);            myLastState = Mouse.GetState();            return state;        }    }}

I've tried a lot of several modifications to the state.cameraRotation vector but haven't really found anything that feels nice. or even work at all.

Thanks on before hand!

#2Groogy

Posted 30 January 2013 - 05:21 AM

Hi!

I'm currently in the process of tweaking our camera rotation for PC with the mouse. But I'm kind of stuck on getting a nice speed and acceleration to it that feels natural for the mouse. Got it pretty much nailed down the gamepad, a linear curve works pretty well for the camera rotation on the gamepad.

My question is if anybody fiddled around with this before that could help me out and might help me speed up my tweaking process.

We have an ad-hoc solution so you can attach an input controller whenever so we can support both keyboard/mouse and gamepad during a game and these can be used interchangeably. To give you a feel of how the rotation is done right now I'll provide a snippet of code:
namespace Input{    class MouseController : InputController    {        MouseState myLastState;        const float MouseSensetivity = 0.5f;        public MouseController()        {            myLastState = Mouse.GetState();        }        public InputState GetState()        {            MouseState mouse = Mouse.GetState();            InputState state = new InputState();            state.cameraRotation.X = ((float)mouse.X - myLastState.X) * MouseSensetivity;            state.cameraRotation.Y = ((float)mouse.Y - myLastState.Y) * MouseSensetivity;            /* ...A lot of more input code... */            /* ...Not concerning rotation... */            Vector2 screenCenterPosition = new Vector2(Core.Instance.myDefaultViewPort.Width / 2, Core.Instance.myDefaultViewPort.Height / 2);            if (Root.Instance.myGFXManager.IsFullScreen == false)            {                screenCenterPosition.X = Root.Instance.myWindow.ClientBounds.Center.X;                screenCenterPosition.Y = Root.Instance.myWindow.ClientBounds.Center.Y;            }            Mouse.SetPosition((int)screenCenterPosition.X, (int)screenCenterPosition.Y);            myLastState = Mouse.GetState();            return state;        }    }}

I've tried a lot of several modifications to the state.cameraRotation vector but haven't really found anything that feels nice. or even work at all.

Thanks on before hand!

#1Groogy

Posted 30 January 2013 - 05:13 AM

Hi!

 

I'm currently in the process of tweaking our camera rotation for PC with the mouse. But I'm kind of stuck on getting a nice speed and acceleration to it that feels natural for the mouse. Got it pretty much nailed down the gamepad, a linear curve works pretty well for the camera rotation on the gamepad.

 

My question is if anybody fiddled around with this before that could help me out and might help me speed up my tweaking process.

 

We have an ad-hoc solution so you can attach an input controller whenever so we can support both keyboard/mouse and gamepad during a game and these can be used interchangeably. To give you a feel of how the rotation is done right now I'll provide a snippet of code:

 

namespace Input
{
    class MouseController : InputController
    {
        MouseState myLastState;
        const float MouseSensetivity = 0.5f;

        public MouseController()
        {
            myLastState = Mouse.GetState();
        }

        public InputState GetState()
        {
            MouseState mouse = Mouse.GetState();
            InputState state = new InputState();
            state.cameraRotation.X = ((float)mouse.X - myLastState.X) * MouseSensetivity;
            state.cameraRotation.Y = ((float)mouse.Y - myLastState.Y) * MouseSensetivity;

            /* ...A lot of more input code... */
            /* ...Not concerning rotation... */

            Vector2 screenCenterPosition = new Vector2(Core.Instance.myDefaultViewPort.Width / 2, Core.Instance.myDefaultViewPort.Height / 2);
            if (EuphoriaGame.Root.Instance.myGFXManager.IsFullScreen == false)
            {
                screenCenterPosition.X = EuphoriaGame.Root.Instance.myWindow.ClientBounds.Center.X;
                screenCenterPosition.Y = EuphoriaGame.Root.Instance.myWindow.ClientBounds.Center.Y;
            }
            Mouse.SetPosition((int)screenCenterPosition.X, (int)screenCenterPosition.Y);

            myLastState = Mouse.GetState();

            return state;
        }
    }
}

 

I've tried a lot of several modifications to the state.cameraRotation vector but haven't really found anything that feels nice. or even work at all.

 

Thanks on before hand!


PARTNERS