Search Unity

Rigidbody.AddForce Not working and Ragdoll stretching

Discussion in 'Physics' started by IchBinJager, Apr 16, 2016.

  1. IchBinJager

    IchBinJager

    Joined:
    Dec 23, 2014
    Posts:
    127
    Hey, two things.

    One when I try to do Rigidbody.AddForce( transform.forward * 30, ForceMode.Impulse ) the grenade just falls at my feet.

    Code (CSharp):
    1. active_grenade.Spoon_Seperated();
    2.        
    3.        
    4.         Rigidbody GrenadeBody = active_grenade.GetComponent<Rigidbody>();
    5.        
    6.         active_grenade.GetComponent<CapsuleCollider>().enabled = true;
    7.         GrenadeBody.isKinematic = false;
    8.         GrenadeBody.AddForce( transform.forward * 40, ForceMode.Impulse);
    9.         active_grenade.transform.parent = null;
    10.        
    11.         Debug.Log(active_grenade.GetComponent<Rigidbody>().velocity);
    12.    
    13.         active_grenade = null;
    14.        
    15.         animCtrl.SetBool("Grenading",false);
    16.         animCtrl.SetBool("Throwing",false);
    17.         animCtrl.SetLayerWeight(2,0F);
    18.        
    19.         active_weapon.transform.parent = animCtrl.GetBoneTransform(active_weapon.parent_bone);
    20.         active_weapon.transform.localPosition = active_weapon.Parented_Offset;
    21.         active_weapon.transform.localEulerAngles = active_weapon.Parented_Angle;
    Everything works fine except that the grenade just falls to his feet.

    The other problem is when I kill someone in my game their bodies go crazy and they jump into the sky and stretch their limbs into infinity. Is it because of the Rigidbodies being moved in editor? Or am I doing something else wrong maybe.
     
  2. IchBinJager

    IchBinJager

    Joined:
    Dec 23, 2014
    Posts:
    127
    I unknowingly had a large box collider in the scene which they were all in. That explains everything. I'm so sorry for occupying everyone's valuable time.
     
    Last edited: Apr 20, 2016