In the above simulation, the object is leaving when it is on the horizontal track.
It is always starts from stage==0, then move to stage==1, 2,3
Those are different stages in one complete trip.
What do you mean by "start on a straight horizontal track"?
Do you mean moving in from the right side (with velocity pointing to the left)?