2D Raycast doesn't Hit colliders

Hello everybody,
i have a problem with a RaycastHit check, for some reason it doesn’t detect any hit on colliders.
This is my code:

void FixedUpdate ()
	{
		velocity = player.GetComponent<PlayerMotion> ().velocity;
		deltaTime = player.GetComponent<PlayerMotion> ().deltaTime;
		var ray = new Vector2(target.position.x , target.position.y) + new Vector2(0.4f,0f);

				if (velocity.x < 0) {
						rayDirection = -Vector2.right;
						rayDistance = velocity.x;
				} else if (velocity.x > 0) {
						rayDirection = Vector2.right;
						rayDistance = velocity.x;
				} else if (velocity.y < 0) {
						rayDirection = -Vector2.up;
						rayDistance = velocity.y;
				} else if (velocity.y > 0) {
						rayDirection = Vector2.up;
						rayDistance = velocity.y;
				}


		rayDistance = Mathf.Abs (rayDistance * deltaTime);

		Debug.DrawRay (ray,rayDirection, Color.green);

		var _raycastHit = Physics2D.Raycast(ray , rayDirection, rayDistance, LayerMask.NameToLayer("TestLayer"));


		if ( _raycastHit )
						Debug.Log ("Hit!");

Using TestLayer cause these are the only objects i want the collision to be detected with.
Thanks to debug.DrawRay() i can clearly see my Ray hitting on the desired collider, but the debug log “Hit!” never shows up so i assume the raycastHit is not being detected.
What am i missing??
(velocity is the player movement taken from another class)
Thanks a lot

This is most likely your problem:

rayDistance = Mathf.Abs (rayDistance * deltaTime);

If your game is running at 60 fps, the ray you are using in your Debug.DrawRay() is approximately 60 times longer than the one you are using in your Physics2D.Raycast(). I’m not sure why you feel you must scale the distance by deltaTime, so it is hard to give you a definitive fix.