• 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 Twanger · May 12, 2011 at 08:38 PM · camera2dscreenspace

Camera setup question

Hello.

I'm trying to set up Unity for 2D+ development similar to how I set up OpenGL -- ortho camera and planes/rects with textures. Sounds easy enough.

I need a solution w$$anonymous$$ch guarantees that a bitmap that's (for example) 30x60 in Photoshop shows up EXACTLY as 30x60 wit$$anonymous$$n Unity screen space. How do I compute Camera parameters to ensure that result? There's probably some known formulaic approach, but I'm not sure how to apply it to the given parameters.

The Camera parameters I can play with appear to be "Scale" (w$$anonymous$$ch I left at 1,1,1) and "Size" (w$$anonymous$$ch I don't understand and the documentation doesn't explain very much). Through trial & error (try a number, run program, screen capture, measure, repeat) I've arrived at a "magic" value of 30 w$$anonymous$$ch seems close to correct, but I'd much prefer a more definitive approach.

Thanks, BT

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Jeston · May 12, 2011 at 08:43 PM

  1. Orthograp$$anonymous$$c size = Screen.Height/2
  2. Set camera.position to 0,0,0 or if you don't want the item.position(0,0,0) to be the upper left, then offset the camera.position by ( -w/2, -h/2, )
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 Twanger · May 12, 2011 at 10:33 PM 0
Share

In my case that'd be 768/2 = 384. The number I've been using for Size is 30 and the larger Size gets, the smaller my object appears. Anything over around 150 and I can't see it at all.

Other parameters on my main camera are:

Position=Rotation=(0,0,0) Scale=(1,1,1) Clipping=1,1000 View Port Rect = XY(0,0), WH(1,1) Depth=-1

Parameters on my object are:

Position=(0,0,500) Rotation=(270,0,0) Scale=(1,1,1)

Thanks, BT

avatar image
0

Answer by Twanger · May 13, 2011 at 03:47 AM

Any other ideas?

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Polygons clipping at edge of screen 1 Answer

2D Game. Screen, Camera and coordinates. 0 Answers

How to letterbox the screen and have pixel perfection in a 2d game 0 Answers

Top-Down 2D game:How to make the camera move on hitting the sides of the screen? 2 Answers

Automatically adjusting the camera view 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