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
2
Question by littlelingo · Dec 25, 2009 at 01:45 AM · cameraboundsorthographic

How do I keep an Ortho camera in a specific range when the ortho changes?

I have an Othrographic camera which is set to something like 260. As the user gestures ( this is on the iPhone ) the ortho size of the camera changes to provide a zoom in/zoom out affect. Not only can the user zoom in and out but they can also move the camera around ( like when zoomed in for instance ). What I am trying to do is not all the camera to move when at the max ortho ( 260 ) but as they zoom in, the user can move the camera but only within the bounds of the world provided.

In thinking about this, I really couldn't come up with a way seeing how the rect of the camera is always 0,0,1,1.

I am hoping someone can provide some insight! Thanks in advance.

Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Ashkan_gc · Dec 25, 2009 at 11:36 AM

you can use normal cameras and move them to zoom in and out. if you want to have something always in your view, you can use the OnBecameInvisible function and move back the camera to it's previous position. but if you want to have some points always in view you can check their screen space position.

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 littlelingo · Dec 26, 2009 at 03:15 PM 0
Share

Ortho is being used to give the look desired to render the view (more 2D using 3D elements).

avatar image
1

Answer by yo.ian.g · Dec 28, 2009 at 03:40 AM

Similar to what Ashkan suggested you can use Camera.ScreenToWorldPoint to test that your screen corners would be within your viewable world space when the user attempts to move the camera.

This means you have to somehow define the bounds of your world, whether by finding the min and max location of all objects in your scene or by manually storing them.

Personally I would manually create an invisible box in each scene that encompasses the viewable world space and test against it.

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 littlelingo · Dec 29, 2009 at 02:39 AM 0
Share

Thanks! I went with what you both suggested and switched the camera from Ortho.

avatar image
0

Answer by pkamat · Dec 25, 2009 at 10:23 AM

Can you give more info on how the camera movement is (FPS, Free form, etc)? I assume you want the camera to always look at the center of the world and when the user moves left of right the camera would rotate around the world y-axis. is that rite?

Also you dont need to change the Ortho size to zoom in and out..

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 littlelingo · Dec 26, 2009 at 03:13 PM 0
Share

It is free form where the player is watching the events going on (sort of like a simulation) versus any direct interaction. The camera does not always look at the center of the world and does not focus on any single item in the world. There is no turning of the camera. The Ortho is being used to give a 2d effect. when they zoom in they see what is in their view and can move the camera around to see other parts of the map.

Thanks.

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

No one has followed this question yet.

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Keeping the camera in bounds 1 Answer

Backgrounds moving at different speeds? 1 Answer

Fitting Bounds into Orthographic 2d Camera. 2 Answers

Pan Orthographic Camera? 2 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