In most of the formulas I've found online GS = TAS + Vw, i.e. true air speed plus wind.

However, on the simulator, GS changes drastically if I dive or climb which is obvious because I'm covering 0 ground distance if I dive vertically. 

What is therefore a real GS formula from TAS? It has to take into account the wind (Vw) but also the "3D angle of the aircraft" (for the lack of better expression).