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 horus developer02 · Mar 12, 2014 at 01:09 PM · collisionphysicsinstantiatecolliderphysx

PhysX and multiple instances at same location

I have a code that is instantiating around 1000 objects at the same location using a coroutine. The problem is that all those objects have a box collider with "isTrigger=true" and a kinematic rigidbody attached to them and because of that they are triggering this error:

"Too many pairs created, new pairs will be ignored. This is perhaps due to an excessive number of objects created at one location."

Also, the game becomes slow while the objects are colliding with each other but as soon as they move and stop colliding with each other, it starts running smoothly.

I tried to setup the Layer-Based Collision Detection of Physics in order to ignore the collision of all these objects between themselves but the error still appears.

So what can I do in order to have multiple instances of those objects at the same location and also check for collisions only with another 2 object layers?

EDIT

I forgot to mention that I need it to work smothly on Android and iOS with a maximum of 500 objects at the same initial location (because after they move out of collision with themselves, they already move smoothly)

EDIT 2

It works fine with +/- 500 objects on editor but on Android it doesn't work well. On editor, if I try to create 1000 objects then I get +/- the same frame rate as in Android.

EDIT 3

As asked, I created a simple example project that shows what's happening. Just open it, hit play and se what happens when the cubes appear and start to move.

Example Project

new unity project 2.zip (145.5 kB)
Comment
Add comment · Show 5
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 stevethorne · Mar 12, 2014 at 01:11 PM 0
Share

Assu$$anonymous$$g you set up your layer collision matrix correctly it should work fine. Are you using 2d or 3d colliders?

avatar image horus developer02 · Mar 12, 2014 at 02:32 PM 0
Share

3d colliders

avatar image horus developer02 · Mar 12, 2014 at 02:34 PM 0
Share

I have my layer collision matrix like this:

alt text

screen shot 2014-03-12 at 2.32.31 pm.png (13.0 kB)
avatar image Jamora · Mar 12, 2014 at 03:18 PM 0
Share

Have you considered using a ParticleSystem?

avatar image horus developer02 · Mar 12, 2014 at 03:22 PM 0
Share

Aren't particles too expensive for mobile? Also, my objects start all at the same location but then they end all on different locations.

1 Reply

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

Answer by Xtro · Mar 12, 2014 at 02:40 PM

Try adding rigidbody to them and set the isKinematic = true.

The colliders without rigidbodies are considered as "static" colliders. If you move them, it reduces performance.

The colliders with rigidbodies are considered as "dynamic" colliders. Moving them doesn't cost as much as it costs for static colliders.

Having too many dynamic colliders may have different side effect but still it's worth a try.

Please let me know about the results.

Comment
Add comment · Show 16 · 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 horus developer02 · Mar 12, 2014 at 02:47 PM 0
Share

Already tried that. The only way they run smoothly is when I disable the box collider or If I remove the rigidbody and disable the "isTrigger" but, I can't do any of those solutions because I need to check collisions with other 2 layers (Frag and $$anonymous$$ounter)

Here's a screenshot of the actual configuration of collider and rigidbody for the Split objects:

alt text

screen shot 2014-03-12 at 2.43.08 pm.png (25.7 kB)
avatar image Xtro · Mar 12, 2014 at 02:55 PM 0
Share

Is the transform scale of the objects uniform? Like (1,1,1) or (2,2,2) ?

I think it is a known issue that colliders have problems with non uniform transform scales.

I am very interested in the resolution of that kind of physics problems in Unity.

If you can create a very small example project having the same issue and send it to me, I would be happy to investigate it.

avatar image horus developer02 · Mar 12, 2014 at 03:02 PM 0
Share

It is not uniform. I will try to put it uniform and see what happens.

I can't replicate the project because it's a project from the company where I work and so, I can't add the original assets.

avatar image Xtro · Mar 12, 2014 at 03:04 PM 0
Share

I don't want you to add the assets. It can be very empty project with only having the object spawner script and the trigger objects which are causing the performance loss.

avatar image Xtro · Mar 28, 2014 at 06:28 PM 1
Share

Games are not actual simulations. You can fake some things. Since it's gonna be very fast, no body would notice it. Even if they notice they don't care because this is a game. Just create the items in random positions around the center of the missile.

Show more comments

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

22 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 avatar image

Related Questions

Excluding some physics collisions 3 Answers

Getting "Internal error: Too many pairs created" without any apparent reason 0 Answers

Physic based golf game - ball bouncing off the connection of colliders on flat surface 2 Answers

Disable/Enable Colliders 1 Answer

No Collision 3 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