Always point upwards?

I need some help to get a 2d arrow shaped actor to always point up, no matter how the iPhone is oriented. Thanks

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    There may be a way to do this by using the accelerometer values, but I haven't tried it.

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I played around with a right-facing arrow image and constrain attribute self.Rotation to game.Accelerometer.Y*(-90)+90 and it starts to approximate what you want if I hold the iPhone in landscape and then rotate it either way.

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

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

    You might want to try the vector to angle function:
    vectorToAngle(game.Accelerometer.X,game.Accelerometer.Y)

    That should give you which way is "down". (Find "up" by adding 180.)

Sign In or Register to comment.