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
0
Question by JasonBricco · May 31, 2014 at 06:58 PM · physicstriggerefficiencybox collidercalculations

Box Collider (Trigger) Efficiency Question

Hey all,

I have a question about the efficiency of trigger box colliders. And more specifically, I don't want an answer such as: 'it's quite efficient'. I'd like to know roughly how many calculations have to be done and how often - and if you don't know exactly, then a good estimate works for me.

So, say I have one box collider (a trigger) set around the world in various places. And say I set it to collide with ONLY the player, and nothing else using the collision matrix.

Also, let's say it's not static because I don't think static will work for what I need.

How many calculations are happening? Is it doing constant per-frame calculations to try to detect a collision? I imagine it has to do calculations rather frequently (every 'physics time step' perhaps?) so that it can know when there's a collision.

And how computationally expensive is such a calculation? Any other calculations that happen?

Finally, are any of these calculations happening on a thread that isn't the main thread, or on the main thread?

Note: I'm not talking about calculations that happen when an actual collision occurs. I'm only talking about calculations assuming the player isn't colliding with them and they're just in the world near the player.

Thanks in advance if you can help.

Comment
Add comment · Show 11
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 getyour411 · May 31, 2014 at 07:06 PM 0
Share

constant per frame calcs, impossible to say how many calcs are happening totally dependent on your game, but assume it is "a bunch", individually they aren't t0o expensive but as a whole the physics stuff can be 20-30% or more of profiler-reported game thread time; physics on their own thread; any other calculations that happen - yes, a ton hard to quantify dependent on your game.

Once your game is out of design and you have some solid code base, consider using your Unity 30 days pro trial to make use of the Unity profiler to get a real view of your game and where its spending its time.

avatar image JasonBricco · May 31, 2014 at 07:08 PM 0
Share

I guess I should have rephrased it. I'm mainly thinking about just one collider. How does it depend on my game? If I have one trigger collider that isn't colliding with the player, how much work is it doing? I'm not sure what other factors would influence this.

Yes, I have pro and I can use the profiler, but I'm looking for details here on a level the profiler probably wouldn't be able to help me with (or because it would require me to do a bunch of work that I shouldn't have to do if I can get an answer here), so I can make a proper decision with what I'm about to do.

avatar image getyour411 · May 31, 2014 at 07:13 PM 0
Share

Your question speaks in plurals (colliders, triggers, around the world in various places, etc) but your follow-up says ONE collider. Well those are the things that make physics performance dependent on the game (i.e. how many).

If you have Pro and the profiler, I'm really lost.

avatar image JasonBricco · May 31, 2014 at 07:21 PM 0
Share

Hence the 'guess I should have rephrased' part. Okay, I edited the post to make that more clear.

The thing is, I have two choices going forward. I can use trigger colliders to do what I want to do or I can use another method. I'm not sure which one is going to hurt the FPS the most.

Both will take a good amount of time to do, so I figured I would come here and ask about the calculations involved with colliders. Having this information would tell me which one would perform the worse.

Using the profiler would require I go through and make both and compare them, which is a lot of work when I could just ask this question.

Probably could have done it by now! But I've been busy doing course work, anyway.

avatar image getyour411 · May 31, 2014 at 09:57 PM 0
Share

http://c2.com/cgi/wiki?PrematureOptimization

Show more comments

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

20 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

Related Questions

Is there a way to deny an exit (and therefore OnTriggerExit) 2 Answers

How to enable the box collider tick box on a trigger event 2 Answers

Collider/trigger collision causing physics glitch 0 Answers

overlapsphere to destroy NPCs on exit 1 Answer

Collider Lifts me off Ground ??? And I'm afraid of heights !!! 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