Check collision by position with Arcade Physics?

Is there a way to check if a physics sprite would collide with another object at a given position? I have tried something like this:

  // desired position to check player collision at
  const checkPosition = { x: 100, y: 100 }
  
  // temporarily change player position
  const pos = { x: player.x, y: player.y }
  player.setPosition(checkPosition.x, checkPosition.y)
    
  // test collision
  const collision = this.scene.physics.collide(player, otherObj)

  // set back to original position
  player.setPosition(pos.x, pos.y)

however, I can’t get the collision to return true. I suspect there needs to be an update cycle between updating the position and testing for collisions, but I can’t find any documentation to suggest that is the case.

Is there a good way to go about this?

Try something like physics/arcade/get bodies within rectangle.

Thanks for the suggestion. This will do what I need for collisions with other objects.

I did hit a bit of a snag trying to get it to work with tilemap layers (overlapRect will check the entire layer, not individual tiles in said layer), but I was able to use getTileAtWorldXY to check for a collision tile at a given point.