1. We've introduced thread tags, search within a thread and similar thread search. Read more here.
    Dismiss Notice
  2. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    Dismiss Notice
  3. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  4. We've released our first Timeline Experimental Preview, our new tool for creating cutscenes and more! To check it out click here.
    Dismiss Notice
  5. Unity 5.5 is now released.
    Dismiss Notice
  6. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  7. Unity 5.6 beta is now available for download.
    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:
    30,965
    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,524
    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,595
    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,524
    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!