void Update()
    {
        Ray        ray = camera.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            print("I'm looking at " + hit.transform.name);

            if (hit.transform.name == "makeAhuman")
            {
                //hit.rigidbody.AddForce(transform.forward * 5);
                hit.transform.gameObject.GetComponent <CapsuleCollider>().enabled = false;

                Animator die     = hit.transform.gameObject.GetComponent <Animator>();
                Raggdoll ragdoll = hit.transform.gameObject.GetComponent <Raggdoll>();
                if (die != null && ragdoll != null)
                {
                    print("die.enabled = false; ");
                    ragdoll.enabledParts();
                    //  coroutine = WaitAndPrint(2.0f, die);
                    //   StartCoroutine(coroutine);
                    StartCoroutine(waitFrame(die, ragdoll));
                    //waitFrame(die)

                    //die.enabled = false;
                }
            }
        }
        else
        {
            print("I'm looking at nothing!");
        }
    }
    IEnumerator waitFrame(Animator die, Raggdoll ragdoll)
    {
        yield return(new WaitForSeconds(1f));

        print("3 sec !");
        die.enabled = false;
        ragdoll.pelvis.GetComponent <Rigidbody>().AddForce(transform.forward * 5);
        yield return(null);
    }
        IEnumerator waitFrame(Animator animator, Raggdoll ragdoll, CapsuleCollider capsulCollider)
        {
            yield return(new WaitForSeconds(1f));

            print("wait 1 sec !");
            capsulCollider.enabled = false;
            animator.enabled       = false;

            //ragdoll.pelvis.GetComponent<Rigidbody>().AddForce(transform.forward * 5);
            yield return(null);
        }
        public void Shoot()
        {
            // Reset the timer.
            timer = 0f;

            // Play the gun shot audioclip.
            gunAudio.Play();

            // Enable the lights.
            gunLight.enabled  = true;
            faceLight.enabled = true;

            // Stop the particles from playing if they were, then start the particles.
            gunParticles.Stop();
            gunParticles.Play();

            // Enable the line renderer and set it's first position to be the end of the gun.
            gunLine.enabled = true;
            gunLine.SetPosition(0, transform.position);

            // Set the shootRay so that it starts at the end of the gun and points forward from the barrel.
            shootRay.origin    = transform.position;
            shootRay.direction = transform.forward;
            gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range);

            // Perform the raycast against gameobjects on the shootable layer and if it hits something...
            if (Physics.SphereCast(shootRay, 1f, out shootHit, range, shootableMask))
            {
                AIHealth enemyHealth = shootHit.collider.GetComponent <AIHealth>();
                if (enemyHealth != null)
                {
                    // ... the enemy should take damage.
                    enemyHealth.TakeDamage(damagePerShot, shootHit.point);
                    //  shootHit.rigidbody.constraints &= RigidbodyConstraints.FreezeAll;

                    if (shootHit.rigidbody != null)
                    {
                    }

                    if (enemyHealth.currentHealth <= 0)
                    {
                        shootHit.rigidbody.isKinematic = true;
                        Animator        animator       = shootHit.transform.gameObject.GetComponent <Animator>();
                        CapsuleCollider capsulCollider = shootHit.transform.gameObject.GetComponent <CapsuleCollider>();
                        Raggdoll        ragdoll        = shootHit.transform.gameObject.GetComponent <Raggdoll>();

                        if (animator != null && capsulCollider != null && capsulCollider.enabled == true)
                        {
                            ragdoll.enabledParts();
                            // capsulCollider.enabled = false;
                            StartCoroutine(waitFrame(animator, ragdoll, capsulCollider));
                        }
                    }
                }

                // Set the second position of the line renderer to the point the raycast hit.
                gunLine.SetPosition(1, shootHit.point);
            }
            // If the raycast didn't hit anything on the shootable layer...
            else
            {
                // ... set the second position of the line renderer to the fullest extent of the gun's range.
                gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range);
            }
        }