Checking if colliders are present before moving

Hey guys,

Just wanted to know if it was possible to have the following scenario:

  1. 2 objects with box colliders attached moving in parallel “lanes”
  2. Object on the left wants to switch lanes but can only do so if it doesn’t collide with anything during the move
  3. If there’s no possible collision, move the object. otherwise, don’t move.

Essentially what I’m looking for is a way to check for collisions without actually moving the collider yet - so that a collision can be prevented.

Is this possible?

this is a job for raycasts

If there was ever a “wow, I can’t believe I didn’t think of that” moment, this would be it.

Much obliged sir.