Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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