// Loop through all the known hulls and return the description based on the physical address.
 public static bool TryGetGImpactByPtr(BulletShape pShape, out BSShapeGImpact outHull)
 {
     bool ret = false;
     BSShapeGImpact foundDesc = null;
     lock (GImpacts)
     {
         foreach (BSShapeGImpact sh in GImpacts.Values)
         {
             if (sh.physShapeInfo.ReferenceSame(pShape))
             {
                 foundDesc = sh;
                 ret = true;
                 break;
             }
         }
     }
     outHull = foundDesc;
     return ret;
 }
        public static BSShape GetReference(BSScene physicsScene, bool forceRebuild, BSPhysObject prim)
        {
            float lod;
            UInt64 newMeshKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod);

            physicsScene.DetailLog("{0},BSShapeGImpact,getReference,newKey={1},size={2},lod={3}", prim.LocalID,
                newMeshKey.ToString("X"), prim.Size, lod);
            BSShapeGImpact retGImpact;

            lock (GImpacts)
            {
                if (GImpacts.TryGetValue(newMeshKey, out retGImpact))
                {
                    // Teh mesh has already been created. Return a new reference to same.
                    retGImpact.IncrementReference();
                }
                else
                {
                    retGImpact = new BSShapeGImpact(new BulletShape());
                    BulletShape newShape = retGImpact.CreatePhysicalGImpact(physicsScene, prim, newMeshKey,
                        prim.BaseShape, prim.Size, lod);

                    // Check to see if mesh was created (might require an asset).
                    newShape = VerifyMeshCreated(physicsScene, newShape, prim);
                    newShape.shapeKey = newMeshKey;
                    if (!newShape.isNativeShape || prim.AssetFailed())
                    {
                        // If a mesh was what was created, remember the built shape for later sharing.
                        // Also note that if meshing failed we put it in the mesh list as there is nothing
                        //          else to do about the mesh.
                        GImpacts.Add(newMeshKey, retGImpact);
                    }
                    retGImpact.physShapeInfo = newShape;
                }
            }
            return retGImpact;
        }