예제 #1
0
        public static bool OverlapSphere(Fix64Vec3 center, Fix64 radius, int mask, PShapeOverlapResult3D shapeOverlapResult)
        {
            if (!initialized)
            {
                Initialize();
            }

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

            shapeOverlapResult.count = count;

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

            return(hit);
        }
예제 #2
0
 //overlap
 public static bool OverlapSphere(Fix64Vec3 center, Fix64 radius, PShapeOverlapResult3D shapeOverlapResult)
 {
     return(OverlapSphere(center, radius, -1, shapeOverlapResult));
 }