コード例 #1
0
    /*public CollisionType GetTheSafestCallision()
     * {
     *  return ((CollisionType)WhatKindOfNormalIsIt(DefineWhichNormalToChose()));
     * }*/

    /// <summary>
    /// ici défini la normal de la somme des 4 collisions,
    /// et le type de collision que cela implique
    /// </summary>
    private void DefineNormalAndCollision()
    {
        //set new normal / collision
        normalSumCollide = QuaternionExt.GetMiddleOfXVector(colliderNormalArray);
        if (normalSumCollide == Vector3.zero)
        {
            //Debug.Log("PUTAIN POURQUOI C'4EST ZERO");
            //    normalSumCollide = Vector3.up;
        }


        //save previous collision / normal
        Vector3 normalToChose = DefineWhichNormalToChose();

        CollisionType tmpCollision = (CollisionType)WhatKindOfNormalIsIt(normalToChose);

        if (tmpCollision == CollisionType.InAir && collisionType != CollisionType.InAir)
        {
            lastCollisionTypePersist = collisionType;
            normalSumCollidePrevious = normalSumCollide;
        }

        if (tmpCollision == CollisionType.Ground)
        {
            //Debug.Log("normalToCHose: " + normalToChose);
            for (int i = 0; i < colliderNormalArray.Length; i++)
            {
                //Debug.Log(colliderNormalArray[i]);
            }
            //Debug.Break();
        }

        collisionType = tmpCollision;
    }