Rotate character along with device.

How do you make an actor rotate along with the device so that it appears to not be rotating. Here is an image example of it.
image
Notice how the actor is always faceing the same direction no matter how the device is rotated. How would I achieve this effect?

Best Answer

  • SocksSocks London, UK.Posts: 12,822
    edited December 2012 Accepted Answer
    "You can't just choose accelerometer, you have to choose from the accelerometer submenu which is X, Y, and Z."

    I understand that, I am just responding to your question with the basic idea of how it is done, but if trying it out for yourself is too much bother let me do it for you (as you've been so charming) : ) . . . . . .

    (I will be back in 2 minutes with the answer).

    . . . . .


    Here you go:

    Constrain Attribute:
    self.Rotation
    game.Accelerometer.Y *90



    .

Answers

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2012
    Constrain the actor's rotation to the accelerometer.
  • phlamephlame Member Posts: 18
    To which accelerometer attribute? There is no rotation attribute for accelerometer.
  • SocksSocks London, UK.Member Posts: 12,822
    Constrain attribute > self rotation > devices / accelerometer.
  • phlamephlame Member Posts: 18
    You can't just choose accelerometer, you have to choose from the accelerometer submenu which is X, Y, and Z. Which one would I constrain from the 3?
  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2012
    D/P
  • phlamephlame Member Posts: 18
    I'm sorry, it wasn't my intention to sound rude or anything and the reason I don't try it is because I do not have my iPhone with me to test it out until saturday so I have no way to test it out since I can't test accelerometer on gamesalad. Thank you for your answer you've been very helpful.
  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2012
    I'm sorry, it wasn't my intention to sound rude
    No problem, I was only joking with you.

    : )

    The code (above) suffers from one problem, as the accelerometer is so sensitive the object you want to keep upright tends to jitter around a little (as it closely tracks every little tremble and shake your hands make).

    For a smoother motion (albeit less responsive) maybe also try using something like:

    Timer:
    Every 0.2 seconds
    Interpolate
    Interpolate attribute - self.rotation to game.Accelerometer.Y *90
    Duration 0.5
  • phlamephlame Member Posts: 18
    Thanks, I'll test those out when I can.
  • phlamephlame Member Posts: 18
    Unfortunately none of those worked. I need it to rotate completely with the device and with those solutions it only rotate a little bit. For my game it needs to be able to rotate all 360 degrees
  • SocksSocks London, UK.Member Posts: 12,822
    Unfortunately none of those worked. I need it to rotate completely with the device and with those solutions it only rotate a little bit. For my game it needs to be able to rotate all 360 degrees
    Oh well, such is life.
  • phlamephlame Member Posts: 18
    So I'm guessing that means it's not possible :(( well with GameSalad at least. O well, thanks for your help anyways, much appreciated.
  • SocksSocks London, UK.Member Posts: 12,822
    I'm guessing that means it's not possible
    Not at all, I'd guess it's perfectly possible, trivial even given the clues you've already been given.
  • phlamephlame Member Posts: 18
    Well I'll do a little testing on my own to see if I succeed, half the fun's the adventure right :)>-
  • phlamephlame Member Posts: 18
    I figured it out :D
  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2012
    //
Sign In or Register to comment.