Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question MeshCollider.Create benchmarks

Discussion in 'Physics for ECS' started by andywatts, Jun 16, 2023.

  1. andywatts

    andywatts

    Joined:
    Sep 19, 2015
    Posts:
    107
    MeshCollider.Create is taking 25ms on 3500 vertices.
    Physics 1.0.10 with Burst enabled and safety checks off.

    Is this as fast as it gets? appreciate any optimization tips?

    Project and benchmark code here.

     
  2. n3b

    n3b

    Joined:
    Nov 16, 2014
    Posts:
    56
    If you intentionally build compound of quads instead of using MeshCollider directly, then at least you could spread quads creation over multiple threads by using IJobFor instead of IJob. After that the CompundCollider.Create has to be moved into a job too (I believe it's not bursted when used in the managed context), that depends on the first one, i.e. job2.Schedule(job1.ScheduleParallel(triangles.Length / 2, quadsBatch, default)).Complete().
     
  3. davidus2010

    davidus2010

    Joined:
    Dec 4, 2017
    Posts:
    72