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 hexdump · Dec 17, 2012 at 03:55 PM · androidphysicsmobileiphonephysx

Help improving performance with 40-80 rigid bodies.

Hi,

I'm creating a game where I need physical interaction between tens of objects, I think the average will be around 50. Is this possible to accomplish with v6 devices on android? My coliders should be cylinders but we all know unity (physx) doesn't provide such primitive, so, I would use a mesh collider. Every mesh collider should be a cylinder of 12 sides. I have seen other games on the store (not unity) that do this and they work nicely. Has anybody tried to accomplish something like this with success on unity?

P.D. I have done some tests with 80 objects with a mesh collider created from a unity3d cyllinder and it really lags. Could anyone give any insights please?

P.D. More data, I have just left 40 objects with just box colliders and still lags a lot. Don't really know how I could get this better. On the other hand I have lowered the physics iteration to 3 too.

Thanks in advance.

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 Fattie · Dec 17, 2012 at 06:01 PM 0
Share

FYI there have already been some huge discussions about this. $$anonymous$$gest you use search here on "coindozer"

http://answers.unity3d.com/questions/318841/what-approach-would-you-recommend-for-a-coindozer.html

avatar image hexdump · Dec 18, 2012 at 07:11 AM 0
Share

Thanks fattie

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Karsnen_2 · Dec 17, 2012 at 04:27 PM

Well hexdump ->

First I would like to clarify whether you are using Mesh Colliders or Cylindrical Colliders.

  • Either way, I would suggest you to use box collider as they have less vertices comparatively.

  • Try to make most of the meshes 'static' if they are not moving during run time.

  • For rigidbodies, what matters more is - how often do you apply force or torque etc on a rigidbody?

  • Do all the 80 rigidbodies fill the screen on your small Android device? if so, you might have to explain a little bit more on what are you trying to accomplish.

  • Do all the rigid bodies have scripts attached on it? if so, do all the scripts have Update() or FixedUpdate() functions?

  • Final word -> Avoid mesh colliders on a mobile device.

Comment
Add comment · Show 3 · 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 hexdump · Dec 17, 2012 at 05:30 PM 0
Share

Hi!,

Thanks a lot for the insights. I'm trying to do something like this: http://www.hydom.cn/en/pages/1291017544109.html

Some answers to your questions:

1) I have used box colliders too (I did tests with that type of collider too). The device lagged a lot too.

2) I haven't tried to flag meshes as static, but it seems gfx is not limiting at this moment.

3) I do not apply forces because this game doesn't need that. Coins fall from the top and a wall moves back and forward making the coins fall from the bottom part of the screen.

4)No rigid body have scripts attached. I did just a fast test to check performance and I was really disappointed :(. 5) I would really like to do this, but I don't see how I could do this in this type of games. Perhaps I could use some type of collider combination to simulate the coin shape.

Thanks in advance.

avatar image Karsnen_2 · Dec 17, 2012 at 05:55 PM 0
Share

1 - Then you might have to consider the usage of rigid bodies on your game. Try to fake certain things. Just use rigid bodies for coins and colliders for coins. Nothing else. 2. $$anonymous$$eshes could be static only if there DO NOT move. So look into it. From what you say, I do not think coins could be static. 3. As coins just fall, then there is nothing you could do on that part in regard to optimization. 4. Hmmm things are not working in your way. 5. Okay. First try to be more conservative on your working model. If nothing works, will see to work with something else.

Try to upload a screenshot of your scene. I would like to see that. Buzz me at willow47 on "Unity3d" room at IRC. I am online right now.

avatar image Razzik · Oct 12, 2015 at 12:28 AM 0
Share

I know this post is really old

But $$anonymous$$arsnen_2, THAN$$anonymous$$ YOU.

I have been struggling with lag on a mobile device with Rigidbodies and I changed them all to Box Colliders and Voila, perfectly smooth.

SO HAPPY I COULD $$anonymous$$ISS YOU #NOHO$$anonymous$$O

:D

avatar image
0

Answer by Alec Thilenius · Dec 19, 2012 at 07:52 AM

Sphere collides are the fastest. Next up are box collides, and very last on the list are mesh collides. The game you liked is constrained to a 2D plane, this changes everything. If I were you I would just constrain all the ridged bodies to the X Z plane ( Un-check all the other options under ridged body including rotations ) and add a sphere collider to each. Do not have a collider for the table that they are moving across, just let the constrained ridged bodies make it look like they are on a table. Write a script that removes the ridged body restrains at the end of the table.

Comment
Add comment · Show 2 · 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 hexdump · Dec 19, 2012 at 09:35 AM 0
Share

Hi!

The game is not constraiend in any axis. Coins can move in any axis and rotate. If I use sphere colliders I wouldn't be able to have bodies on top of other bodies (coins on coins). On the other hand could you comment on your last sentence (The remove restrains one), don't really understand what you mean.

Thanks a lot for you suggestions and time. I really apreciate it.

avatar image Alec Thilenius · Dec 19, 2012 at 05:18 PM 0
Share

It looks like what Fattie posted is for you. Sounds like they are going with the same type of idea. There is simply no way to simulate a boat load of coins like that with PhysX and ridged bodies. Not on PC, and certainty not on mobile. Even if you did my guess would be that it would look very unnatural.

One way I see to do it (Still not sure if its fast enough for mobile) is to use sphere colliers only, and have a single layer of coins. The coins only need to be simulated in a single moment plane at the point, and physics gets turned back on when they reach the end of the ramp, so that they 'fall'.

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

13 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

Related Questions

Is PhysX being used on mobile 1 Answer

Unity Cloth on Mobile? 2 Answers

Mobile Device Video Camera 1 Answer

testing on an android device 1 Answer

Accelerometer - accounting for gravity for arbitrary device angle 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