Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by engi_valk1 · Mar 30, 2016 at 08:26 PM · c#collisionraycasttrigger

Is it possible to check how much a trigger is filled by %?

Is it possible in C# to check for a box collider turned into a trigger being a certain percent full and running code based on that being over a certain % (Say 85 or so)?

My original idea was either a lot of little triggers that would make up the 100% and each time one is triggered it increments a value and deactivates that trigger so it cant flood it. Once the incremented number hits 85 you know 85% of the triggers have been hit but this will drop the accuracy because it might not be 85% filled but 85 triggers are hit.

I also thought raycasting but not to sure on that. Any ideas from you guys and girls?

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
0

Answer by Bunny83 · Mar 31, 2016 at 11:22 AM

How do you define full? Geometry in the scene doesn't consist of volume. It's just a bunch of triangles. Only the surface of an object is defined. Colliders do represent some sort volume but the purpose of the physics system is to detect collisions / overlaps in order to create a penalty force to simulate physics. Triggers do the same but instead of calculating a force they just send a message when a collision happens.

Colliders can be quite complex. For example a MeshCollider can have a non regular shape where it's extremely difficult to calculate the volume / boundary. A similar problem happens with compound colliders. They can already intersect each other. Since in a compound collider multiple colliders are treated as one, how would you treat the overlapping volume inside the compound collider itself?

So the answer is no, Unity doesn't have something like that built-in. You would have to calculate that yourself. Even if you only use box colliders, calculating the shape of the overlapping volume can be very difficult if your colliders can be rotated. If all colliders are axis aligned it's way simpler.

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 engi_valk1 · Mar 31, 2016 at 04:35 PM 0
Share

All of them are axis aligned, no rotation of any object in the game world. Thanks for the response, do you believe my method of 100 triggers would be sufficient?

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to Find Owner of a Trigger? 1 Answer

Check for collision while animating 0 Answers

Animation with frozen player ?? 0 Answers

Align to grid in runtime problem 1 Answer

How to check if a raycast is not hitting any tagged colliders? 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