1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

What is "Bake Scaled Mesh Physx Collision Data"?

Discussion in 'Editor & General Support' started by bibbinator, Oct 29, 2010.

  1. bibbinator

    bibbinator

    Unity Technologies

    Joined:
    Nov 20, 2009
    Posts:
    507
    Hi,
    Does anybody know what causes the "Bake Scaled Mesh Physx Collision Data" function to be called or where it's called from?
    Thanks!
     

    Attached Files:

  2. Vicenti

    Vicenti

    Joined:
    Feb 10, 2010
    Posts:
    664
    I have no experience with this myself but it looks like you have a mesh collider attached to an animated mesh, resulting in an animated mesh collider. Physx has to bake the collision data to make it efficient, but that has to be done every time the mesh changes.
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    31,136
    That's not possible since the skinned mesh data isn't readable back from the graphics card. Also it would be really slow even if it were possible, not just sorta slow. ;) It does involve a mesh collider though:

    You have an object with a mesh collider scaled at something other than <1, 1, 1>.

    --Eric
     
  4. Nima

    Nima

    Joined:
    May 2, 2011
    Posts:
    75
    I am seeing a similar problem (of CPU usage going over 50% on Mesh.Bake Scaled Mesh PhysX CollisionData).
    However, it only seems to happen when I try to deactivate a game object through GameObject.SetActiveRecursively(false) or GameObject.active = false;

    Also, is there a quick way to check for mesh colliders scaled at something other than <1,1,1> in a scene?
     
  5. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    18,975
    Is it static? moving a static marked collision mesh would cause physx to recalculate it every single frame (which should only be a precalculate step)
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,596
    also ensure to not move around mesh collider objects that aren't convex marked, as such mesh collider objects are not meant to move at all, the whole collision tree for object and world in that sector need to be updated all the time which is extremely cpu intense
     
    piliponful likes this.
  7. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    18,975
    Yeah if you do want to do that kind of stuff I think you might need to a) ensure it is NOT marked as static and b) ensure it is kinematic.
     
  8. Nima

    Nima

    Joined:
    May 2, 2011
    Posts:
    75
    I am still confused as to why it only happens when I try to deactivate a game object. If I comment out the line that deactivates the game objects, then this problem goes away...
     
  9. Nima

    Nima

    Joined:
    May 2, 2011
    Posts:
    75
    I think I found the problem, It's not just deactivating the game object with the mesh collider that causes the CPU usage spike, but deactivating then reactivating it causes the collider to re recalculated, hence causing the spike in CPU usage.
     
    Last edited: Jun 14, 2011
  10. piliponful

    piliponful

    Joined:
    Dec 6, 2016
    Posts:
    1
    Thank you very much. That was execly my problem!