elastic collision implemented