Actor rotate with accelerometer ?

JamieOneilJamieOneil Member Posts: 877
edited November -1 in Working with GS (Mac)
how can i make an actor rotate to the direction of the accelerometer?

thanks

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692
    Constrain self.Rotation to vectorToAngle(self.Motion.Linear Velocity.X,self.Motion.Linear Velocity.Y)

    Copy/Paste wont work so don't try and copy this into GS.

    Make sure your image faces right but don't worry too much as you can add a -90 at the end of the code outside the brackets if you have already made the image.

    Darren.
  • JamieOneilJamieOneil Member Posts: 877
    utopiangames said:
    Constrain self.Rotation to vectorToAngle(self.Motion.Linear Velocity.X,self.Motion.Linear Velocity.Y)

    Copy/Paste wont work so don't try and copy this into GS.

    Make sure your image faces right but don't worry too much as you can add a -90 at the end of the code outside the brackets if you have already made the image.

    Darren.

    Its a birds-eye view ? on top ?

    its a duck in a bath :L ?
  • UtopianGamesUtopianGames Member Posts: 5,692
    That will be fine :) pop in the code and let me know if you have any problems.

    Darren.
  • JamieOneilJamieOneil Member Posts: 877
    utopiangames said:
    That will be fine :) pop in the code and let me know if you have any problems.

    Darren.

    it seems to only be rotating it some directions ?
  • UtopianGamesUtopianGames Member Posts: 5,692
    Send me the file i will have a look at it for you.

    toyboxuk[AT]hotmail.com

    Darren.
  • JamieOneilJamieOneil Member Posts: 877
    utopiangames said:
    Send me the file i will have a look at it for you.

    toyboxuk[AT]hotmail.com

    Darren.

    hold on! not anymore :L its just doing the opposite because my accelerometer is the opposite way around because it wasnt working, how could i fix that ?
  • UtopianGamesUtopianGames Member Posts: 5,692
    I'm sure its because your image isn't facing right (Ducks head is on right ,tail on left)....rotate it in your art package then pop it back into GS.

    The code will rotate to the way it's moving so it doesn't matter how you have your tilt set up it should still work.

    Darren.
  • JamieOneilJamieOneil Member Posts: 877
    utopiangames said:
    I'm sure its because your image isn't facing right (Ducks head is on right ,tail on left)....rotate it in your art package then pop it back into GS.

    The code will rotate to the way it's moving so it doesn't matter how you have your tilt set up it should still work.

    Darren.

    ahh thats it now !
    thanks darren ! :)
  • UtopianGamesUtopianGames Member Posts: 5,692
    NP :)

    Darren.

    ___________________________________________________________________________________________

    GS Tools Website Come and see our collection of great GS Tools.
    Platform Template Our most popular template with over 100 sales.
    Mega Pack 31 Templates Amazing value with 32 fantastic templates.
    Shoot Em Up Template Over 30 moving enemies with 0 slow down.

    imageimage
Sign In or Register to comment.