Directional force for Rigidbody's 'AddForce'

Hey there guys, I am having a bit of an issue with the directions of force being produced by a rigidbody.
What I am trying to achieve is a realistic gun shooting mechanic.
So how this works is, when you shoot, a bullet casing is instantiated, being shot out the side of the gun.
Also a bullet gets instantiated and gets shot forward by the given force, this works great in theory and great as a prop, as can be seen in the below youtube clip.

but when the gun is attached to a FirstPersonCharacter both objects (bullet and casing) get forced in the same direction (example, the casings shoot out to the right hand side of the gun, but if i spin the character 180 degrees, they are now being shot out to the left side of the gun. so this added force is relative to the worlds direction, not the direction of its parent object (the gun)... how can this be achieved to use the direction of the parent (the gun) to send the force from and not the world's directions?

EDIT:
My apologies, I had forgotten to add my piece of code, the gun handles all the shooting things, but once instantiated the objects take over from there own scripts.

Bullet Casing Script:

using UnityEngine;

public class ejectCase : MonoBehaviour {


    float thrust = 250;
    Rigidbody rig;

	// Use this for initialization
	void Start () {
        rig = this.GetComponent<Rigidbody>();
        rig.AddForce(transform.right * thrust);
	}
	
	// Update is called once per frame
	void Update () {
		
	}
}

Bullet Script:

using UnityEngine;

public class pistolBulletScript : MonoBehaviour {

    float thrust = 1000;
    Rigidbody rig;

    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("testHit"))
        {
            Debug.Log("Bullet has hit Target, Health Removed from Target, Bullet Removed");
            Destroy(this.gameObject);
        }
    }

    // Use this for initialization
    void Start () {
        rig = this.GetComponent<Rigidbody>();
        rig.AddForce(-transform.forward * thrust);
    }
	
	// Update is called once per frame
	void Update () {
		
	}
}

Gun Script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestShoot : MonoBehaviour {

    public bool canShoot;
    public bool reloading;

    public float bulletClip = 17;
    float origClip;

    float shotTimer;
    float startRTimer;
    float reloadTimer = 1.5f;

    Animation anim;
    public AudioClip shotFired;
    public AudioClip reloadSound;
    public AudioClip emptyClip;
    AudioSource aud;

    public Vector3 caseEjector;
    public Transform casing;
    public Transform casePos;

    public Vector3 shootLoc;
    public Transform bullet;
    public Transform shootPos;

	void Start () {
        origClip = bulletClip;
        startRTimer = reloadTimer;
        aud = this.GetComponent<AudioSource>();
        anim = this.GetComponent<Animation>();
        canShoot = true;
        reloading = false;
	}

	void Update () {
        shotTimer += Time.deltaTime;

        if(shotTimer <= 0.4f)
        {
            canShoot = false;
        }
        else
        {
            canShoot = true;
        }

        if (canShoot && bulletClip > 0)
        {
            if (Input.GetButtonDown("Shoot"))
            {
                anim.Play("APCFire");
                aud.PlayOneShot(shotFired);
                bulletClip -= 1;
                shotTimer = 0;
                caseEjector = casePos.transform.position;
                shootLoc = shootPos.transform.position;
                Instantiate(casing, caseEjector, Quaternion.Euler(0, 90, 180));
                Instantiate(bullet, shootLoc, Quaternion.Euler(0, 90, 0));
            }
        }
        if (bulletClip <= 0 && canShoot)
        {
            if (Input.GetButtonDown("Shoot"))
            {
                aud.PlayOneShot(emptyClip);
                shotTimer = 0;
            }
        }

        if (Input.GetButtonDown("Reload"))
        {
            aud.PlayOneShot(reloadSound);
            canShoot = false;
            reloading = true;
            anim.Play("APCReload");
        }

        if (reloading)
        {
            reloadTimer -= Time.deltaTime;
            if(reloadTimer <= 0)
            {
                bulletClip = origClip;
                reloading = false;
                canShoot = true;
                reloadTimer = startRTimer;
            }
        }
    }
}

PS. all the directions are jacked up due to forward not actually being the tip of the bullet ect.
and for some reason all my buttons to make the text bolt and italic ect are missing, so i cannot click ‘code’ to add it correctly.

AddForce takes world directions. You can use AddRelativeForce instead, which assumes the direction is relative to the Rigidbody’s local space - for instance:

// shoot bullet in its forward direction with shotForce
bulletRbody.AddRelativeForce(Vector3.forward * shotForce);
// eject casing to its right with 45° elevation
casingRbody.AddRelativeForce(new Vector3(1,1,0).normalized * ejectForce);

EDITED:

Your code is ok, since it ejects the capsule in a direction relative to its transform. I suspect that the problem is the way you’re instantiating the capsule. You should have an empty game object (let’s call it “ejector”) childed to the gun at the position where the capsule is supposed to be created and ejected, and use its position and rotation when instantiating the capsule - like this example (script attached to the object “ejector”):

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EjectCapsule : MonoBehaviour {

	public GameObject capsule; // drag the capsule prefab here
	
	void Update () {
		if (Input.GetButtonDown ("Fire1")) {
			// create the capsule at this position and rotation:
			GameObject cap = Instantiate (capsule, transform.position, transform.rotation);
			Destroy (cap, 2f); // capsule disappears after 2 seconds
		}
	}
}

You can use the gun’s transform.right/down, forward, or whatever.

alternatively you can create a gameobject that is the transform and use that transform’s.direction (right, up, forward) to define the direction of the force.

I do not remember if the values are normalized. But that should work your issue.

I cannot give you a more complete answer without your code in gist, for instance.

I have updated and added my gun script also, I’m getting a lot of mixed messages here, It’s doing nothing but confusing the heck out of me.