"Infinite" mouse position - 3D Camera

Hello!

I am actually playing with 3D, and I decided to update the camera by myself, trying to avoid the camera modes provided by raylib, in order to learn, as always.

My problem is that when I rotate my camera around the "player", using the mouse, the location is limited at my screen (monitor) bounds.

I am not sure about how should I fix it. I have taken a look at camera.c, I have probably skiped something, but well, I am stuck with it.

I hope you can help me ^^

Thanks

Comments

  • I supose you want to make a orbit camera. To make it, you should not use directly the current mouse position to update the orbit camera position.

    You should have a Vector2 to know the current orbit position to calculate it and update these values calculating a deltaPosition (how much the mouse was moved since last frame?). Then, you can apply a smooth when update these values...

    Using this method you can handle a orbit camera without considering screen size...

    I hope I help you a little bit
  • Hello fisac,
    Thanks for your answer. My problem is that the mouse reaches the monitor bound, so the mouse can't be moved anymore in the bound direction, which means that the current mouse position is the same than the previous frame mouse position. What I am wanting to do is to keep the mouse position in the middle of the raylibs window or make it "infinite" (When the mouse reaches the left bound, it moves to the right bound).

    The question seems to be more stupid with every word I write xD. I am going to take a look at camera.c again, I must be missing something.

  • Hello MarcMDE! In case you haven't found the answer yet. The key is the function: SetMousePosition(Vector2 position);
    It resets the mouse position to the center of the screen if it goes out of bounds! ;)
Sign In or Register to comment.