public void Raycast(Vector3 origin, Vector3 direction, AscensionPhysicsHits hits)
        {
            if (!body)
            {
                return;
            }

            float distance = float.NegativeInfinity;

            if (body.proximity)
            {
                if (body.proximity.Raycast(ref wtl, origin, direction, out distance))
                {
                    hits.AddHit(body, body.proximity, distance);
                }
                else
                {
                    return;
                }
            }

            for (int i = 0; i < body.hitboxes.Length; ++i)
            {
                AscensionHitbox hitbox = body.hitboxes[i];

                if (hitbox.Raycast(ref hbwtl[i], origin, direction, out distance))
                {
                    hits.AddHit(body, hitbox, distance);
                }
            }
        }
        public void OverlapSphere(Vector3 center, float radius, AscensionPhysicsHits hits)
        {
            if (!body)
            {
                return;
            }

            if (body.proximity)
            {
                if (body.proximity.OverlapSphere(ref wtl, center, radius))
                {
                    hits.AddHit(body, body.proximity, (center - ltw.MultiplyPoint(Vector3.zero)).magnitude);
                }
                else
                {
                    return;
                }
            }

            for (int i = 0; i < body.hitboxes.Length; ++i)
            {
                AscensionHitbox hitbox = body.hitboxes[i];

                if (hitbox.OverlapSphere(ref hbwtl[i], center, radius))
                {
                    hits.AddHit(body, hitbox, (center - hbltw[i].MultiplyPoint(Vector3.zero)).magnitude);
                }
            }
        }
Ejemplo n.º 3
0
        private static AscensionPhysicsHits OverlapSphere(Vector3 origin, float radius, AscensionHitboxWorldSnapshot sn)
        {
            Iterator <AscensionHitboxBodySnapshot> it = sn.bodySnapshots.GetIterator();
            AscensionPhysicsHits hits = AscensionPhysicsHits.Pool.Acquire();

            while (it.Next())
            {
                it.val.OverlapSphere(origin, radius, hits);
            }

            return(hits);
        }
Ejemplo n.º 4
0
        private static AscensionPhysicsHits Raycast(Ray ray, AscensionHitboxWorldSnapshot sn)
        {
            Iterator <AscensionHitboxBodySnapshot> it = sn.bodySnapshots.GetIterator();
            AscensionPhysicsHits hits = AscensionPhysicsHits.Pool.Acquire();

            while (it.Next())
            {
                it.val.Raycast(ray.origin, ray.direction, hits);
            }

            return(hits);
        }