Announcement

Collapse
No announcement yet.

Trying to make the mouse not be able to go to the middle of the screen

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Trying to make the mouse not be able to go to the middle of the screen

    So I am trying to make it so the mouse gets blocked from going into the middle of the screen so it has to go around is there any way to make this happen?

    #2
    Lots of math and I'm afraid C++
    though you can try in blueprint with set mouse position...

    Because the cords are x and y your center is always 50% of screen width.

    You can do some basic website/css/html powered math there to get the are you are interested in offsetting in pixels.

    Get viewport size X / 100 = 1 unit.
    50 unit = screen center
    50 unit - 5units = 45 units = start left ignore field
    45 unit plus 5unit*2 = 55 unit - start right ignore field.

    Repeat math for y value of screen.

    now if the mouse current position is between those values you found, that's where you can add to the mouse position.

    Obviously, this is a square and not a circle.

    You can apply the same idea and use 5 units as the radius - so times 2 time Pi to get the area to test against. This will turn into a nightmare programmatically.

    A variable alternative for a circle - add a UMG component to the screen.
    set the image to transparent so it cannot be seen by the user.
    add a mouse over event.

    add a wider image by about 5 pixels with another mouse over.

    Within the wider image start storing the mouse position on overlap - every stored set of data is or can be though of as the previews frame.

    Within the smaller image overlap test the previews position vs the current position to obtain a direction.

    Create a system to choose how to reverse direction - this is important, you should take into account the direction the mouse was going (up down left right) and still allow movement in one logical direcrion but reverse or amplify the other to get the mouse to move around.
    Either way, up down left or right, push the cursor away to stop the overlap event...

    This should end up forcing the user to circle the mouse around.

    Comment


      #3
      Thanks but I got to be honest probably a bit to big brain for me lol

      Comment


        #4
        the first option is straight up math, stick to the square

        Comment

        Working...
        X