# Quick Start

<iframe src="https://www.youtube.com/embed/IfoUWlOBHkM?si=pvn02X6R6bJHfvxY" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

[AnimatedBookMenu_ExampleProjects.zip](https://docs.suricoon.com/attachments/2)

## Prerequisites
- Make sure the correct version of Unreal Engine is installed (UE 5.3+)
- Make sure you have purchased the Plugin from the <a href="https://www.unrealengine.com/marketplace/en-US/product/animated-book-menu">Marketplace</a> and installed it to the Engine

## Create a new Project
__Open Unreal Engine Launcher and launch Unreal Engine (5.3+)__
<hr>
<p id="bkmrk--0"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-01/image.png" target="_blank" rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-01/scaled-1680-/image.png" width="600" alt="image.png"></a></p>

__Create a new Project__
<hr>
<p id="bkmrk--3"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-01/2oJimage.png" target="_blank" rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-01/scaled-1680-/2oJimage.png" width="600" alt="image.png"></a></p>

1. Select Blank Project
1. Select Blueprint with Target Platform Windows, Quality Preset Maximum and leave Starter Content and Raytracing unchecked
1. Name the Project GettingStarted
1. Click on Create

__Project Settings__
<hr>

- Once the project has loaded, go to ``Settings > Project Settings``
- In the Search bar type: Support UV From Hit Results
- Enable the setting ``Optimization > Support UV From Hit Result``

<p id="bkmrk--6"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-01/wKRimage.png" target="_blank" rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-01/scaled-1680-/wKRimage.png" width="600" alt="image.png"></a></p>

> **_NOTE:_**  If being asked to restart, ignore it, we will restart the editor after the next step

__Enable Plugin__
<hr id="bkmrk--7">

- Navigate to ``Edit > Plugins`` 
- In the category "Advanced Gameplay" enable the Animated Book Menu Plugin
- You can also search for "Book" in the search bar and then enable it

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-01/fylimage.png" target="_blank" rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-01/scaled-1680-/fylimage.png" width="600" alt="image.png"></a></p>

> **_NOTE:_** If being asked to restart the editor, confirm with Restart Now

<p id="bkmrk--9"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-01/DDmimage.png" target="_blank" rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-01/scaled-1680-/DDmimage.png" alt="image.png" width="664" height="100"></a></p>

## Prepare some Content

__Folder Setup__
<hr>

- In the Content Browser under Content, create a new Folder with the name "BookMenu" and navigate to it.

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-01/VSUimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-01/VSUimage.png" width="600" alt="image.png"></a></p>

__Copy some initial files from the Plugins Content Folder__
<hr>

- In the Content Browser under Settings, make sure the Show Plugin Content option is checked

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-01/jyIimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-01/jyIimage.png" width="400" alt="image.png"></a></p>


- Then navigate to the Content Folder of the Plugin, with the name Animated Book Menu Content

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-01/qJjimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-01/qJjimage.png" width="300" alt="image.png"></a></p>

- Copy the following files from the Plugin Content folder to the BookMenu folder:

| From                                      | To                                |
| ------------------------------------------| ----------------------------------|
| /BookMenu/Blueprints/BookMenuActor_BP     | /Game/BookMenu/MyBookMenuActor_BP |
| /BookMenu/BookData/Example_Book_Menu_Data | /Game/BookMenu/MyBookData         |

## Basic Player Pawn Setup

__Create Player Pawn Blueprnt Class__
<hr>

- Create a new Blueprint Class and select Pawn and name it PlayerPawn_BP

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-01/8Dgimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-01/8Dgimage.png" width="400" alt="image.png"></a></p>

__Add the Book Menu Component to the Player Pawn__
<hr>

- Open the  PlayerPawn_BP Blueprint and under Components, add the following Components to the DefaultSceneRoot
	- Camera 
    	- BookMenu

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-01/CuQimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-01/CuQimage.png" width="400" alt="image.png"></a></p>


__Configure the Book Menu Component__
<hr>

- Select the BookMenu Component from the Component List 

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-01/fYMimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-01/fYMimage.png" width="400" alt="image.png"></a></p>

- and under Details->BookMenu set the following settings:

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-01/zSnimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-01/zSnimage.png" width="400" alt="image.png"></a></p>

- While the two options are the copied assets from the previous Step.

__Add some Begin Play Logic__
<hr>

- Add the following Blueprint nodes to the Begin Play event

<iframe style="width: 100%; height: 500px;" src="https://blueprintue.com/render/99yybgi5/" scrolling="no" allowfullscreen="allowfullscreen"></iframe>

- This sets the Input node to Game and UI and shows the mouse cursor.

## Map Setup

__Save the Map and set it as the Editor default map__
<hr>

Because we used the Blank Project Template, the editor will give us the default map at startup, which we have to save first.
Click on ``File > Save All``\
When being asked where to save the map, choose ``/BookMenu/Map.umap``\
Then goto ``Settings > Projects Settings > Maps & Modes``
 
 <p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-02/image.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-02/image.png" width="700" alt="image.png"></a></p>
 
 Set Editor Startup Map and Game Default Map to the Map we have saved previously.
 
 __Place Player Pawn on Map__
 
Drag and Dop the PlayerPawn_BP Blueprint onto the map and adjust its position to something like that:

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-02/Au4image.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-02/Au4image.png" width="300" alt="image.png"></a></p>

Select the recently placed ``PlayerPawn_BP`` Actor and navigate to the Details Panel.\
Under ``Auto Poses Player``, select ``Player 0``\
It is important to also delete the Player Start Object from the Map
 
<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-02/51mimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-02/51mimage.png" width="600" alt="image.png"></a></p>

 Hit play, you should see something like this:

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-02/JD3image.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-02/JD3image.png" width="400" alt="image.png"></a></p>

Just the Book lying open without any page turn or interaction.\
That's what we will add next.


## Automatic page turn logic

__Adjust the Book Menu Data Config__
<hr>

Open the ``MyBookData asset`` (the one we copied earlier from the plugins content folder)\
Uncheck ``Book Begins Play Open`` and set the ``Start Page Section`` to 0\
As we remember from the previous play test, the book started in an open state. That was because those options were set.\
Save the asset and run the game again by hitting Play.\
You should now see that the book starts in an closed state and simply does nothing else.

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-02/hLYimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-02/hLYimage.png" width="600" alt="image.png"></a></p>

__Adjustments of the Book Menu Actor__
<hr>

Open the ``MyBookMenuActor_BP`` Blueprint (the one we copied earlier from the plugins content folder)
``OnBeginPlay`` we want open the Book and set some timers to automatically turn the pages after 5 and  back again after 10 seconds.

> **_NOTE:_** Because Begin Play is also exactly the moment where the whole initialization of the book, the rendering and the Anim instance happens, we should not call any book controls on begin play. But there is a solution by adding a one frame delay

Add the following Blueprint Nodes to Begin Play of MyBookMenuActor_BP

<iframe style="width: 100%; height: 300px;" src="https://blueprintue.com/render/yx8ovmpk/" scrolling="no" allowfullscreen="allowfullscreen"></iframe>

The Delay Until Next Tick must be called before any book control functions on Begin Play. Otherwise the initialization and the control calls collide with each other.\
 If you hit Play you should see an opening book animation ending like this:

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-02/JHjimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-02/JHjimage.png" width="600" alt="image.png"></a></p>

Now let's add some automatic page turning. Add the following Blueprint Nodes to the output of "Open Book At"

<iframe style="width: 100%; height: 500px;" src="https://blueprintue.com/render/0os6i1u3/" scrolling="no" allowfullscreen="allowfullscreen"></iframe>

This will open the book. After 5 seconds the book will perform a forward page turn because the new Page Section we are jumping to is greater than the current one.\
After 10 seconds the book will perform a reverse Page Turn because the Page Section we are jumping to is smaller than the current one.\
Hit play to see the animation sequence we just created.


## Adding book interactions

Last but not least, let's make the pages interactive. We want to create an interactive mouse which enables us to hover over the buttons and also to click on the buttons of the pages.

__Add Book Menu Interaction Component to the  Player Pawn__
<hr>


Open the ``PlayerPawn_BP`` Blueprint.\
Add a ``BookMenuInteractionCopmponent`` to the ``DefaultSceneRoot`` of the Actor

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-02/VfLimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-02/VfLimage.png" width="300" alt="image.png"></a></p>

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-02/5ZCimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-02/5ZCimage.png" width="300" alt="image.png"></a></p>

Select the ``BookMenuInteraction`` Component and set the ``BookMenuInteractionActor_BP`` as the value under\
``BookMenu > BookMenuInteractionActorClass``

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-02/oMpimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-02/oMpimage.png" width="600" alt="image.png"></a></p>


__Extend Begin Play on  the  Player Pawn__
<hr>

On the Begin Play Node add the "Register Interaction Component" Node after Set Show Mouse Cursor:

<iframe style="width: 100%; height: 700px;" src="https://blueprintue.com/render/uyeq_uk-/" scrolling="no" allowfullscreen="allowfullscreen"></iframe>

This registers the newly added BookMenuInteraction Component inside the Book Menu Actor

__Create regular mouse traces__

In order to interact with the pages of the book we want to create traces starting starting from the mouse cursor on the screen into the game world.\
For this purpose the Book Menu Statics Library offers a node called ``Create Mouse Trace Parameters``.\
Those parameters can be used to try an interaction on the Book Menu Actor.\
Add the following nodes to the Event Tick of the PlayerPawn_BP:

<iframe style="width: 100%; height: 400px;" src="https://blueprintue.com/render/j1-pqr6f/" scrolling="no" allowfullscreen="allowfullscreen"></iframe>

This creates the mouse trace parameters with an trace distance of 500 units and passes the start and end locations for the actual trace into the interact method of the Book Menu Actor\
If you enable ``Debug Trace`` you will later see how the traces are performed by drawn lines inside the viewport.\
Apropos viewport, let's switch to the viewport of the book menu actor and position the book menu interaction component in a way so that we can see what it is actually doing.\
In the viewport move the BookMenuInteraction Component to the position ``X:120`` ``Y:0`` and ``Z:60``\
This will place the ``BookMenuInteraction`` Component so that we can see it in game.\
Like this in the background:

<p id="bkmrk--8"><a href="https://docs.suricoon.com/uploads/images/gallery/2024-02/MEwimage.png" target="_blank"  rel="noopener"><img src="https://docs.suricoon.com/uploads/images/gallery/2024-02/MEwimage.png" width="600" alt="image.png"></a></p>

> **_NOTE:_** Usually you don't want to have the Book Menu Interaction Component on screen. Therefore it makes sense to move it behind the camera and for multiplyaer games not to replicate the component at all. 

Lets move the Book Menu Interaction Component behind the Camera to position ``X: -120`` ``Y:0`` ``Z:0``\
Hit play and hover the Buttons. You should see them lighting up. But you can't click them yet. Thats what we are doing next.

__Adding Input to the Book Menu Interaction Actor__
<hr>

Somewhere inside the event graph of PlayerPawn_BP add the following nodes:

<iframe style="width: 100%; height: 400px;" src="https://blueprintue.com/render/sdbp1iyr/" scrolling="no" allowfullscreen="allowfullscreen"></iframe>

This gets the Widget Interaction Component from the Book Menu Interaction Component. We can use this Widget Interaction Component like any normal Widget Interaction Component (see: Unreal Engine Documentation ) Which means we can do a lot of stuff with it. In our example we implement a pointer key press and release.\
Hit play and you will be able to hoer and click the buttons.\
That's the getting started Have fun and have a look onto my [Youtube Channel](https://www.youtube.com/@suricoon) for more tutorial, which will be added from time to time!