Help with moving revolving object

originalrealtonytonesoriginalrealtonytones Member, PRO Posts: 12
edited August 2016 in Working with GS (Mac)

Hi all,

I have a problem that I'm not sure how to fix. I have an object, that i've managed to figure out how to make it revolve around a centre point thanks to the forums. For this i am using constrain attribute, not sure if i should though, as while it is doing its revolution i would like it to move from the right to the left of the screen if this makes any sense.

Constrain Attribute Position X - 50cos( game.Time *-150)+200
Constrain Attribute Position Y - 50
sin( game.Time *-150)+40

So I want it to revolve anticlockwise, which is working perfectly for me. Though i can't seem to make it move while doing that. If anybody could provide some info on how to do this, or what i need to change to make things work that would be great.

:)

T

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited August 2016

    @originalrealtonytones said:
    So I want it to revolve anticlockwise, which is working perfectly for me . . .

    At the moment, how you've have your constrains set up . . .

    Constrain X to 50 * cos( game.time *-150)+200
    Constrain Y to 50 * sin( game.time *-150)+40

    . . . means the actor will be moving in a clockwise direction rather than a counterclockwise direction. Angles, in maths, start at 0° (the 3 o'clock position) and move counterclockwise towards 90° (the 12 o'clock position). But your angles are decreasing because you have a minus sign in front of the game.time multiplier.

    tl;dr are you sure it's CCW at the moment ?

    @originalrealtonytones said:
    Though i can't seem to make it move while doing that. If anybody could provide some info on how to do this . . .

    The two values at the end of your constrain behaviours define the centre of the orbit, if you want to move the whole system across the screen (along the X axis) then you would change the '+200' value to change the system's x position.

    For example . . .

    Interpolate AAA from 1000 to 0
    Constrain X to 50 * cos( game.time *-150)+AAA
    Constrain Y to 50 * sin( game.time *-150)+40

    . . . or . . .

    Constrain X to 50 * cos( game.time *-150)+(1024-(game.time *100))
    Constrain Y to 50 * sin( game.time *-150)+40

    . . . or . . .

    Constrain X to 50 * cos( game.time *-150)+mouse X
    Constrain Y to 50 * sin( game.time *-150)+mouse Y

    . . . etc etc

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

    P.S

    Testing has shown that self.time is more efficient than game.time - it's not an enormous difference, but in all my tests - with a project set up to run at 50fps - using self.time had a 1fps advantage over game.time.

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

    Example file attached:

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

    Got carried away:

  • originalrealtonytonesoriginalrealtonytones Member, PRO Posts: 12

    . . . means the actor will be moving in a clockwise direction rather than a counterclockwise direction.

    Lol. Whoops. I did a typo!

  • originalrealtonytonesoriginalrealtonytones Member, PRO Posts: 12

    Meanwhile you're brilliant. I'll try it all out later and let you know how I go. Thanks heaps Mr!!! :smile:

Sign In or Register to comment.