Пример #1
0
 private void CheckRayList(Entity entity, int limit)
 {
     for (int i = 0; i < limit; i++)
     {
         var hitEntity = EntityController.GetEntity(MonoBehaviourToEntity.GetEntityId(_rayHits[i].collider));
         if (hitEntity == null || hitEntity == entity)
         {
             continue;
         }
         entity.Post(new CollisionEvent(entity, hitEntity, _rayHits[i].point, _rayHits[i].normal));
     }
 }
Пример #2
0
        void OnTriggerEnter(Collider other)
        {
            if (!enabled)
            {
                return;
            }
            var hitEntity = EntityController.GetEntity(MonoBehaviourToEntity.GetEntityId(other));
            var entity    = EntityController.GetEntity(EntityID);

            if (hitEntity == null || hitEntity == entity)
            {
                return;
            }
            if (!entity.Tags.Contain(EntityTags.CanUnityCollide) || !hitEntity.Tags.Contain(EntityTags.CanUnityCollide))
            {
                return;
            }
            var hitPnt = other.ClosestPointOnBounds(transform.position);

            entity.Post(new CollisionEvent(entity, hitEntity, hitPnt, (hitPnt - transform.position).normalized));
        }
Пример #3
0
        void OnCollisionEnter(Collision collision)
        {
            if (!enabled)
            {
                return;
            }
            var hitEntity = EntityController.GetEntity(MonoBehaviourToEntity.GetEntityId(collision.collider));
            var entity    = EntityController.GetEntity(EntityID);

            if (hitEntity == null || hitEntity == entity)
            {
                return;
            }
            if (!entity.Tags.Contain(EntityTags.CanUnityCollide) || !hitEntity.Tags.Contain(EntityTags.CanUnityCollide))
            {
                return;
            }
            var collisionPnt = collision.contacts[0];

            entity.Post(new CollisionEvent(entity, hitEntity, collisionPnt.point, collisionPnt.normal));
        }