private static void WriteConnectivitySlider(this BinaryWriter writer, LEGOPrimitiveConnectivitySlider slider) { writer.Write(slider.type); writer.Write(slider.length); writer.Write(slider.startCapped); writer.Write(slider.endCapped); writer.Write(slider.angle); writer.Write(slider.ax); writer.Write(slider.ay); writer.Write(slider.az); writer.Write(slider.tx); writer.Write(slider.ty); writer.Write(slider.tz); }
/// <summary> /// 镜面取反 /// </summary> internal void Mirror() { float num = -this.GeometryBounding.AABB.maxZ; //取Z值最大值,取反,临时变量 this.GeometryBounding.AABB.maxZ = -this.GeometryBounding.AABB.minZ; //最大Z变最小Z this.GeometryBounding.AABB.minZ = num; //最小Z取 临时 //遍历碰撞数组中,储存的所有碰撞类型 foreach (object obj in this.Collision.Items) { if (obj is LEGOPrimitiveCollisionBox)//碰撞盒 { //强转Object,将数据取反 LEGOPrimitiveCollisionBox primitiveCollisionBox = obj as LEGOPrimitiveCollisionBox; primitiveCollisionBox.ax = -primitiveCollisionBox.ax; primitiveCollisionBox.ay = -primitiveCollisionBox.ay; primitiveCollisionBox.tz = -primitiveCollisionBox.tz; } if (obj is LEGOPrimitiveCollisionSphere)//碰撞圆 { LEGOPrimitiveCollisionSphere primitiveCollisionSphere = obj as LEGOPrimitiveCollisionSphere; primitiveCollisionSphere.ax = -primitiveCollisionSphere.ax; primitiveCollisionSphere.ay = -primitiveCollisionSphere.ay; primitiveCollisionSphere.tz = -primitiveCollisionSphere.tz; } } //遍历联通组所有项目 foreach (object obj in this.Connectivity.Items) { if (obj is LEGOPrimitiveConnectivityCustom2DField) { LEGOPrimitiveConnectivityCustom2DField connectivityCustom2Dfield = obj as LEGOPrimitiveConnectivityCustom2DField; connectivityCustom2Dfield.ax = -connectivityCustom2Dfield.ax; connectivityCustom2Dfield.ay = -connectivityCustom2Dfield.ay; connectivityCustom2Dfield.tz = -connectivityCustom2Dfield.tz; } if (obj is LEGOPrimitiveConnectivityAxel) { LEGOPrimitiveConnectivityAxel connectivityAxel = obj as LEGOPrimitiveConnectivityAxel; connectivityAxel.ax = -connectivityAxel.ax; connectivityAxel.ay = -connectivityAxel.ay; connectivityAxel.tz = -connectivityAxel.tz; } if (obj is LEGOPrimitiveConnectivityFixed) { LEGOPrimitiveConnectivityFixed connectivityFixed = obj as LEGOPrimitiveConnectivityFixed; connectivityFixed.ax = -connectivityFixed.ax; connectivityFixed.ay = -connectivityFixed.ay; connectivityFixed.tz = -connectivityFixed.tz; } if (obj is LEGOPrimitiveConnectivityHinge) { LEGOPrimitiveConnectivityHinge connectivityHinge = obj as LEGOPrimitiveConnectivityHinge; connectivityHinge.ax = -connectivityHinge.ax; connectivityHinge.ay = -connectivityHinge.ay; connectivityHinge.tz = -connectivityHinge.tz; } if (obj is LEGOPrimitiveConnectivitySlider) { LEGOPrimitiveConnectivitySlider connectivitySlider = obj as LEGOPrimitiveConnectivitySlider; connectivitySlider.ax = -connectivitySlider.ax; connectivitySlider.ay = -connectivitySlider.ay; connectivitySlider.tz = -connectivitySlider.tz; } if (obj is LEGOPrimitiveConnectivityBall) { LEGOPrimitiveConnectivityBall connectivityBall = obj as LEGOPrimitiveConnectivityBall; connectivityBall.ax = -connectivityBall.ax; connectivityBall.ay = -connectivityBall.ay; connectivityBall.tz = -connectivityBall.tz; } } }