Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Rigidbody on limbs pulls character all over

Discussion in 'Physics' started by ShaunUnity, Sep 13, 2019.

  1. ShaunUnity

    ShaunUnity

    Joined:
    Dec 8, 2017
    Posts:
    11
    I'm making a game where two teams of AI fighters attack each other with swords and shields. All the fight moves are controlled by an animation.

    I wanted to use physics on the sword and shields - meaning, I want the shields to actually block sword blows. But when I attach kinematic rigid bodies to the weapons and the characters start moving their limbs it makes the characters move all over the place like the weight of the weapons is pulling them from side to side.

    I was under the impression that setting a rigidbody to Is Kinematic would prevent this.
     
  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    1,666
    It should. Do you they have colliders that are overlapping? That could also cause unwanted movement.
     
  3. ShaunUnity

    ShaunUnity

    Joined:
    Dec 8, 2017
    Posts:
    11
    As in colliders on the same character, yes. There is a non-kinematic box collider on the main body that the shield passes through from time to time.
     
  4. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    1,666
    I thought of something else, did you turn off "use gravity" on your rigidbodies? I would have thought kinematic rigidbodies would ignore gravity but I'm not sure.
     
  5. ShaunUnity

    ShaunUnity

    Joined:
    Dec 8, 2017
    Posts:
    11
    Yep. Gravity is off on the weapons.
     
  6. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    1,666
    Going back to the colliders- if you set them to "trigger" does that solve the problem?

    Generally if you have objects with overlapping non-trigger colliders and they both have rigidbodies then they will constantly register a collision, causing them to move. On the otherhand, if you have two objects with overlapping non-trigger colliders and you have one rigidbody on a parent object then the two colliders will act as a "compound collider" which might be what you want. I don't remember how it works for kinematic rigidbodies, though.