How to make a sprite look at mouse on a XY plane ?

Hi !

I am working on a prototype for a top down space shooter on a normal 2D XY plane not a XZ one and I want to make the player look at the mouse.

I tried the raycast solution mentioned in the Survival Shooter project but it didn’t work because the Rigidbody2D rotation takes a float not a quaternion.

I tried LookAt and it didn’t work at all.

What can I do ?

Thanks in Advance

Vector3 lookAtTargetPos;
RigidBody2D rigidBody2D;

     void Update() {
          lookAtTargetPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
          Quaternion rot = Quaternion.LookRotation(transform.position - lookAtTargetPos, Vector3.forward);
    	   transform.rotation = rot;
    	   transform.eulerAngles = new Vector3 (0, 0, transform.eulerAngles.z);
    	   rigidBody2D.angularVelocity = 0;
      }