Beispiel #1
0
    private void PassBallToPlayer(Passing targetPlayer)
    {
        var direction = DirectionTo(targetPlayer);

        _ball.transform.SetParent(null);
        _ball.GetComponent <Rigidbody>().isKinematic = false;
        _ball.GetComponent <Rigidbody>().AddForce(direction * passForce);
    }
Beispiel #2
0
    private void OnTriggerEnter(Collider other)
    {
        RugbyBall ball = other.GetComponent <RugbyBall>();

        if (ball != null)
        {
            ball.GetComponent <Rigidbody>().velocity    = Vector3.zero;
            ball.GetComponent <Rigidbody>().isKinematic = true;
            ball.transform.SetParent(transform);
        }
    }