write func setPosition