Esempio n. 1
0
    /// <summary>
    /// est ammelé à chaque update, pour tourner l'anim
    /// </summary>
    private void Turning()
    {
        if (!playerGrip.Gripped && playerPenduleMove.IsAirTenseOrInCoolDown())
        {
            //parentParentAnim.rotation = QuaternionExt.DirObject(parentParentAnim.rotation, penduleMove.x, -penduleMove.y, speedTurn * ratio, QuaternionExt.TurnType.Z);
            parentAnim.rotation = QuaternionExt.DirObject(parentAnim.rotation, penduleMove.x, -penduleMove.y, speedTurn * ratio, QuaternionExt.TurnType.Z);
        }
        else
        {
            parentAnim.rotation = QuaternionExt.DirObject(parentAnim.rotation, dirMove.x, dirMove.y, speedTurn * ratio, QuaternionExt.TurnType.Y);
        }
        //childAnim.localEulerAngles = new Vector3(0, 0, 0);
        //penduleChildRotate = new Vector3(0, 0, 0);
        childAnim.localEulerAngles = QuaternionExt.DirLocalObject(childAnim.localEulerAngles,
                                                                  penduleChildRotate,
                                                                  speedPenduleTurn,
                                                                  QuaternionExt.TurnType.Y);

        //Quaternion targetRotation = Quaternion.FromToRotation(Vector3.forward, Vector3.up) * Quaternion.LookRotation(penduleChildRotate);
        //childAnim.rotation = Quaternion.Lerp(childAnim.rotation, targetRotation, Time.deltaTime * speedTurn * ratio);
    }