Ejemplo n.º 1
0
        /// <summary>
        ///  Returns a 2D convex polygon outline of the intersection between two
        ///  hit boxes. This can be rendered as a Shape2D component.
        /// </summary>
        public NativeArray <float2> DetailedHitBoxOverlapInformation(Entity e, HitBoxOverlap overlap, Allocator allocator = Allocator.Temp)
        {
            if (e == Entity.Null || overlap.otherEntity == Entity.Null)
            {
                return(new NativeArray <float2>(0, allocator));
            }
            if (e == overlap.otherEntity)
            {
                Assert.IsTrue(false, "DetailedOverlapInformation is trying to check an entity with itself.");
                return(new NativeArray <float2>(0, allocator));
            }
            NativeArray <float2> result;

            unsafe
            {
                float *temp    = stackalloc float [16];
                int    nresult = DetailedOverlapInformationNative(cppWrapper, e, overlap, (float2 *)temp);
                result = new NativeArray <float2>(nresult, allocator);
                for (int i = 0; i < nresult; i++)
                {
                    result[i] = new float2(temp[i * 2], temp[i * 2 + 1]);
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
 protected static extern unsafe int DetailedOverlapInformationNative(IntPtr emr, Entity e, HitBoxOverlap overlap, float2 *result);