Is it possible to make infantry duck behind trenches, rather just stand there waiting for a musket ball to crack them in the face?

This could work similarly to when a unit takes cover behind a wall... is it possible to give the same system to getting behind trenches?