[2D] Raycast points to 0,0,0 instead of mouse...

Hey Guys. I’m a bit of a noob and I need some advice since google didn’t help me.
I’m working on a 2D platformer with shooting mechanics, and I’m trying to draw a raycast from the player to my mouse. The problem is, it only points from the player (or rather the used game object inside the player) to the coordinates 0,0. How can I fix that?
I’m using Unity 4.7.1f1 btw. Don’t ask why, I just like it better.

It tells me that it does shoot, but not that it collides with anything (which is not really surprising).

If you need more information, I will provide it as fast as I can!

here’s the code:

void Shoot ()
{
Debug.LogError(“Shoot!”);

	Vector2 mousePos = new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y);
	
	Vector2 firePointPos = new Vector2(firePoint.position.x, firePoint.position.y);
	
	RaycastHit2D hit = Physics2D.Raycast(firePointPos, mousePos-firePointPos, 100, whatToHit);
	
	Debug.DrawLine (firePointPos, (mousePos - firePointPos) * 100, Color.cyan);

	if (hit.collider != null) 
	{
		Debug.LogError("Collision");

		Debug.DrawLine(firePointPos, hit.point, Color.red);
	}
	
}

After a very long time searching for help, a nice guy in the Discord help chat firgured out a solution.
I can’t really explain what the problem was and why this code works, since he couldn’t even explain it but here’s the code:

void Shoot()
{
	Vector3 mouseScreen = Input.mousePosition;
	Vector3 mousePos = Camera.main.ScreenToWorldPoint(new Vector3(mouseScreen.x, mouseScreen.y, 10.0f)); // Turns the mouses position on the screen into a point in world space.
	cursorPos = mousePos;
	Debug.Log (mousePos.x + "." + mousePos.y);
	RaycastHit2D hit = Physics2D.Raycast(transform.position, mousePos, 100, whatToHit);
	FireBlob ();
	Debug.DrawLine(transform.position, mousePos, Color.cyan);

	if (hit.collider)
	{
		Debug.Log("Collision");
		Debug.DrawLine(transform.position, hit.point, Color.red);
	}
}

void FireBlob ()
{
	Instantiate (blobPrefab, firePoint.position, firePoint.rotation);
}

// An IEnumerator is somewhat complex internally but very simple to understand, just remember that "yield return new WaitForSeconds(X)" will cause it to be delayed by X amount of seconds.
IEnumerator FireWait()
{
	yield return new WaitForSeconds(timeBetweenShots);
	canFire = true;
}

Hope that helps someone out there ^^