[UE5 Cesium] 11-Cesium for Unreal switch Dynamic Pawn to other Pawn

foreword

        We know that DynamicPawn is used by default in Cesium for Unreal to browse the map scene. DynamicPawn is suitable for global browsing and can fly according to custom curves. However, DynamicPawn uses a geographic reference coordinate system, not a standard UE coordinate system. After we browse the world, we may need to browse in a certain place, which may involve switching Pawn operations.

Effect

When using DynamicPawn to fly to another location, click the switch control button to switch to a custom Pawn

step

1. First find a Pawn suitable for browsing buildings, and migrate it to the current Cesium project.

Search for "ArchViz Explorer" in the Unreal Marketplace and create the project.

2. After creation, open the project and run it. You can find that the left mouse button can be used to rotate up, down, left, and right around the center of the viewing angle. The right mouse button can be used to pan the viewing angle left and right.

3. Find the level "Demonstration_01" and click Migrate

 Uncheck "Environment", '"Meshes", "SunPosition"', because they are not used.

 Select the Content folder of the target project

 When you see the following prompt, the migration is successful.

4. Open the Cesium project, you can see the following migrated files after migration, open the "BP_Explorer_Pawn" in it

 After opening the blueprint, you can see the following warnings. The main reason for these warnings is that the imported project has not set operation mapping and axis mapping.

 5. Open the project settings of the project before import, you can see that some operation mapping and axis mapping are set here

 Click the export button

 Save to the "Saved-"Config-"WindowsEditor" folder of the Cesium project

 6. Go back to the Cesium project, open the project settings, and click the import button

Choose to open the configuration file you just saved 

 At this point the Cesium project has the same operation mapping and thus axis mapping.

In the map and mode in the project settings, set the default game mode to "BP_Explorer_GameMode", the default Pawn class to "BP_Explorer_Pawn", and the player controller class to "BP_Explorer_PlayerController"

 Game instance class select "BP_Explorer_GameInstance"

7. Recompile "BP_Explorer_Pawn", you can see that the compilation is successful.

8. Create a new control blueprint, here named "BPW_SwitchPawn", open the control blueprint

 Add a button control to the lower right corner of the canvas panel

When the button is clicked, switch to control different Pawns

Set to display the control blueprint in the level blueprint

9. If you do not want to display the migrated UI interface, you can open "BP_MasterMenu_Widget"

Set the visibility of UI controls you don't want to display to hidden

10. Drag "BP_Explorer_Pawn" into the viewport

The running effect is as shown at the beginning of the article.

Guess you like

Origin blog.csdn.net/ChaoChao66666/article/details/131555266