A new method to quantify environment and model ram-pressure stripping in N-body simulations