Unreal Engine Diaries #6
- In the editor, you can select actors from the 'World Outliner' panel, right click and select 'Move To' >> 'Create New Folder' to group your actors into a folders.
- The 'Project World to Screen' function can be used to check if any point in world space lies within the screen space of a player's camera view. Just pass on the said world location and the player controller reference as input parameters and you can get the corresponding screen position data as the output. Break this struct into it's x and y values, then use the 'Get Viewport Size' node to get the actual screen bounds and check it the aforementioned screen position values lie within 0 and the screen bounds values that we just received using the viewport size. If both x and y values lie within this range, then the point is within the visible screen space, else it's outside the camera view.
- When adding a vector to an actor's world space location to get the vector result of a location near the actor, do not add them using the values that you'd want to increase in the x, y and z directions. It only works in the relative location calculations. What you see as the forward direction in the actor blueprint viewport may not be the same as the forward direction in the world. So in this case, what we need to do is get the forward, right and up vectors. Then multiply them with the required distance along each direction and add/subtract this vectors from the main world space location.
- The console commands 'stat startfile' and 'stat stopfile' can be used to record the performance stats of all gameplay logic that happens between the commands. On completion, it saves the data to a new file in the HDD. In order to retrieve this data, go to the 'Windows' tab in the editor >> Developer Tools >> Session FrontEnd >> Profiler Tab and click on the 'Load' Button. It'll take you to the folder location where the file was saved. Open the most recent file in the folder to see the visual representation of the performance stats of the CPU [Game & Rendering thread] as a graph in the editor. Select any part of the graph where it's spiking and see all the game logic and rendering processes that's being called within that timeframe, to get an idea of what's causing the performance drops in your project.