Confusion concerning Rotate to Angle and rotation direction

mhedgesmhedges Raised on VCSMember Posts: 634
edited September 2014 in Working with GS (Mac)

Hello

This may seem very simple, but I am confused concerning Rotate to Angle.

I have an Actor - a gate - which should behave similar to a pinball flipper. It's pointing to a start angle, say 120 (relative to scene), and when an action button is pressed, I want it to rotate clockwise to angle 60 (relative to scene). When the action button is pressed again, I want it to rotate counterclockwise back to 120 (relative to scene).

Rotate behaviour gives you control of direction (clockwise or counterclockwise), but not to angle.
Rotate to Angle behaviour gives you control of angle, but not direction.

This means that when I am hitting the Action button the second time, to go back to angle 120, the actor does it, but clockwise instead of counterclockwise.

What I have coded is:

  Gate Position = 0
  Rule:
  When action button pressed is true,
  Rotate to angle 60 relative to scene, run to completion, stops on destination
  Change attribute Gate Position to 1


  Gate Position = 1
  Rule:
  When action button pressed is true,
  Rotate to angle 120 relative to scene, run to completion, stops on destination
  Change attribute Gate Position to 0

Any clues as to how to solve the direction issue? Thanks, regards.

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2014

    @mhedges said:
    Rotate to Angle behaviour gives you control of angle, but not direction.

    This means that when I am hitting the Action button the second time, to go back to angle 120, the actor does it, but clockwise instead of counterclockwise.

    Not 100% why your system doesn't work, I tried a similar thing and it works fine for me ?

    Example: (click on the actor to activate)
    :

    https://www.mediafire.com/?kme8ai67vwakcqk

    . . . . . . . .

    You could also use Interpolate, the same set up as your method, but it allows you to control the feel of the movement, so you can dampen the movement at the start/end/both.

    Example: (click on the actor to activate)

    https://www.mediafire.com/?abilee00dg8w4kx

    . . . . . . . .

    Alternatively you can use a little trigonometry to rotate the gate, this has the advantage of being able to rotate the gate from a point other than the actor's centre (as with the standard rotate tools).

    Example: (click on the actor to activate)

    https://www.mediafire.com/?04c8ydbrp1fpcyd

    . . . . . . . .

  • mhedgesmhedges Raised on VCS Member Posts: 634

    Thanks, @Socks . Your first example is the simplest, but it doesn't pivot on the offset end, a la third one. The second one (and by proxy the third) feels very cool - think "platform game" smoothness using interpolate.

    I'll compare my code to yours - there may be something in my offset affecting the direction, since otherwise example #1 looks very much alike.

    Kind regards.

Sign In or Register to comment.