Search Unity

Calculating estimated position.

Discussion in 'Scripting' started by Keith90, May 5, 2015.

  1. Keith90

    Keith90

    Joined:
    Sep 27, 2013
    Posts:
    116
    Hello,

    Currently I'm working on a sports game. Right now I'm working on passing. I'm able to pass the ball between players when they don't move. However, when either one moves or when they move both, the ball reaches where the target was, as opposed to where the target will be.

    I'm not sure of the math behind it, but how would I essentially estimate where the ball should be passed to based on the direction the player is going and the speed of the player? I assume that I'd be able to use this whether one player is moving or both.

    I appreciate any help and information.

    Thanks for your time.

    - Keith.
     
    Last edited: May 5, 2015
  2. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    969
  3. Keith90

    Keith90

    Joined:
    Sep 27, 2013
    Posts:
    116
    I'll have to look more into that, find a lesson online. Thanks. :)
     
  4. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    969
  5. Keith90

    Keith90

    Joined:
    Sep 27, 2013
    Posts:
    116
    Looks like I have a lot of reading ahead of me.

    The hacked way I have now is I have a child object that I place ahead of the target. When I pass, the child object becomes the new target, so that way by the time the parent gets there, it meets up with the ball.