Search Unity

Question Transform Shooting Logic from Bottom Center to Right Middle

Discussion in 'Scripting' started by siddharth3322, Sep 27, 2022.

  1. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    For basketball shooting functionality implementation for my game, I have purchased this plugin.
    https://assetstore.unity.com/packages/templates/systems/basketball-shooting-game-starter-kit-43629

    This plugin working very well, shooting and physics implementation is really good.
    But as per my game setup, I required to add small touch or swipe area through which game players can swipe and shoot the ball.

    Check below image to get my point clearly:
    basketball shooting scene edited.png

    As per current implementation, shooting is working based on bottom center shoot point as like I have shown.
    Complete code was working based on Unity units, just swipe points get converted to ScreenToWorldPoint.

    Now I want to switch complete swiping functionality to right side swipe area, as like I have mentioned above image, where I have start to end data in pixels.
    What logic shall I required to write convert it into world points?
    So as like center screen swipe it starts working with this rectangular touch area.

    I knew this is a broad question but I expect for some hint for this implementation.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    Steps to success:

    - identify the components going into the "shoot intention" as it exists now

    - identify how your new system will have to mimic this "shoot intention"

    - implement your system in a blank scene until you prove that it replicates the "shoot intention" you want

    - integrate it into your game.

    There are thousands (perhaps millions) of tutorials for swiping and tapping and every form of screenpoint to worldpoint coordinate conversions you can imagine.
     
  3. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    Basically I even don't need an actual code for this implementation.
    But I want few words of wisdom those become useful to me in writing code :)
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    I have given you that above.

    Until YOU understand how the numbers from your fingers are fed into the shot, NOBODY here will understand it.

    Once you understand it, then you contemplate how to change the input.