Beispiel #1
0
    // Sometimes we have a pointer to a collision shape but don't know what type it is.
    // Figure out type and call the correct dereference routine.
    // Called at taint-time.
    private void DereferenceAnonCollisionShape(BSScene physicsScene, BulletShape pShape)
    {
        BSShapeMesh meshDesc;

        if (BSShapeMesh.TryGetMeshByPtr(pShape, out meshDesc))
        {
            meshDesc.Dereference(physicsScene);
        }
        else
        {
            BSShapeHull hullDesc;
            if (BSShapeHull.TryGetHullByPtr(pShape, out hullDesc))
            {
                hullDesc.Dereference(physicsScene);
            }
            else
            {
                BSShapeConvexHull chullDesc;
                if (BSShapeConvexHull.TryGetHullByPtr(pShape, out chullDesc))
                {
                    chullDesc.Dereference(physicsScene);
                }
                else
                {
                    if (physicsScene.PE.IsCompound(pShape))
                    {
                        BSShapeCompound recursiveCompound = new BSShapeCompound(pShape);
                        recursiveCompound.Dereference(physicsScene);
                    }
                    else
                    {
                        if (physicsScene.PE.IsNativeShape(pShape))
                        {
                            BSShapeNative nativeShape = new BSShapeNative(pShape);
                            nativeShape.Dereference(physicsScene);
                        }
                    }
                }
            }
        }
    }