Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Move a ball in 3d space by swiping the mouse

Discussion in 'Input System' started by MrWhite136, Sep 13, 2023.

  1. MrWhite136


    Jun 7, 2023
    I hope I'm in the correct sub forum.

    I'm trying to make a football/soccer game as my first non tutorial project. I want to use the mouse cursor to add a force to the ball in such a way that the player can shoot and dribble with the mouse.

    So far, I've been unsuccessful in this after using multiple different methods.
    - I've looked at the input system but only 4 to 8 directions are available. I would prefer to have a full 360° control.
    - I've used 'mouse to world position' but it was unpredictable at times. I suspect that the perspective of my camera (the ball is more framed from the front than from above) may be to blame here.
    - I've tried using code from a ball throwing game but that resulted in a force applied in only 1 axis.

    Would anybody here have a suggesting where I should be looking?