My sword pushes enemies around?

Literally just started using Unity yesterday, and I’m slapping together a little third person action game to learn the ropes and try to get a grip on C#.

I currently have a player that moves around correctly, and an enemy that is able to follow the player around.

I gave the player the ability to transition into an attacking animation when the player clicks LMB, and the enemy correctly detects when its been struck by the sword and plays a “damage” animation.

The only issue is that in order for the sword to detect collisions with the enemy, and in order for the enemy to use the NavMesh, I had to give it a RigidBody, and when the player’s sword hits the enemy, it gets pushed around by the sword.

I had a little workaround where the enemy got RigidBody.isKinematic enabled briefly when it was hit, but this doesn’t work all of the time.

I’m sure there’s a much better way to handle this, but like I said, I’m new and would appreciate the help.

The player has a Character Controller, the sword bone of the model has a capsule collider that is parented by the sword, so it sticks to it, and the enemies have a RigidBody, NavMeshAgent, and Capsule Collider.

EDIT: to clarify, the player model itself pushes the enemy around; the sword is part of the player model.

If you don’t need the sword to bump anything around, you can use triggers. Triggers are like colliders except don’t actually bump stuff, they just allow for use of the OnTriggerEnter() function and similar functions to detect overlapping objects. To make a collider a trigger, check the “Is Trigger” box in the collider in the inspector.

Collider manual page, with a section on triggers.