public override CollisionAlgorithmCreateFunc GetCollisionAlgorithmCreateFunc(BroadphaseNativeType proxyType0, BroadphaseNativeType proxyType1)
        {
            IntPtr createFunc = btCollisionConfiguration_getCollisionAlgorithmCreateFunc(_native, (int)proxyType0, (int)proxyType1);

            if (proxyType0 == BroadphaseNativeType.SoftBodyShape && proxyType1 == BroadphaseNativeType.SoftBodyShape)
            {
                return(new SoftSoftCollisionAlgorithm.CreateFunc(createFunc));
            }
            if (proxyType0 == BroadphaseNativeType.SoftBodyShape && BroadphaseProxy.IsConvex(proxyType1))
            {
                return(new SoftRigidCollisionAlgorithm.CreateFunc(createFunc));
            }
            if (BroadphaseProxy.IsConvex(proxyType0) && proxyType1 == BroadphaseNativeType.SoftBodyShape)
            {
                return(new SoftRigidCollisionAlgorithm.CreateFunc(createFunc));
            }
            if (proxyType0 == BroadphaseNativeType.SoftBodyShape && BroadphaseProxy.IsConcave(proxyType1))
            {
                return(new SoftBodyConcaveCollisionAlgorithm.CreateFunc(createFunc));
            }
            if (BroadphaseProxy.IsConcave(proxyType0) && proxyType1 == BroadphaseNativeType.SoftBodyShape)
            {
                return(new SoftBodyConcaveCollisionAlgorithm.SwappedCreateFunc(createFunc));
            }
            return(base.GetCollisionAlgorithmCreateFunc(proxyType0, proxyType1));
        }
示例#2
0
        public override CollisionAlgorithmCreateFunc GetCollisionAlgorithmCreateFunc(BroadphaseNativeType proxyType0, BroadphaseNativeType proxyType1)
        {
            IntPtr createFunc = btCollisionConfiguration_getCollisionAlgorithmCreateFunc(_native, (int)proxyType0, (int)proxyType1);

            if (proxyType0 == BroadphaseNativeType.BoxShape && proxyType1 == BroadphaseNativeType.BoxShape)
            {
                return(new BoxBoxCollisionAlgorithm.CreateFunc(createFunc));
            }
            if (proxyType0 == BroadphaseNativeType.SphereShape && proxyType1 == BroadphaseNativeType.SphereShape)
            {
                return(new SphereSphereCollisionAlgorithm.CreateFunc(createFunc));
            }
            if (proxyType0 == BroadphaseNativeType.SphereShape && proxyType1 == BroadphaseNativeType.TriangleShape)
            {
                return(new SphereTriangleCollisionAlgorithm.CreateFunc(createFunc));
            }
            if (proxyType0 == BroadphaseNativeType.TriangleShape && proxyType1 == BroadphaseNativeType.SphereShape)
            {
                return(new SphereTriangleCollisionAlgorithm.CreateFunc(createFunc));
            }
            if (proxyType0 == BroadphaseNativeType.StaticPlaneShape && BroadphaseProxy.IsConvex(proxyType1))
            {
                return(new ConvexPlaneCollisionAlgorithm.CreateFunc(createFunc));
            }
            if (proxyType1 == BroadphaseNativeType.StaticPlaneShape && BroadphaseProxy.IsConvex(proxyType0))
            {
                return(new ConvexPlaneCollisionAlgorithm.CreateFunc(createFunc));
            }
            if (BroadphaseProxy.IsConvex(proxyType0) && BroadphaseProxy.IsConvex(proxyType1))
            {
                return(new ConvexConvexAlgorithm.CreateFunc(createFunc));
            }
            if (BroadphaseProxy.IsConvex(proxyType0) && BroadphaseProxy.IsConcave(proxyType1))
            {
                return(new ConvexConcaveCollisionAlgorithm.CreateFunc(createFunc));
            }
            if (BroadphaseProxy.IsConvex(proxyType1) && BroadphaseProxy.IsConcave(proxyType0))
            {
                return(new ConvexConcaveCollisionAlgorithm.SwappedCreateFunc(createFunc));
            }
            if (BroadphaseProxy.IsCompound(proxyType0))
            {
                return(new CompoundCompoundCollisionAlgorithm.CreateFunc(createFunc));
            }
            if (BroadphaseProxy.IsCompound(proxyType1))
            {
                return(new CompoundCompoundCollisionAlgorithm.SwappedCreateFunc(createFunc));
            }

            return(new EmptyAlgorithm.CreateFunc(createFunc));
        }