Example #1
0
    /// <summary>
    /// Animates movement based on horizontal/vertical input
    /// </summary>
    /// <param name="input">Player input</param>
    protected void AnimateMovement()
    {
        // Calculcate angle of rotation based on current direction
        Vector3 rotation = new Vector3(0, 0, DirectionHelper.DirectionToRotation(currentDirection) ?? 0);

        // Assign rotation to quaternion.eulerAngles
        Quaternion rot = transform.rotation;

        rot.eulerAngles    = rotation;
        transform.rotation = rot;
    }