Passing a Ball

  • Hello, is anyone able to inform me on how to pass a ball from one joystick controlled player to another. This would be used in a NRL based game where you can only pass backwards. Would this also be allowed to be interceptable. Any replies will be greatly appreciated.

  • I'm not sure exactly how your game works, but if the joystick controlled players and the ball are physics objects, you could have something like weld attach ball to the player holding it, when he throws it then detach the object and apply a force in the direction he throws it. Then to catch it the other player would weld attach it when it collides with them. It might look stupid because the ball would look like it just sticks to them wherever it hits the player. I hope this makes sense, if not could you give some more info?

  • @Aidan-Oxley so the ball doesn't stick to the player anywhere, you could have it move to the characters hands or something when it collides, and then weld attach.
    I don't know how well it would work if the character is moving.

  • @iTap-Development Yeah. You could even just turn on a timer for the ball to just move to the player at an anchor (timer 0s).

  • Admin

    Here's what I sent to your email. Posting here since it may give other users an idea. It's not a fully fleshed out method, but I think the concept is sound.

    If you only want to be able to pass backwards, you can use a behaviour like calculate direction (may be renamed to calculate angle, cant remember).
    to figure out where the team mate is in relation to the player. If they are behind, then turn on the "pass button" behaviours.
    This concept requires some math and calculations to get right. But I think that is one way that may work. Or at least it's an idea on how to get started.

Log in to reply