Ok. I modified the code a little bit and added some trig ,and it worked fine

ThanQ for helping