Off-Centre Pivot Point

SocksSocks London, UK.Member Posts: 12,822
edited February 2015 in Working with GS (Mac)

This is another question that comes up from time to time, how to rotate your actor around a point other than its own centre . . . I know it's been addressed in the past (for example RThurman did a great demo a while back), but I thought it would be useful to have a fully interactive project, where you could simply move the pivot point to where you need it to be.

GS project attached.

You can move the actor and/or the pivot point, change the size of the actor, the actor's rotation and so on . . . and it will always rotate around the pivot point.

It should be fairly straightforward to copy this system into your own project as there are only two actors, the pivot point passes its X and Y to the main actor via two game.attributes, so pretty easy to set up.

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2015

    The three constrain behaviours in the main actor are what make it rotate.

    At the moment they all just use the game clock as an incrementing value (which keeps it spinning), but you can use whatever you like to control the rotation - you just need to replace the 'game.time *100' part in each of the three constrain behaviours with - for example - an attribute that increases when you press right and decreases when you press left . . . or - for example - you could have a value that is being interpolated up and then down to have the actor rotate back and forward . . .

  • RabidParrotRabidParrot Formally RabidParrot. Member Posts: 956

    Thanks! Bookmarked.

  • ArmellineArmelline Member, PRO Posts: 5,421

    Great stuff! Thanks for sharing!

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Must...not...give...awesome...

  • GSAnimatorGSAnimator Member Posts: 312

    Thanks for sharing :)

  • SocksSocks London, UK.Member Posts: 12,822

    @Rabid Parrot said:
    Thanks! Bookmarked.

    @Armelline said:
    Great stuff! Thanks for sharing!

    @Braydon_SFX said:
    Must...not...give...awesome...

    @GSAnimator said:
    Thanks for sharing :)

    Cheers :smile:

    By the way, you can have multiple actors all using the same pivot point, no need to modify anything, just drag some extra actors into the scene, so it kind of acts like an interactive constrain system as well (although Fast Constrain might be better for that kind of thing - https://forums.gamesalad.com/discussion/75220/fast-constrain-linkmachine-v2 ).

  • RabidParrotRabidParrot Formally RabidParrot. Member Posts: 956

    Is it possible to have the actor begin to pivot after a rule is complete? I've noticed that since its controlled by game.time the actor doesn't begin to rotate from its current position. The actor jumps depending on game.time.

  • RabidParrotRabidParrot Formally RabidParrot. Member Posts: 956
    edited February 2015

    Found it!

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2015

    @Rabid Parrot said:
    Is it possible to have the actor begin to pivot after a rule is complete? I've noticed that since its controlled by game.time the actor doesn't begin to rotate from its current position. The actor jumps depending on game.time.

    .

    @Socks said:
    The three constrain behaviours in the main actor are what make it rotate.

    At the moment they all just use the game clock as an incrementing value (which keeps it spinning), but you can use whatever you like to control the rotation - you just need to replace the 'game.time *100' part in each of the three constrain behaviours with - for example - an attribute that increases when you press right and decreases when you press left . . . or - for example - you could have a value that is being interpolated up and then down to have the actor rotate back and forward . . .

  • MarcMySaladMarcMySalad Member Posts: 158

    @Socks great job man and thanks for sharing

  • ApprowApprow Member Posts: 703

    @Socks something I was waiting for as a gamesalad feature, but you just did it haha. Amazing job, THANKS!!

  • LumpAppsLumpApps Member Posts: 2,881
    edited February 2015

    Nice!

    A special treat for @Socks in line with this project:

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    Very nice!

  • HopscotchHopscotch Member, PRO Posts: 2,782

    Nice and concise!

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881

    Nice demo!

  • SocksSocks London, UK.Member Posts: 12,822

    @MarcMySalad said:
    @Approw said:
    @LumpApps said:
    @jamie_c said:
    @Hopscotch said:
    @RThurman said:

    Cheers !! :smile:

  • tiger27tiger27 Member Posts: 127
    edited May 2015

    @Socks Your video (on all discusions) don't seem to be working, so I have no idea what you mean in the screenshot by Self.M and Self.SA. Plus, what is that Self. on the end? Thanks in advance Socks!

    (Like my "emoji"?) ^

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2015

    @tiger27 said:
    Socks Your video (on all discusions) don't seem to be working, so I have no idea what you mean in the screenshot by Self.M and Self.SA. Plus, what is that Self. on the end? Thanks in advance Socks!

    Self.M = Magnitude
    Self.SA = Self Angle
    Self. on the end = Self.A (vector angle actor / pivot)

Sign In or Register to comment.