Beispiel #1
0
        internal static Collision FromNewtonCollision(World world, IntPtr newtonCollision)
        {
            NativeAPI.NewtonCollisionInfoRecord info;
            NativeAPI.CollisionGetInfo(newtonCollision, out info);

            Collision collision;

            switch (info.m_collisionType)
            {
                case NativeAPI.SERIALIZE_ID_BOX:
                case NativeAPI.SERIALIZE_ID_CONE:
                case NativeAPI.SERIALIZE_ID_SPHERE:
                case NativeAPI.SERIALIZE_ID_CAPSULE:
                case NativeAPI.SERIALIZE_ID_CYLINDER:
                case NativeAPI.SERIALIZE_ID_COMPOUND:
                case NativeAPI.SERIALIZE_ID_CONVEXHULL:
                case NativeAPI.SERIALIZE_ID_CONVEXMODIFIER:
                case NativeAPI.SERIALIZE_ID_CHAMFERCYLINDER:
                case NativeAPI.SERIALIZE_ID_NULL:
                    collision = new ConvexCollision(world, newtonCollision);
                    break;

                case NativeAPI.SERIALIZE_ID_TREE:
                    collision = new TreeCollision(world, newtonCollision);
                    break;

                case NativeAPI.SERIALIZE_ID_HEIGHFIELD:
                    collision = new Collision(world, newtonCollision);
                    break;

                case NativeAPI.SERIALIZE_ID_SCENE: //TODO
                default:
                    collision = new Collision(world, newtonCollision);
                    break;
            }

            collision.AddReference();
            return collision;
        }
Beispiel #2
0
 public ConvexHullModifier CreateConvexHullModifier(ConvexCollision convexHullCollision)
 {
     return new ConvexHullModifier(this, NativeAPI.CreateConvexHullModifier(handle, convexHullCollision.handle));
 }