I added a box collider to my sword game object which was working fine initially but when I added rigid body to the sword component when ever the game starts my collider of the sword falls and doesn’t move with the player like it used to and it should here are the imagesalt text
Simply make sure your rigidbody doesn’t use gravity. Freeze position and rotation by the way.
EDIT : Since the sword may collide to the character’s collider, you could place the sword and the character in two different layers and use the collision matrix to ignore the collision between them (Edit > Projects settings > Physics).
Without the rigid body Unity counts the collider of the sword as a part of parent collider, i.e. complex collider made of few basic ones and moving along with one parent rigidbody. But when you add another rigidbody to the sword it becomes separate physical object and behaves on its own. The answer with constraints will of course help, but you should consider using physics joints to hold a sword in a hand or setting the rigidbody of the sword to be kinematic.