Turning Camera with mouse

How could I make a point and click style mouse controlled camera?
Here are some pictures to show what I mean:

If the mouse is somewhere near the middle, the camera does not move.

If the mouse is more towards the left, the camera slowly starts to turn left

The closer the mouse is to the edge, the faster the camera turns


How would I be able to do this? I know I would need to use mouse.X and mouse.Y, but I dont know how I would use it to make the camera turn, filter the space where the mouse needs to be to move the camera, or how to do it for all directions.

Any help or tips?

2 Likes

Is this only for left or also for right?

Oh, never mind, you said for all directions!

1 Like

Try calculating the distance at which the mouse was clicked from the center of the screen in order to calculate the intensity at which you should move the camera

This is what I managed to do so far.


Its not really what I was looking for, but its a foundation to what I want to do.

I dont really know how to spin the camera endlessly…
Also, how do I rotate the camera in global space rather than local?

EDIT: Solved everything

I finally got it right!
Only the left side though…

How can I do it for the right side?

I did it!

4 Likes