Sin/Cos Trouble
supafly129
Member Posts: 454
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)
Thanks!
Comments
Multiply your y constrain sin function with -1
And set self attribute "start pos y" to zero
@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!
POLAR ROLLOUT (New Line-Drawing Physics Puzzler!) - FREE Download
Hehe, I know the feeling. Glad it worked out for you....
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