Search Unity

Resolved Entity Colliding with it's prefab?

Discussion in 'Physics for ECS' started by iJuan, Oct 11, 2020.

  1. iJuan

    iJuan

    Joined:
    Jan 13, 2017
    Posts:
    6
    I've a GameObject prefab with a RigidBody (without gravity) and a SphereCollider.

    On game start, I convert this prefab to an entity prefab, using
    Code (CSharp):
    1.  Entity entityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefab, conversionSettings);
    Where prefab is a GameObject.

    Noticed this adds an entity to the EntityDebuger, with a special component called Prefab.
    This special entity won't cause any system using
    Entities.ForEach
    to run, and won't be detected by custom entity queries (Or atleast that's my case).

    So, here's my problem, when I call
    EntityManager.Instantiate(entityPrefab)
    , the recently spawned entity gets a Linear Velocity of (0, 50, 0). After some debug noticed this only happens when I have my sphere collider enabled, also disabled all my systems to make sure they were not interfering.

    My guess is that the new entity is colliding with it's prefab, but this only happens to the new entity, the prefab itself stays fixed at it's original position and velocity.

    Is this a bug? Or did I get entity prefabs concept wrong?

    EDIT:
    I have placed wrongly prefab's origin, which resulted in it being spawned near a roof
     
    Last edited: Oct 12, 2020
    petarmHavok likes this.