Search Unity

Resolved Is "PhysicsCollider" of "Null BlobAssetReference" still supported?

Discussion in 'Physics for ECS' started by BobFlame, Jan 29, 2021.

  1. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    95
    In documents, syas it is possible to create a Collider which has a null BlobAssetReference. However in current physics 6.0, there is an error occurred at
    if (collider.Value.Value.Type == ColliderType.Compound)
    of method
    CheckColliderFilterIntegrity(NativeArray<PhysicsCollider> colliders)
    in system
    ExportPhysicsWorld
    .
    My Code is
    Code (CSharp):
    1.  
    2.             Entities.WithBurst().WithAll<TopologyComp>().WithNone<PhysicsCollider>().ForEach((Entity topoEntity) => {
    3.                 ecb.AddComponent(topoEntity, new PhysicsCollider { Value = BlobAssetReference<Collider>.Null });
    4.                 ecb.AddComponent(topoEntity, new PhysicsVelocity { });
    5.                 ecb.AddComponent(topoEntity, PhysicsMass.CreateKinematic(MassProperties.UnitSphere));
    6.                 ecb.AddComponent(topoEntity, new PhysicsDamping { Angular = .05f, Linear = .01f });
    7.             }).Schedule();
    So, what's wrong with my code, or the null blobassetreference is no longer supported?
     
    Egad_McDad likes this.
  2. milos85miki

    milos85miki

    Joined:
    Nov 29, 2019
    Posts:
    197
    Hi @BobFlame , thank you for reporting this! Sorry for the inconvenience, that's a bug and we'll fix it.

    In the meantime, you can make UnityPhysics a local package (see the thread about that) and change the condition to be:
    if (collider.IsValid && collider.Value.Value.Type == ColliderType.Compound)
     
  3. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    95
    Thx
     
  4. vildauget

    vildauget

    Joined:
    Mar 10, 2014
    Posts:
    121
    Thank you for the work around. We still have to do this for new projects, any update for the physics package any time soon?
     
  5. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    95
    Hi,original post‘s problem is due to making compounding collider with some child collider is null, while it is not stated as valid from unity doc. What is valid is using physicscollider with null value. So what problem have you encountered?
     
  6. vildauget

    vildauget

    Joined:
    Mar 10, 2014
    Posts:
    121
    Thank you for coming back to the thread, BobFlame.

    I make an archetype with an empty physicscollider:

    Code (CSharp):
    1.         public static EntityArchetype playerArchetype = manager.CreateArchetype(
    2.             typeof(RenderMesh), typeof(LocalToWorld), typeof(Translation), typeof(Rotation), typeof(PhysicsCollider),
    3.             typeof(PerInstanceCullingTag), typeof(WorldToLocal_Tag), typeof(Player) );
    4.  
     
  7. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    95
    Sorry I don't use archetype much, I don't get which value is null. You are creating an archetype with a group of types, no instance value is involved.