Universe.Physics.BulletSPlugin.BSShapeMesh.CreatePhysicalMesh C# (CSharp) Method

CreatePhysicalMesh() private method

private CreatePhysicalMesh ( BSScene physicsScene, BSPhysObject prim, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OpenMetaverse size, float lod ) : BulletShape
physicsScene BSScene
prim BSPhysObject
newMeshKey System.UInt64
pbs PrimitiveBaseShape
size OpenMetaverse
lod float
return BulletShape
        BulletShape CreatePhysicalMesh(BSScene physicsScene, BSPhysObject prim, UInt64 newMeshKey,
            PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
        {
            return BSShapeMesh.CreatePhysicalMeshShape(physicsScene, prim, newMeshKey, pbs, size, lod,
                (w, iC, i, vC, v) =>
                {
                    shapeInfo.Vertices = vC;
                    return physicsScene.PE.CreateMeshShape(w, iC, i, vC, v);
                });
        }

Usage Example

        public static BSShape GetReference(BSScene physicsScene, bool forceRebuild, BSPhysObject prim)
        {
            float lod;
            UInt64 newMeshKey = BSShape.ComputeShapeKey(prim.Size, prim.BaseShape, out lod);

            BSShapeMesh retMesh;
            lock (Meshes)
            {
                if (Meshes.TryGetValue(newMeshKey, out retMesh))
                {
                    // The mesh has already been created. Return a new reference to same.
                    retMesh.IncrementReference();
                }
                else
                {
                    retMesh = new BSShapeMesh(new BulletShape());
                    // An instance of this mesh has not been created. Build and remember same.
                    BulletShape newShape = retMesh.CreatePhysicalMesh(physicsScene, prim, newMeshKey, prim.BaseShape,
                        prim.Size, lod);

                    // Check to see if mesh was created (might require an asset).
                    newShape = VerifyMeshCreated(physicsScene, newShape, prim);
                    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.
                        Meshes.Add(newMeshKey, retMesh);
                    }
                    retMesh.physShapeInfo = newShape;
                }
            }
            physicsScene.DetailLog("{0},BSShapeMesh,getReference,mesh={1},size={2},lod={3}", prim.LocalID, retMesh,
                prim.Size, lod);
            return retMesh;
        }