Camera zooming and touch points

reddotincreddotinc Member Posts: 653
edited November -1 in Working with GS (Mac)
Hey guys,

I'm playing around with some zooming techniques at the moment (FMG's Camera Tricks - great work!) and come across a little issue where when I zoom my view out (to double the size to reveal the whole scene) the touch points for the actors (buttons etc) are scaled with the camera, but not the original actors.

So to explain better, If i have a button in the top right of my screen (normal view) then zoom out, the button remains in the centre of the screen (smaller) but the touch point is scaled to the top right of the screen (zoomed out).

Obviously this is because the touch is registered on the screen level, but the graphics aren't portrayed that way.

Does anyone know of a way to keep the touches relative to the actors (the images of said actors?) as the screen is zoomed?

Thanks for any help! :)

// red.

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I would also love to know if anyone has figured this out.
  • PhoticsPhotics Member Posts: 4,172
    OK, but it's crazy.

    Obviously the touch sensor is off when the screen is zoomed. So, you have to figure out the offset, based on the zoom, and then constrain an invisible actor to the offset. Then, change all your actors to respond to collisions to the invisible offset actor, rather than just a touch.
  • reddotincreddotinc Member Posts: 653
    Photics said:
    OK, but it's crazy.

    Obviously the touch sensor is off when the screen is zoomed. So, you have to figure out the offset, based on the zoom, and then constrain an invisible actor to the offset. Then, change all your actors to respond to collisions to the invisible offset actor, rather than just a touch.

    So that would be the offset of position x and y, and size width and height.. great.. lots of work to do then! :)

    // red.
  • ORBZORBZ Member Posts: 1,304
    It's not that hard:

    CameraOrigin.x + Touch.x * (CamSizeWidth / DisplayWidth)
  • ORBZORBZ Member Posts: 1,304
    Here's a tool to help you:

    http://gamesalad.com/game/play/79899
  • reddotincreddotinc Member Posts: 653
    ORBZ said:
    Here's a tool to help you:

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

    Cheerz Orbz! I'll check that out tonight.

    // red.
Sign In or Register to comment.