• 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 LaughingTarget · Nov 18, 2013 at 10:31 AM · camera2dorthographicfrustum

Why is part of object outside camera frustum visible?

Hi,

I'm making a 2D game with an Orthographic camera, so my view frustum is a cuboid. I have a really long cube GameObject (moving platform), which is much wider than the view frustum, traveling in the +x direction across the view frustum from the left to the right. I expect that only the part of the GameObject which is inside the camera's view frustum will ever be visible. The frustum has a background applied on the far plane.

My Game window is sized to fit the camera's view frustum exactly, so things look alright when I preview the game in the Game window. I ran my game on an actual device (phone) in landscape mode where the screen is a lot wider than the view frustum's width, which causes blue bands on either side of my view frustum. But annoyingly, parts of the moving platform GameObject that are outside the frustum are also visible.

I don't understand what I'm doing wrong. Am wrong in expecting that the part of the object that's outside of the view frustum will not be visible? Or did my view frustum change in width when the game was run on the device because the device screen was a lot wider?

Thanks in advance for your help!

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

1 Reply

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

Answer by GameVortex · Nov 18, 2013 at 10:55 AM

An orthographic camera will use the same aspect ratio as the current resolution of the device or screen or window it is displayed on uses. So as you found out, on a wider mobile phone it will have a larger width than that on your developer machines screen, and therefore your object is visible "outside" of your original frustum.

The way around this issue is to have your game support the widest possible aspect ratio available on the platform(s) you intend to deploy your game on. In your case that would be to extend the background more in width to fill up the entire screen and make the game okay with the object being visible for longer.

Another option would be to put a pair of black planes on either side of your cameras original view frustum so nothing will be visible there if the aspect would change on another device.

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 LaughingTarget · Nov 18, 2013 at 03:17 PM 0
Share

Thanks, the "black plane on either side" approach makes more sense for my game.

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

18 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

Related Questions

Making a camera semi-orthographic 2 Answers

Orthographic camera movement clamping 1 Answer

parallax scrolling using orthographic camera 1 Answer

Dynamic Orthagraphic Camera Zoom 1 Answer

Resizing orthographic camera to fit 2d sprite on screen 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