collision logic in unit.cs