Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        Vector3 force = transform.forward * transform.localScale.z;

        RaycastHit hit;

        if (ProjectileUtils.BallisticCast(transform.position, force, out hit, precision))
        {
            hitPosition = hit.point;
        }
    }
Exemple #2
0
    public static bool tryHitWithBallisticCast(Frame target, Vector3 position, Vector3 velocity, float angle, out Vector3 force)
    {
        force = Vector3.RotateTowards(velocity, Vector3.up, angle, 0.0f);



        // Cast the ballistic curve to see, if it hits the target, otherwise, keep looking!
        RaycastHit hit;

        if (ProjectileUtils.BallisticCast(position, force, out hit))
        {
            Frame d = hit.collider.GetComponent <Frame>();

            if (d == target)
            {
                return(true);
            }
        }

        return(false);
    }