Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

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.