Actor angle as it relates to another actor's angle

KangavarkKangavark Member Posts: 62
edited August 2012 in Working with GS (Mac)
I have two rotating actors in a scene. When one is pressed, it freezes into position. Same for the other one. If they are both frozen in the same exact position (rotation angle, etc) I'd like to trigger a new scene or animation. How can I set up a Rule so that something happens if they both are frozen in the same position???

Ideally, it would be something like:
If self.angular velocity = otherActor.angular velocity; Change Image, Change Attribute

any tips?
thanks in advance

Comments

  • BarrytheBraveBarrytheBrave Member Posts: 134
    edited August 2012
    Hey, it won't be angular velocity, as this measures the speed of rotation. You would want to track each actors self.rotation. Perhaps have two game angle attributes called rotation1 and rotation2.

    When you press actor 1:

    change attribute self.angular velocity to 0
    change attribute game.rotation1 to self.rotation

    When you press actor 2:

    change attribute self.angular velocity to 0
    change attribute game.rotation2 to self.rotation


    Then elsewhere have a rule that says when game.rotation1= game.rotation2, perform action.

    However note that rotation is not just measured in 1 degree increments, you can have decimals too, (180.4 degrees etc), so it would be pretty tricky for the user to stop both with exactly the same rotation as each other.

    So you may want to give them some room for error, for example instead of saying:

    if game.rotation1 = game.rotation2, (requiring exactly the same rotation)

    you could say:

    if game.rotation1 (is smaller than) game.rotation2+1 and game.rotation1 (is bigger than) game.rotation2-1

    Perform action, as this will give you a margin for error.

    Hope that makes sense.
  • KangavarkKangavark Member Posts: 62
    thanks ooi, I'll give this a try!
Sign In or Register to comment.