public override void init()
        {
            collider = new TgcFixedYBoundingCylinder(new Vector3(0, 0, 0), 3, 3);
            collisionableSphere = new TgcBoundingSphere(new Vector3(-6, 0, 0), 3);
            collisionableAABB = new TgcBoundingBox(new Vector3(4, 0, -1), new Vector3(6, 2, 1));
            collisionableCylinder = new TgcFixedYBoundingCylinder(new Vector3(0, 0, -6), 2, 2);

            GuiController.Instance.Modifiers.addVertex2f("size", new Vector2(1, 1), new Vector2(5, 10), new Vector2(2, 5));
            GuiController.Instance.Modifiers.addVertex3f("position", new Vector3(-20, -20, -20), new Vector3(20, 20, 20), new Vector3(0, 0, 0));

            collider.setRenderColor(Color.LimeGreen);
        }
 /// <summary>
 /// Determina el punto mas cercano de un cilindro al punto P especificado
 /// </summary>
 /// <param name="p">Punto</param>
 /// <param name="cylinder">Cilindro alineado</param>
 /// <returns>Punto perteneciente al cilindro mas cercano a P</returns>
 public static Vector3 closestPointCylinder(Vector3 p, TgcFixedYBoundingCylinder cylinder)
 {
     return TgcCollisionUtils.closestPointCylinder(p, cylinder.Center, cylinder.HalfLength, cylinder.Radius);
 }
 /// <summary>
 /// Indica si un Punto colisiona con un Cilindro.
 /// </summary>
 /// <param name="p">Punto</param>
 /// <param name="cylinder">Cilindro alineado</param>
 /// <returns>True si el Punto esta adentro del Cilindro</returns>
 private static bool testPointCylinder(Vector3 p, TgcFixedYBoundingCylinder cylinder)
 {
     return TgcCollisionUtils.testPointCylinder(p, cylinder.Center, cylinder.HalfLength, cylinder.Radius);
 }
 /// <summary>
 /// Indica si un Cilindro colisiona con una Esfera.
 /// Solo indica si hay colision o no. No va mas en detalle.
 /// </summary>
 /// <param name="sphere">Esfera</param>
 /// <param name="cylinder">Cilindro alineado</param>
 /// <returns>True si hay colision</returns>
 public static bool testSphereCylinder(TgcBoundingSphere sphere, TgcFixedYBoundingCylinder cylinder)
 {
     return TgcCollisionUtils.testSphereCylinder(
         sphere.Center, sphere.Radius,
         cylinder.Center, cylinder.HalfLength, cylinder.Radius);
 }
        /// <summary>
        /// Indica si un rayo colisiona con un cilindro.
        /// </summary>
        /// <param name="ray">Rayo</param>
        /// <param name="cylinder">Cilindro alineado</param>
        /// <returns>True si el rayo colisiona con el cilindro</returns>
        public static bool testRayCylinder(TgcRay ray, TgcFixedYBoundingCylinder cylinder)
        {
            Matrix transformation = cylinder.AntiTransformationMatrix;
            Vector3 origin = Vector3.TransformCoordinate(ray.Origin, transformation);
            Vector3 direction = Vector3.TransformNormal(ray.Direction, transformation);

            return TgcCollisionUtils.testRayCylinder(origin, direction);
        }
 /// <summary>
 /// Indica si un Cilindro colisiona con otro Cilindro.
 /// Solo indica si hay colision o no. No va mas en detalle.
 /// </summary>
 /// <param name="collider">Cilindro alineado que genera la colision</param>
 /// <param name="collisionable">Cilindro alineado estatico</param>
 /// <returns>True si hay colision</returns>
 public static bool testCylinderCylinder(TgcFixedYBoundingCylinder collider, TgcFixedYBoundingCylinder collisionable)
 {
     Vector3 centerToCenter = collider.Center - collisionable.Center;
     if (FastMath.Pow2(centerToCenter.X) + FastMath.Pow2(centerToCenter.Z) > FastMath.Pow2(collisionable.Radius + collider.Radius)) return false;
     if (FastMath.Abs(centerToCenter.Y) > collider.HalfLength + collisionable.HalfLength) return false;
     return true;
 }
        /// <summary>
        /// Indica si un Cilindro colisiona con un AABB.
        /// Solo indica si hay colision o no. No va mas en detalle.
        /// </summary>
        /// <param name="box">AABB</param>
        /// <param name="cylinder">Cilindro alineado</param>
        /// <returns>True si hay colision</returns>
        public static bool testAABBCylinder(TgcBoundingBox box, TgcFixedYBoundingCylinder cylinder)
        {
            //datos del aabb
            Vector3 boxCenter = box.calculateBoxCenter();
            Vector3 boxHalfSize = box.calculateSize() * 0.5f;

            //datos del cilindro
            Vector3 cylCenter = cylinder.Center;
            float cylHalfLength = cylinder.HalfLength;
            float cylRadius = cylinder.Radius;

            //vector de distancias
            Vector3 distances = new Vector3(
                FastMath.Abs(boxCenter.X - cylCenter.X),
                FastMath.Abs(boxCenter.Y - cylCenter.Y),
                FastMath.Abs(boxCenter.Z - cylCenter.Z));

            //si el aabb esta muy arriba o muy abajo no hay colision
            if (distances.Y > boxHalfSize.Y + cylHalfLength) return false;

            //si el aabb esta muy lejos en x o en z no hay colision
            if (distances.X > boxHalfSize.X + cylRadius) return false;
            if (distances.Z > boxHalfSize.Z + cylRadius) return false;

            //si el centro del cilindro esta dentro del aabb hay colision
            if (distances.X <= boxHalfSize.X) return true;
            if (distances.Z <= boxHalfSize.Z) return true;

            //si el cilindro toca alguno de los extremos hay colision
            float cornerDistanceSq =
                FastMath.Pow2(distances.X - boxHalfSize.X) +
                FastMath.Pow2(distances.Z - boxHalfSize.Z);
            return (cornerDistanceSq <= FastMath.Pow2(cylRadius));
        }