Jump to content
  • Advertisement

jsquare89

Member
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

120 Neutral

About jsquare89

  • Rank
    Newbie

Personal Information

  • Interests
    Programming
  1. I am somewhat new to game development and trying to create a basic 3d engine. I have managed to set up a first person camera and it seems to be working fine for the most part. While I am able to look up, down, left and right just fine the camera is constrained to the mouse movement in the window (i.e when the mouse reaches edges of the window it discontinues camera rotation and mouse is out of window bounds. I tried to use SDL_WarpMouseInWindow(window, center.x,center.y) but when I do this then it messes up the camera and the camera is stuck, even though there is some slight movement of the camera, it keeps going back to the center. void Camera::UpdateViewByMouse(SDL_Window &window, glm::vec2 mousePosition) { float xDistanceFromWindowCenter = mousePosition.x - ((float)1024 / 2) ; float yDistanceFromWindowCenter = ((float)720 / 2) - mousePosition.y; yaw = xDistanceFromWindowCenter * cameraRotationSpeed; pitch = yDistanceFromWindowCenter * cameraRotationSpeed; SDL_WarpMouseInWindow(&window, 1024 / 2, 768 / 2); } i’ve been stuck on this for far too long. any help would be much appreciated i have also tried relative mouse movement, and .xrel and .yrel to avail. polling mouse state with sdl_event. I do also know that SDL_WarpMouseInWindow makes change to event and have tried also ignore and reenabling to no avail
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!