Explanation Local Vs Global Space

I've read on the documentation and gone through google but my question is in terms of coding, when do I use this?

When do I need to worry about this? Such as if I'm using mouse look script, and i shoot, it dosen't shoot from whre the mouse is looking straight but now it's shooting from the side.

Any advice, thanks.

Also does anyone have a good explanation for local vs global space?

I'll try to explain local vs world in 2d and without rotation (because its hard to draw in ascii!)

When we say "this is the position of A in the world" - we are talking about the position of A relative to the world origin. The origin is 0, 0 and where the x & y axis meet. Below shows us A, B & C in WORLD space.

+5          |
+4          A
+3          |      B
+2          |  
+1          |  C
 0 ---------+---------
-1          |
  -9876543210123456789+

Imagine A (0, 4) is an alien, B (7, 3) is a Boss monster and C (3, 1) is our hero - Chris.

When we talk about local space we have to ask - local to what? To translate the world space into Chris' local space we put Chris at the center of the universe. And now in Chris's local space the it looks like.

+4          |
+3       A  |
+2          |   B
+1          |  
 0 ---------C---------
-1          |
  -9876543210123456789+

Long winded way of saying everything is relative - in world space its some arbitrary origin offset. In our local space example the world literally rotates and moves around Chris.

There is a button in the upper left of the Editor that lets you switch between the two, in terms of tool handles. Start rotating any object by dragging left and right over X, Y, or Z in the object's Transform component, while making sure the "Move" icon is selected, in the very upper-left of the Editor (it's next to the hand tool). Notice how the tool handles rotate, when you're viewing Local space handles, but stay fixed, when you're viewing Global space handles.

Unity has the concept of "world" space. But every object that you create has its own space, and they very often will not match up. Imagine the way whatever building you live in stays at a "fixed rotation", but you can turn around, within it. So, for example, when you're lying down, your own Y axis is aligned with the "world's" X-Z plane, not its Y axis.

Imagine you’re in a car. You have a position and rotation relative to in the car. You’re in the driver seat facing out the window. BUT, as the car drives around, and turns, your position on earth is changing, as well as your cardinal facing direction, but your position within the car has not changed.

Same goes with the GameObjects. If you nest a GameObject in another, and then move the parent GameObject around, the child GameObject moves with it. It’s local position is that inside its parent, where as the global is its position in the scene.
https://forum.unity3d.com/threads/what-is-the-difference-between-local-and-world-coordinates.389439/

If I may add to such an awesome answer (thank you by the way)… What I was trying to do is determine this local position by converting a 2D collision contact point (from world position to local, of course).

But what I though was that this local position was relative - not only to the targeted transform position - but also to its size… which your answer clarified that it’s not.

Couldn’t think of how to produce this size relative position until I compared the collider radius with the values I was getting. Turns out that with a collider, its radius can be used to determine that position.