Stop sword from distorting character animation

I have a character with a sword as a child of his left hand (parent). I’ve added a Box Collider and Rigidbody to this sword (Is Trigger, Use Gravity, and Is Kinematic unticked) as I need it to react to collisions and other objects such as enemies.

The problem is that now that my sword has physical elements attached to it, it ‘collides’ with my character and distorts his running and rolling animations. This doesn’t happen when the Box Collider is unchecked, although I can’t identify why the Box Collider is doing this as my character has no Box Collider or Rigidbody himself. He does have a Character Controller, however. But yes, the Box Collider on the sword is what’s causing the problem.

I have tried to add a Fixed Joint component to my character’s left hand, making the sword the property of the Connected Body field - still no luck. Alternatively, perhaps turning off the sword’s physics while my character is running/rolling could be a solution, having it turned on only if he swings the sword? I’ve researched how to do this, but can’t seem to get that working either.

Can anyone identify why this is happening and/or provide a solution to the problem?

Many thanks for your time and support in advance.

try going to the layer collision matrix in Edit->Project Settings->Physics and make the layer go both the character and sword ignore each other (un-tick the correct box).

You can use Physics.IgnoreCollision(collider1, collider2). Arguments of this function are colliders of two objects, which you whant to ignore each other.

But there is other way - collision layers. Read about them here

Done it - assigning each GameObject to a layer and unticking them to cancel their collisions fixed the issue! :slight_smile: