예제 #1
0
        public override bool OverlapBox(Vector origin, Vector size, Number rotation)
        {
            if (this.rotation == Number.Zero && rotation == Number.Zero)
            {
                return(Number.Abs(position.x - origin.x) <= (this.size.x + size.x) &&
                       Number.Abs(position.y - origin.y) <= (this.size.y + size.y));
            }
            var rect1 = PhysicsUtils.GetRectangleVertices(position, this.size, this.rotation);
            var rect2 = PhysicsUtils.GetRectangleVertices(origin, size, rotation);

            return(PhysicsUtils.IsRectangleOverlap(rect1, rect2));
        }
예제 #2
0
        public int IntersectSegment(Vector start, Vector end, List <Vector> results)
        {
            var n       = 0;
            var corners = GetLocalCorners();

            for (int i = 0; i < corners.Length; i++)
            {
                Vector point = Vector.zero;
                if (PhysicsUtils.GetSegmentIntersection(
                        start,
                        end,
                        corners[i] + position,
                        corners[(i + 1) % corners.Length] + position,
                        ref point))
                {
                    results.Add(point);
                    n++;
                }
            }
            return(n);
        }
예제 #3
0
 public override bool OverlapCircle(Vector origin, Number radius)
 {
     return(PhysicsUtils.IsRectangleCircleOverlap(position, size, rotation, origin, radius));
 }
예제 #4
0
 public override bool OverlapBox(Vector origin, Vector size, Number rotation)
 {
     return(PhysicsUtils.IsRectangleCircleOverlap(origin, size, rotation, position, radius));
 }