Particle-based modeling of dynamics in presence of obstacles