Pinch to zoom in and out in GS?

MLCinemaMLCinema Member Posts: 133
edited November -1 in Working with GS (Mac)
Hello All,

Does GS support pinch to zoom in and out? If so, any tutorials?

Thank you.

Comments

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    yeah, I guess it would be possible, but would take an awful lot of trial and error to get it working.

    Theres some steps on how to zoom the camera in the Unofficial GameSalad Textbook, which is worth buying if you can as it will teach you so much, and its well written....

    (edit: its not how to pinch to zoom, but simply how you can zoom the camera even though its not built to do it).
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Like they said above, theres no simple behavior to do so, but it can be done. I imagine you would use touch 1, and touch 2, then when they overlap or collide (pinch together) change attribute camera till what you want. Im sure it takes more work then that, but that will kinda guide you in the right direction.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I have pinch zoom in a couple of my apps. Here's the basics.

    Create an actor
    Create self.TouchDistance1 (real), self.TouchDistance2 (real), self.ZoomedOut (boolean)
    Then drag it into the scene and unlock it.

    Rule- When touch is pressed
    ------Rule- When touch count = 2
    ---------Change Attribute Self.TouchDistance1 to magnitude( game.Touches.Touch 1.X - game.Touches.Touch 2.X , game.Touches.Touch 1.Y - game.Touches.Touch 2.Y )
    ---------Timer Every 0.1 seconds
    ------------Change Attribute self.TouchDistance2 to magnitude( game.Touches.Touch 1.X - game.Touches.Touch 2.X , game.Touches.Touch 1.Y - game.Touches.Touch 2.Y )
    -------Rule - When self.TouchDistance2 is > self.TouchDistance1*1.4
    ------------Change self.ZoomedOut to 0
    -------Rule - When self.TouchDistance2 is < self.TouchDistance*0.6
    ------------Change self.ZoomedOu to 1

    Rule - When self.ZoomedOut is true
    ----Interpolate camera width to ??? (something bigger than 480)
    ----Interpolate camera heigth to ??? (something bigger than 320 but make sure you proportions are correct)
    OTHERWISE
    ----Interpolate camera width to 480
    ----Interpolate camera heigth to 320
  • CapitalGamesCapitalGames Member Posts: 5
    Scitunes:

    I've tried out your method for pinch/zoom (great work by the way), but I've found that my UI elements also shrink/grow even though they are on a separate non-scrollable layer. Is there a way around this or does zooming the camera just affect all actors no matter what layer they are on?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    you could prob make some rule that adjusts the UI sizes based on the zoom level. prob actually pretty easy to change just setup a rule in your UI actors that when self.ZoomedOut is true actor change self.size.width = xxx and self.size.height = xxx then use your otherwise to go back. Sorry im not good at structuring it out all nice and pretty.
  • frariofrario Member Posts: 164
    I've put pinch, drag and zoom all together. And it looks just perfect on iphone 4. No camera work.

    See the other topic to download source and read explaination:
    http://gamesalad.com/forums/topic.php?id=14216
Sign In or Register to comment.