setPos() is implemented with better efficiency