Transform.position alternative

I am trying to do a RigidBody2D that you can grab with your mouse.

So far this has worked pretty good but when trying to hit other RigidBodies, it just seems to freak out and do nothing, the expected behavior would be for the RigidBody to get flinged.

I don’t know what to do so please help.

Transform.Translate would be what you are looking for. Here is an example for how you would use it to make an object move towards your mouse:

using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
    public GameObject movableObject; // This is the object you want to move
    
    private void FixedUpdate()
    {
        Vector3 mousePosition = Input.mousePosition; // This line grabs the raw mouse position
        mousePosition = Camera.main.ScreenToWorldPoint(mousePosition); // This line converts the raw position into a position in the world space
    
        movableObject.transform.Translate(mousePosition);
    }
}

Could you help me with implementing this with a mouse?

The RigidBody2D seems to freak out when grabbed, i did a simple dragging thing and it worked okay with transform.position, but not with translate.