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 GeorgeRigato · Nov 25, 2012 at 07:19 PM · collisiontriggerpositionmobileperformance

Use trigger collision or position check?

The context is:

  • mobile and browser game (performance!);

  • 2.5D Top down perspective (camera sees Y-);

  • Movement from top to bottom part of the screen (the main character actually moves "bot-up");

I got this scenario elements moving at the background of the game. They're just planes with a texture. I removed the mesh collider from them. And they're created beyond top border of the screen and the camera movement makes them appear moving beyond the bottom border of the screen. No big deal until there.

When they reach a position beyond camera's field of view I wan to destroy or relocate them and I know how to do both. My question is about what would cost less in terms of processing to check if the scenario element has reached a position in relation of the camera's current position (over the Z+ axis BTW).

If I setup a object at that position to collide with the planes, and change the collision matrix to make the scenario elements just collide with this "game bottom border" would be a good solution? Or attach a simple script to each plane with a camera reference and each frame (or skipping one or two frames to save processing) check its relative position to the camera to know when destroy itself would be better thinking about the performance on mobile devices?

Thanks 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
1
Best Answer

Answer by Sisso · Nov 26, 2012 at 01:53 PM

The real answer you only know doing a performance test in a real device.

I think that both options are ok. Checking the object position relative to camera is one matrix multiplication. But collider could be optimized by the engine.

Personally I give a try in the first one.

Comment
Add comment · Show 4 · 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 GeorgeRigato · Nov 26, 2012 at 01:57 PM 0
Share

You're right about the tests, but the reason I asked was to save some work. And anyway I will only be able to do some testing in a week or so.

If the game runs on mobile, it will not take advantage over PhysiX, right?

avatar image Sisso · Nov 26, 2012 at 02:08 PM 0
Share

Yes and worse, aparently unity3d always cpu ( http://answers.unity3d.com/questions/209646/is-physx-being-used-on-mobile.html ). But physic is always very optimized, so, could be faster.

avatar image GeorgeRigato · Nov 26, 2012 at 03:34 PM 0
Share

So, under that light, the position check is simpler calculations than collision and therefore cheaper? $$anonymous$$ind that every scenario object must have one reference to the main camera using that approach.

avatar image Sisso · Nov 26, 2012 at 07:39 PM 1
Share

It is my opinion :P References will not be a problem if cached in Start().

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

11 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

Related Questions

Intersects() vs OnTriggerEnter2D performance 0 Answers

How to get the position of triggered object? 0 Answers

Get position of collision with triggers? 1 Answer

Colliders vs Callbacks: Which is better for performance in my case? 0 Answers

How to detect collision position and velocity? 2 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