Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Mr_Cad · Feb 24, 2014 at 03:53 PM · 2dzoom2dtoolkitpinch

What's the best way to do pinch zoom?

Currently I'm using 2dtoolkit for my project and I wanted to implement pinch zoom.

My initial idea is to have a RootNode, then set everything other sprites under this RootNode, so that when I do pinch zoom I just need to scale the RootNode accordingly.

But later on I realised, most of the tutorials/suggestions I found online are modifying the camera instead of scaling. I wanted to ask which is the better way to implement pinch zoom?

If I use camera to do zooming, what about those UI objects? Since camera will just zoom everything on the scene, how can I set it to make sure zoom the game objects only but not UI objects? How should I setup a second camera to handle this?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Kiloblargh · Feb 24, 2014 at 04:58 PM 0
Share

Assu$$anonymous$$g you've already realized how much OnGUI sucks and are using ordinary GameObjects for your UI- you shouldn't be rendering them with the same camera you use for your scene anyway. You want an orthographic camera that only renders the "GUIStuff" layer that is a higher layer than all the others set to clear Depth Only, and your main camera that renders everything but the "GUIStuff" layer on a lower layer.

avatar image Mr_Cad · Feb 25, 2014 at 01:16 AM 0
Share

I try to add a second camera but when I run, it only show one camera, how can I make it to have both camera rendered on the same scene? is there any tutorials about this?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Owen-Reynolds · Feb 24, 2014 at 04:44 PM

Growing the scene won't work well with physics (gravity and speeds will be wrong,) particle systems (they ignore local scale) and Terrain (same.) Probably some more stuff (like non-physics movement code.)

If the UI is using Unity GUI elements, moving the camera for a 3D zoom will have no effect ((0, 0.5) is always center left-side.) And, if you have to, a 2nd camera is cheap (it's hard not to think about how expensive a real 2nd camera is. But a computer camera is only a handful of variables.)

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Mr_Cad · Feb 25, 2014 at 01:17 AM 0
Share

So do you mean even for screen panning, I should be moving the camera ins$$anonymous$$d of the game objects?

avatar image Owen-Reynolds · Feb 25, 2014 at 02:37 PM 0
Share

Well, physics and Terrain don't care if you move them. But particle systems could still break. Setting to local space make particles move when the emitter moves. But it you have a moving one (like a ball trailing smoke,) don't think there's a good way to move them all together (if you check LocalSpace, the smoke sticks to the ball as it moves.)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Keeping 2D orthographic camera with zoom in level boundaries 0 Answers

Hello I'm trying to write a C# about "Pinch to zoom" but it doesn't work 1 Answer

2D Animation does not start 1 Answer

Zoom to center of Pinch Gesture 1 Answer

[UI] proper way to add pinch zoom only to one UI element on the screen? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges