Sin/Cos Trouble

supafly129supafly129 Posts: 414
edited February 17 in Working with GS (Mac)

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.

Can anyone please help? Maybe @Socks ?

(File attached for reference)



  • johnnymagnejohnnymagne NorwayPosts: 101
    edited February 17

    Multiply your y constrain sin function with -1

    And set self attribute "start pos y" to zero

  • supafly129supafly129 Posts: 414
    edited February 17

    @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.


  • johnnymagnejohnnymagne NorwayPosts: 101

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

  • SocksSocks London, UK.Posts: 12,459
    edited February 18

    @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

Sign In or Register to comment.