function [gstop, isterminal, direction] = stopper(t,y)
% STOPPER : event specification function to detect hitting the ground

gstop = y(1);    % the event is when height x (which is y(1)) is 0

isterminal = 1;  % stop the ODE integration at this event

direction = [];  % don't care which direction we hit 0 from 