playMaker

Author Topic: Find the difference - zoom in on two images  (Read 1136 times)

Maddy

  • Playmaker Newbie
  • *
  • Posts: 34
Find the difference - zoom in on two images
« on: May 06, 2019, 02:27:54 AM »
Hello all!

Brand new here and with playmaker. I'm working on a Find the difference game, and I really would like to have a zoom option. Either by pinch or a zoom button. I need for both images to zoom in simultaneously and both to pan in the same way. Can this be done with playmaker actions or do I need a plugin?

Thanks!
I'm an artist with poor memory and brain fog trying to make a game. Please wish me luck! :-D

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Find the difference - zoom in on two images
« Reply #1 on: May 06, 2019, 05:44:01 AM »
Hi.
Yes this can be done with playmaker.

for touch control you might be better of using an asset than the standard (unity) tho.

For zoom you can use 'Set Scale'

Have both images in a parent and make sure the images start with the same local position.

Then use Get Position and Set Position and use 'Space' Local.

It is best to get the X,Y,Z separately when dragging so that you can use some 'float clamps' on it.(to keep the image within the boundaries.)

Maddy

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Find the difference - zoom in on two images
« Reply #2 on: May 07, 2019, 08:33:40 AM »
@jaydino, thanks so much for your explanation. I sort of get what you're saying, I've only got to see if I can find all the different things/settings I'm going to use. I'm going to take a look around and see what I can find and put together.

When you say to put both images into a parent, would an empty Game Object do for that?

I still have so much to learn.
I'm an artist with poor memory and brain fog trying to make a game. Please wish me luck! :-D

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Find the difference - zoom in on two images
« Reply #3 on: May 07, 2019, 08:31:11 PM »
Yes, you’ll use empty game objects for all sorts of purposes, including as “containers” of sorts. The container or “higher” up in the hierarchy is called the parent, the ones below is the child(s). Each game object has a component on top of its list in the inspector (the details pane), that is called the transform, position, rotation and scale. The values there depend on its relation to its parent. That means, 0.5 on X means that the child is offset by 0.5 to the right. Or 0.5 scale on all three vectors means that the content is half the size. Such relative-to-its-parent values in transform are called “local” because when you change its parents, they will reflect the relative position to the new parent. Game Objects that have no parent (or the scene itself as the only parent) show their “absolute” values, which are called “world space” rather than “local space”. I recommend you doodle around with a bunch of game objects, change their transforms and parent them to see what happens.

This means for you. When your image has a parent, and are scaled, it will treat its 0/0/0 transform (i.e. it aligns with its parent) as its pivot point and also the point it scales towards. Now when you move the image to some other point being the centre, it will scale towards that point. Hence when both images have the same setup (parent-child) they should scale the same way towards each their zero point. To do this, find the gizmo of the parent and set an icon, so you see where that centre is.
« Last Edit: May 07, 2019, 08:35:36 PM by Thore »

Maddy

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Find the difference - zoom in on two images
« Reply #4 on: May 08, 2019, 04:44:11 AM »
@Thore Thank you so much for your in-depth explanation about parents-children in Unity, there were a few things there that I've forgotten about or didn't think about. I haven't worked with empty game objects before so was a little unsure about that, good to know that I can use it like that.

Thanks again!
I'm an artist with poor memory and brain fog trying to make a game. Please wish me luck! :-D