I apologize for the abrupt ending in my previous response. I'll continue by explaining how to attach the TopDownCamera Blueprint to your player character and make adjustments for better camera control.
- In the Content Browser, create a new Blueprint Class by right-clicking and selecting "Blueprint Class." Choose "Character" as the parent class and name it "MyCharacter."
- Open the MyCharacter Blueprint and add a "Scene Component" named "CameraBoom." Set its location to (0, 0, 0) and rotation to (0, -90, 0).
- Add a "Static Mesh" component named "CharacterMesh." Set its location to (0, 0, 0) and rotation to (0, 0, 0). Assign a mesh for your character.
- In the Event Graph, add an "Event BeginPlay" node.
- Add a "Spawn Actor From Class" node and connect it to the "Event BeginPlay" node. Set the Class input to the TopDownCamera Blueprint.
- Add a "Set Actor Location" node and connect it to the "Spawn Actor From Class" node. Set the Location input to (0, 0, 200).
- Add a "Set Actor Parent" node and connect it to the "Spawn Actor From Class" node. Set the New Parent input to the "CameraBoom" component.
Now, the TopDownCamera Blueprint is attached to the MyCharacter Blueprint, and it will follow the character during gameplay.
To improve the camera control, you can add a simple input for adjusting the camera height.
- In the MyCharacter Blueprint, add an "Event Blueprint Update Animation" node.
- Add a "Get Player Controller" node and connect it to the "Event Blueprint Update Animation" node.
- Add a "Get World Location" node and connect it to the "Get Player Controller" node. Set the First Person Camera location as the Target input.
- Add a "Set Actor Location" node and connect it to the "Get World Location" node. Set the Actor input to the TopDownCamera Blueprint.
- Add a "Get Player Controller" node and connect it to the "Event Blueprint Update Animation" node.
- Add a "Get Control Rotation" node and connect it to the "Get Player Controller" node.
- Add a "Make Rotator" node and connect it to the "Get Control Rotation" node. Set the Pitch input to 0.
- Add a "RInterp To" node and connect it to the "Make Rotator" node. Set the Target input to the "TargetRotationOffset" from the TopDownCamera Blueprint's FollowTimeline.
- Add a "Set Timer by Function Name" node and connect it to the "RInterp To" node. Set the Function Name input to "AdjustCameraHeight."
- Add an "AdjustCameraHeight" function node and connect it to the "Set Timer by Function Name" node.
- Inside the "AdjustCameraHeight" function, add a "Get Player Controller" node and connect it to the "Event BeginPlay" node.
- Add a "Get World Location" node and connect it to the "Get Player Controller" node. Set the First Person Camera location as the Target input.
- Add a "Get Control Rotation" node and connect it to the "Get Player Controller" node.
- Add a "Make Rotator" node and connect it to the "Get Control Rotation" node. Set the Pitch input to 0.
- Add a "RInterp To" node and connect it to the "Make Rotator" node. Set the Target input to the "TargetRotationOffset" from the TopDownCamera Blueprint's FollowTimeline.
- Add a "Get Player Controller" node and connect it to the "Event BeginPlay" node.
- Add a "Get Control Rotation" node and connect it to the "Get Player Controller" node.
- Add a "Make Rotator" node and connect it to the "Get Control Rotation" node. Set the Pitch input to 90.
- Add a "RInterp To" node and connect it to the "Make Rotator" node. Set the Target input to the "TargetLocationOffset" from the TopDownCamera Blueprint's FollowTimeline.
Now, the camera will adjust its height based on the player's input. You can further refine the camera behavior by adding smoothing, limiting the camera height, or adding other input actions.
Keep in mind that this is still a basic example, and you might need to adjust the settings and logic to fit your specific game requirements.