Always point upwards?
jackwilliamziegler
Member Posts: 0
I need some help to get a 2d arrow shaped actor to always point up, no matter how the iPhone is oriented. Thanks
Comments
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
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
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.)