Beispiel #1
0
        internal void Add(HitboxBody body, Hitbox hitbox, float distance)
        {
            if (hitsCount + 1 == hitsArray.Length)
            {
                Array.Resize(ref hitsArray, hitsArray.Length * 2);
            }

            hitsArray[hitsCount].body     = body;
            hitsArray[hitsCount].hitbox   = hitbox;
            hitsArray[hitsCount].distance = distance;
        }
        public void Raycast(RaycastHitsCollection hits, HitboxBody body, int box, ref Matrix4x4 wtl, ref Matrix4x4 ltw)
        {
            Hitbox hitbox = body.hitboxArray[box];

            if (hitbox.shape == HitboxShape.Sphere)
            {
            }
            else
            {
                Bounds b = new Bounds(hitbox.center, hitbox.size);
                float  d = 0f;

                if (b.IntersectRay(hits.ray, out d))
                {
                    hits.Add(body, hitbox, d);
                }
            }
        }