map collisions, clamp function