Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by SquigglyFrog · Dec 27, 2015 at 02:28 AM · zoomorthographic cameraboundary

Math help dealing with orthographic camera bounds and pinch zoom

The math is making my head hurt tonight. Ortho camera, defaulting to a 3.84 size. I have pinch and zoom and boundaries set already. When the camera zooms in, the ortho size can go down to 1.5. Now my x boundary on the right for example is normally 0.35f.. thats as far over as I want it to move. When it's zoomed in, the right boundary becomes 4.5. But how on earth can I convert that 0.35 to 4.5, or some fraction of when the camera is zoomed? the numbers are just eluding me.

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 Firedan1176 · Dec 27, 2015 at 03:13 AM 0
Share

I'm confused, can you draw me a pretty picture in paint? Thanks.

avatar image SquigglyFrog Firedan1176 · Dec 27, 2015 at 03:30 AM 0
Share

Lol.. not even sure how to do a pic on that.. camera $$anonymous$$AX x should be 0.35 when zoomed OUT.. thats an ortho size 3.84.. so you zoom in, ortho size shrinks to say 1.5.. which means my new max X bound would be 4.5 for the same spot. Not sure if that helps, so as the ortho size decreases, how do i change my 0.35 to the appropriate value.. basically when zoomed in, the camera needs to move further to get to that right edge.. but thats the part i cant figure out. i know the beginning and end, but how do i dynamically calculate that..

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by SquigglyFrog · Dec 27, 2015 at 03:40 AM

Actually, i think my brain just kicked into gear.. if I use this

 float maxX = (origCamScale - cam.orthographicSize) * 2;
 camPos.x = Mathf.Clamp(camPos.x, -maxX, maxX);

voilà!

That works and I dont need to worry about the 0.35.. nevermind.. staring at it for hours probably killed me..

Comment
Add comment · Show 1 · 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 manipalsingh · Jun 29, 2016 at 01:06 PM 0
Share

hey, I'm also having the same problem. Can you help me with it. What is origCamScale here? Like yours my head is also getting hurt thinking about his problem.

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

33 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 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

How to zoom out orthographic camera so that the parts that aren't UI blocked remain the same. 1 Answer

lock camera boundaries when pinch-zoomed 0 Answers

Camera zoom 0 Answers

How is it possible to make the position of an UI-Button static 0 Answers

Clamping when Zoom changes? 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