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 DevMerlin · May 02, 2014 at 12:58 AM · gameobjectcamera viewporthitbox

Is it possible to check what percentage of an object is visible in a camera's view?

I know it is fully possible to check if an object can be "Seen" or not by a camera. However, I'm curious about another part of the same question. Is it possible to check what percentage of a object is visible? Say, in a situation where the object itself is partially obscured and you need to be able to uncover it, but it only comes "loose" when it's mostly freed.

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 Maerig · May 02, 2014 at 02:09 AM 1
Share

I think Renderer.bounds and Camera.WorldToViewportPoint are a good start.

avatar image robertbu · May 02, 2014 at 03:15 AM 0
Share

Getting an accurate percentage would be difficult. If you also want to exclude any part of the object that is occluded by another object, it gets significantly more difficult. If you can live with some inaccuracy, and not worry about occluding objects, you could create a bounding rectangle in Viewport space and calculate what parts of that rectangle that are outside of a rectangle defined by the points (0,0) to (1,1). There is some code in the following answer you can build on. The conversion in the code are to screen space, so you would need to change them to viewport space and not clamp the values.

http://answers.unity3d.com/questions/691066/how-to-calculate-screen-area-coverage-of-a-3d-obje.html

0 Replies

· Add your reply
  • Sort: 

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

21 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

Related Questions

How to make gameobject follow mouse pointer that's on rotated orthographic camera? 0 Answers

Populate an array of GameObjects with collision? 1 Answer

using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers

Set Game Object Position to Sides of a Camera 1 Answer

Change width and height of camera independently of each other,Change height and width of camera without changing size of display 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