function [value,isterminal,direction] = hitground(t,y)

value = y(2); % Check for zero crossings of y position
isterminal = 1; % Terminate on a zero crossing
direction = -1; % We only care about crossing y > 0 to y < 0