Check angle of player and fix

PimanPiman Member, PRO Posts: 165
How to check the angle of a player and make it rotate to desired angle (relative to scene) it's not upright (90 degr.)?

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    Double click the actor - in its attributes panel on the left change the 'Rotation' value to 0 (zero).
  • PimanPiman Member, PRO Posts: 165
    Eh? I mean a check in the game. As in, if the actor ends up at a wrong angle, to correct to to the desired one with a rule. :)
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Constrain Attribute self.Rotation to 45

    Something like that?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2013
    Eh? I mean a check in the game.
    You've given so little detail in your question you will have to forgive me for getting it wrong. 8-X
    As in, if the actor ends up at a wrong angle, to correct to to the desired one with a rule. :)
    To rotate an actor to an angle use the . . . . . drum roll . . . . 'rotate to' behaviour. :)
  • PimanPiman Member, PRO Posts: 165
    Forgive me, since it's trivial to rotate actors in the editor I assumed no one would think I was asking about that.

    I know about the "rotate to" behavior, but I only want to active this IF it's not at a particular angle. How do I make a check for that in an actor's rule.

    As in: If actor's angle is not X, THEN rotate to angle X.

  • PimanPiman Member, PRO Posts: 165
    @Tatiang I don't want to constrain it, since this actor sometimes rotates, and after that behavior it's easy to correct with "rotate to". Sometimes, for some mysterious reason, the angle changes without my meaning to.

    So I would like the actor to fix itself immediately should that happen.
  • PimanPiman Member, PRO Posts: 165
    Is the only way sending vectortoangle to a attribute and making a check for that? I just thought one could using something like self.angle in a rule.. but I can't find it.
  • PimanPiman Member, PRO Posts: 165
    Never mind, I figured it out. I didn't follow that "rotation" could be addressed in the actor itself. Working 24/7 for a week has taken its toll. Thanks.
  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2013
    Forgive me, since it's trivial to rotate actors in the editor I assumed no one would think I was asking about that.
    You'd be surprised.
    I know about the "rotate to" behavior, but I only want to active this IF it's not at a particular angle. How do I make a check for that in an actor's rule.

    As in: If actor's angle is not X, THEN rotate to angle X.

    Try this: If actor's angle is not X, THEN rotate to angle X.

    ;)

    image
  • SocksSocks London, UK.Member Posts: 12,822
    So I would like the actor to fix itself immediately should that happen.
    . . . . or if you want the change to be immediate:

    image
  • PimanPiman Member, PRO Posts: 165
    Yeah, thanks, I got it. Being tired I suddenly mistook "rotation" for motion, and thus was looking for the value elsewhere.
Sign In or Register to comment.