Camera Pinch Zoom IN Zoom OUT

carlos.varela.comcarlos.varela.com Member Posts: 99
edited November -1 in Working with GS (Mac)
I just did saw the camera zoom sample demo that use a "click" for Zoom IN.

http://gamesalad.com/forums/topic.php?id=6734#post-43835

But, have you any idea of implement this with multitouch like apple's pinch zoom effect?

I like so much the way like angry birds and other games use the "pinch" (Two fingers) effect.

I really does not have any idea of how to deal with multi-touch in gs, by other way the that I did saw like joystick sample demo, just track the touches on some areas, but in this case you to cover all the background of your camera view.

I am using the sample scroll demo on my game, but I need to extend the functionality to be able to zoom IN and OUT too, preferred using "pinch" effect, because is an standard procedure on this apple's devices.

http://gamesalad.com/game/play/51398

Any idea?

Comments

  • RHRH Member Posts: 1,079
    I'm sure you could.

    I guess you could use touch 1 and 2. Get their X and Y coordinates and and calculate the distance between them. If it is an increasing function then zoom in, if decreasing zoom out. Calculating the distance would be easy and i guess you could check whether it has increased or decreased every 0.1 seconds with a timer. There is a smoother way I'm sure, FMG had a thread a while ago about whether a scroll was clockwise or anti-clockwise and I'm sure the solution could be manipulated for this purpose.

    I'll check it out now if I can find it.
  • carlos.varela.comcarlos.varela.com Member Posts: 99
    thanks! I will continue trying too!
  • carlos.varela.comcarlos.varela.com Member Posts: 99
    can anybody help in that, please?
  • carlos.varela.comcarlos.varela.com Member Posts: 99
    ...
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Easy, you can zoom without the pinch too. I found a great way. Hold the iPod/iPhone at arms length, look at screen... bring iPod/iPhone closer to face. Works every time! Unless you don't have arms... :P
  • carlos.varela.comcarlos.varela.com Member Posts: 99
    Yeah man! its works! thanks for that! I know another way, put your device on the floor, sit some steps back, the as your tall, then let you get down 45 degrees without moving your legs in order to go your face directly to the device. Tips: do not use your hands, and constrain your body firm please.

    ; )P too
  • carlos.varela.comcarlos.varela.com Member Posts: 99
    ...
  • carlos.varela.comcarlos.varela.com Member Posts: 99
    ...
  • ZackGSZackGS Member Posts: 313
    An idea...

    Have two touches... touch1 and touch2

    You could place an actor at each touch position, so wherever you touch the screen the actors get placed there. Then constrain each actor to touch1 and touch2. Then check to see if the actors are being dragged towards each other and if so zoom in, if they are being dragged away from each other zoom out.

    I will do a sample later if i get time.
  • carlos.varela.comcarlos.varela.com Member Posts: 99
    Thanks!
    Please, can you take a look to this sample:
    http://gamesalad.com/game/play/51398

    I am using this code for my own scroll. I have been trying to adapt it in order to zoom in/out, but nothing yet : (
  • carlos.varela.comcarlos.varela.com Member Posts: 99
    ...
  • carlos.varela.comcarlos.varela.com Member Posts: 99
    ...
  • carlos.varela.comcarlos.varela.com Member Posts: 99
    ZZZZzzzzz ZZZZZzzzzzzzz ZZZZzzzzzzz
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Needed to figure this out so I made a demo. It may need some tweaking to get it to your liking, but feel free to use however you want.

    http://gamesalad.com/game/play/79393
  • FranzKellerFranzKeller Member Posts: 517
    There isn't currently anyway to test multitouch code without exporting to an dive, right?
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    right
Sign In or Register to comment.