Beispiel #1
0
        public static bool OverlapCircle(Fix64Vec2 center, Fix64 radius, int mask, PShapeOverlapResult2D shapeOverlapResult)
        {
            if (!initialized)
            {
                Initialize();
            }

            int  count = 0;
            bool hit   = NativeParallel2D.CircleOverlap(internalWorld.IntPointer, center, radius, mask, _queryBodyIDs, ref count);

            shapeOverlapResult.count = count;

            for (int i = 0; i < count; i++)
            {
                UInt16 bodyID = _queryBodyIDs[i];
                if (bodySortedList.ContainsKey(bodyID))
                {
                    shapeOverlapResult.rigidbodies[i] = bodySortedList[bodyID].RigidBody;
                }
                else
                {
                    Debug.LogError($"Rigibody not found: {bodyID}");
                }
            }

            return(hit);
        }
Beispiel #2
0
 //overlap
 public static bool OverlapCircle(Fix64Vec2 center, Fix64 radius, PShapeOverlapResult2D shapeOverlapResult)
 {
     return(OverlapCircle(center, radius, -1, shapeOverlapResult));
 }