#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Sin/Cos Trouble

Posts: 451Member, PRO
edited February 2017

I'm trying to reverse the starting point/end point as show in my file for a moving actor (i.e. I would like the actor to start at the end point instead without any changes to the movement path itself). Tried changing several things around but was unable to solve after many attempts.

(File attached for reference)

Thanks!

• NorwayPosts: 112Member
edited February 2017

Multiply your y constrain sin function with -1

And set self attribute "start pos y" to zero

• Posts: 451Member, PRO
edited February 2017

@johnnymagne for some reason i swore i tried that multiple times and it wasnt working before, but i just did now and it might have been an issue with where i placed it in the formula.

Thanks!

• NorwayPosts: 112Member

Hehe, I know the feeling. Glad it worked out for you....

• London, UK.Posts: 12,821Member
edited February 2017

@supafly129 said:
I'm trying to reverse the starting point/end point as show in my file . . .

Beaten to the punch by @johnnymagne !

There are a couple of other ways you could have done it, for example simply changing your 'counter' default value to 180 would do the trick . . . . as 'counter' is being multiplied by 'speed' and 'speed' is set to 3 . . . . therefore 180 * 3 is 540, which is 180° out of phase with 0°.

Hope that made sense !! Basically you have an actor moving through a deformed circle and you want that movement to start at 180° rather than 0°, so just add 180° to the angle value that cos/sin are operating on . . . you can add in those extra 180 degrees wherever you want . . . besides simply adding them to the 'counter' default value another place you could add them would be here . . .

cos(self.counter`*`self.speed x+180)`*`self.pixels x+self.start pos x

. . or here . . .

cos(180+self.counter`*`self.speed x)`*`self.pixels x+self.start pos x

. . . etc etc