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
1
Question by ham · Mar 29, 2013 at 11:17 AM · cameraorthographicaspectratio

camera width zoom

hi guys , beleave that its nearly two days that im searching but i cant find a solution for my problem , so please help me if you can ... im using an orthographic camera in a 2d side game , and i just want zoom in/out the camera in width not in height when i use this code

 thisTransform.camera.orthographicSize = Mathf.Lerp (thisTransform.camera.orthographicSize ,.007 + thisTransform.camera.orthographicSize, Time.time);
 

the camera zooms out in height too and some part of sky is shown , that i dont want , i just need show the more area of the earth , also when i use this code

 thisTransform.camera.rect = Rect (0, 0, 1, .5);    

the output comes out from full screen mode , so would anybody tell me that how can i modify the width ratio of the camera without modifying the height.. thanx alot , and alot more

Comment
Add comment · Show 4
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 aldonaletto · Mar 29, 2013 at 11:59 AM 0
Share

If you zoom out in width only while keeping the same camera rect, the image will get horizontally compressed: objects will appear thinner and taller than they actually are - is this what you're actually trying to do?

avatar image ham · Mar 29, 2013 at 12:19 PM 0
Share

no i dont want that , for example i just wanna show a wider range of the sea while the sky area is fix ,now the width and height of camera rect are equal and i wanna increase the width of the rectangle withought changing the height

avatar image ham · Mar 29, 2013 at 04:23 PM 0
Share

is there anybody in there ...? just nod if you can hear me....

avatar image MountDoomTeam · Mar 29, 2013 at 05:08 PM 0
Share

i dont know http://docs.unity3d.com/Documentation/ScriptReference/Camera-aspect.html

2 Replies

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

Answer by whydoidoit · Mar 29, 2013 at 05:21 PM

You cannot do that with an orthographic camera - you are actually setting the height and the width is calculated from the viewport size.

It sounds to me like what you need is two cameras - one to render the sky (with lower depth than the other one) and one to render everything else. Set the second camera to clear nothing.

Comment
Add comment · Show 3 · 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 whydoidoit · Mar 29, 2013 at 05:21 PM 0
Share

And clearly don't change the orthographic size of the sky camera...

avatar image ham · Mar 29, 2013 at 05:49 PM 0
Share

thanx its a very very good solution , and again tanx

avatar image whydoidoit · Mar 29, 2013 at 05:51 PM 0
Share

Could you tick it as correct?

avatar image
0

Answer by Elric · Mar 29, 2013 at 05:24 PM

Not sure, but if it in fullscreen mode try changing screen resolution aspect ratio by changing screen height or width - Screen.SetResolution (w, h, true);

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

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

14 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

Related Questions

2D Camera Question: Pixel Perfect W/O Cutting Bottom Edges 1 Answer

Orthographic camera movement clamping 1 Answer

scaling (Resizing) orthographic camera in 2D mode 3 Answers

How to make a smash bros-like camera 3 Answers

2D Camera size based on unit width 1 Answer


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