Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Teddy_p · May 15, 2014 at 10:55 PM · collisionrigidbodyraycastperformancecapsulecast

Why is CapsuleCast/Raycast performance effected by rigidbody?

I am doing some big number testing for collision detection with a MMO authoritative simulation server, and am curious as to why I am getting the results I am getting.

Basically I am running a test where I do 100000 capsule casts (which would be a weapon swing) in a scene with 3000 capsule colliders (simulating the hitboxes of the players) When the colliders do not have rigid bodies attached, unity executes it in approx .35 seconds.

When the colliders HAVE rigid bodies, it takes nearly 8 seconds... a huge difference. I have the rigid bodies set as kinematic, and am just really confused as to WHY this is the case considering CapsuleCast(), i believe, doesn't take rigid bodies into account and definitely works fine without them in the scene.

The same is true for raycasting without RigidBodies, RayCastAll() takes .12 seconds, and with them it takes 1.5 seconds to execute.

(just as a disclaimer before someone says it, this is not due to rigid bodies simply being in the scene either, because if I don't do any sort of casting then it takes .02 seconds to play the scene)

Thanks so much for the help!
Richard

--As a follow up, it doesn't effect performance if the rigid body is only in the root of the object, or on ALL the child components (legs, head, torso, etc)... both yield the same execution time. If there is any rigid body attached to the colliders, performance goes down by 1000%... lol, 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
0

Answer by MakeCodeNow · May 15, 2014 at 11:10 PM

You'd have to ask a PhysX or Unity developer to get the real answer, but I'd bet that internally the capsule is converted into a planar convex shape when the RB is added (i.e. "triangulated" into a simpler planar approximation). Some physics engines do that because it's faster or more stable for the RB dynamics, but could definitely be slower for ray and capsule casts.

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 Teddy_p · May 16, 2014 at 01:30 AM 0
Share

isn't a capsule already convex? And how would that effect the cast time?

avatar image MakeCodeNow · May 16, 2014 at 08:50 PM 0
Share

A capsule is convex, but they may "triangulate it" so that it's a collection of planes that are an approximation of the original capsule. I've edited my answer to be more clear.

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

21 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

Related Questions

Possible to Give Rigid bodies collision bounding boxes? 0 Answers

Capsule Cast Direction Help 1 Answer

RigidBody stuck on wall when jumped against 7 Answers

rigidbody simulation collision check frequency check control?? 0 Answers

Raycast doesnt detect object in front of rigidbody (player is stuck on wall) 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