Circular Path Offset Trick !
A long and dreary post about a neat little trick !
This is going to be obvious to some of you, and there might even be some out there who already use this, but it only occurred to me today . . . . . here's a quick and easy (and interactive) way to offset an actor travelling in a circular path.
We all know the usual way to send an actor around a circular path (or into 'orbit' around an object), which usually looks like some version of this . . .
Constrain X position to radius * cos (angle) + X centre point
Constrain Y position to radius * sin (angle) + Y centre point
. . . . and as most people seem to use either game.time or self.time for the angle - and as they both (usually) start at zero - then the actor will always start its journey around the circular path at 0° - which is the 3 o'clock position . . . . but if you want the actor to start at, for example, 180° or 90° or 35° ( . . . etc) then you would usually stick the offset in here . . .
Constrain X position to radius * cos (angle +offset) + X centre point
Constrain Y position to radius * sin (angle + offset) + Y centre point
. . . but if you just stick in 'self.rotation' instead of the offset value then you can interactively point the actor to the place you want it to start in the circular path - by 'interactively' I mean you can do this while in scene layout mode, just drag the actor's rotation handle to the desired start position.
Constrain X position to radius * cos (angle +self.rotation) + X centre point
Constrain Y position to radius * sin (angle + self.rotation) + Y centre point
https://www.youtube.com/watch?feature=player_detailpage&v=SW4NvStDpYM
Obviously this method will be useless for actors that need to be a certain fixed rotation, but for a lot of day to day game stuff (moving dots, asteroids, moons, spinning diamonds of death, visual FX . . . . etc) it might be handy.
Comments
Pssshhhh. Do you think we're dumb or something?? You call this a handy trick??
....Yeah I guess it is.....Thanks for sharing! :P
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Really cool, seems like it could have lots of uses.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
@Braydon_SFX, now I won't believe another word from him.
Handy tip @Socks. And a (*) for presentation.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com