Regularity along optimal trajectories of the value function of a Mayer problem