Exemplo n.º 1
0
        protected virtual void CalculateShellVelocity()
        {
            Vector3 direction = mousePosition - firePoint.position;
            float   yOffset   = -direction.y;

            direction = Vector3.ProjectOnPlane(direction, Vector3.up);
            float distance = Mathf.Clamp(direction.magnitude, minimumShellDistance, maxShellDistance);
            float angle    = Vector3.Angle(firePoint.forward, Vector3.up) * Mathf.Deg2Rad;

            shellVelocity = ExtraFunctions.CalculateLaunchSpeed(distance, yOffset, Physics.gravity.magnitude, angle);
        }