/// <summary>
 /// Direction arrow
 /// </summary>
 private void ChangeDirectionArrow()
 {
     if (!(PlayerInputScript.Horiz == 0 && PlayerInputScript.Verti == 0))
     {
         dirArrow.rotation = QuaternionExt.DirObject(dirArrow.rotation, PlayerInputScript.Horiz, -PlayerInputScript.Verti, turnRateArrow, QuaternionExt.TurnType.Z);
     }
 }
Beispiel #2
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);
    }