UE5-based object selection view angle switching method during operation
By introducing an object-selecting perspective switching method during UE5 operation, the problems of insufficient flexibility and inefficiency in traditional three-dimensional engine development are solved, precise perspective switching and role positioning are achieved, and user interaction experience is improved.
Patent Information
- Application Number
- CN202411945325.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-11
AI Technical Summary
There are problems in the development of traditional three-dimensional engines, such as insufficient flexibility, low data processing efficiency, inaccurate role positioning and lack of multi-terminal synchronization mechanisms.
The object-selecting perspective switching method is adopted based on the UE5 operation time, and the camera smooth transition, viewing angle switching and character position setting is realized through the asset module, UI module and visual switching and control module.
It improves the flexibility and operation efficiency of scene construction, realizes accurate perspective switching and role positioning, and enhances the interactivity and immersion between users and three-dimensional scenes.
Smart Images

Figure CN119806341A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital twin technology, and in particular to a method for switching object viewing angles based on UE5 runtime. Background Art
[0002] With the rapid development of digital twin technology, 3D visualization has become an indispensable technical tool in the fields of smart cities, industrial manufacturing, architectural design, etc. Through 3D engines (such as Unreal Engine5 or Unity), developers can create realistic virtual scenes, support complex data interaction and real-time dynamic updates. In the development process of traditional 3D engines, the objects that need to be displayed in the scene are usually developed independently, and the viewing angle distance is adjusted according to the size of different objects. This means that developers need to adjust a large number of objects that need to be displayed separately and embed them into the project during the design stage.
[0003] The prior art has the following technical problems when used:
[0004] Problem 1: In traditional 3D engine development, a large number of display objects need to be individually adjusted and embedded into the project during the design phase. Each adjusted Actor must be placed in the appropriate corresponding position in the scene, which is cumbersome and lacks flexibility.
[0005] Problem 2: In the past, each object had to be adjusted to a suitable viewing distance independently. This process was time-consuming and labor-intensive, and it was difficult to quickly process a large number of interactions, resulting in low overall processing efficiency.
[0006] Problem three: In situations involving interaction between characters and scenes, traditional technology is difficult to accurately and efficiently locate the position of characters. Especially when there are a large number of objects and obstacles in complex scenes, unreasonable character positions can easily affect the logic and visual effects of the scene, and there is a lack of effective multi-terminal synchronization mechanisms. Summary of the invention
[0007] Technical issues solved
[0008] In view of the shortcomings of the prior art, the present invention provides a method for switching the perspective of an object based on UE5 runtime, which solves the following problems:
[0009] 1. Solved the problem of insufficient flexibility in traditional 3D engine development;
[0010] 2. Solved the problem of inefficiency caused by repeated adjustments in the data processing process;
[0011] 3. Solved the problems of role positioning and insufficient system scalability.
[0012] Technical Solution
[0013] To achieve the above objectives, the present invention is implemented through the following technical solutions: a method for switching the perspective of an object based on UE5 runtime selection, the perspective switching method includes an asset module, a UI module and a visual switching and control module, and the steps of the perspective switching method are as follows:
[0014] Sp1: Initialize the asset module, create the base class Actor, bind mouse events and other basic operations;
[0015] Sp2: The UI module creates and initializes the UI interface, binds related buttons and display logic;
[0016] Sp3: The view switching and control module performs camera settings and initial calculations based on the information transmitted by the asset module;
[0017] Sp4: When there is an interactive operation, the asset module triggers an event and passes it to the perspective switching and control module;
[0018] Sp5: The perspective switching and control module performs smooth camera transition and perspective switching based on the interaction information;
[0019] Sp6: If the role position changes, the perspective switching and control module searches and sets the role position and synchronizes it through RPC.
[0020] Preferably, the asset module further comprises the following steps:
[0021] Sp1: Create the base class Actor: First create an Actor as a base class to build a framework for subsequent components and functions;
[0022] Sp2: Event and mouse interaction processing: When the event starts running, get the components by class and traverse them, bind the mouse click event, write macros to distinguish single-click and double-click operations, and handle different logics respectively. When the mouse click occurs, call the event distributor and pass in the model information clicked, so that the click event can be uniformly processed and distributed later;
[0023] Sp3: Object details panel settings: Create a hidden object details panel, determine the position of the panel by obtaining the height of the object's bounding box, and save the world position of the object. In this way, when you double-click to focus on the object, you can use the saved position information to exit the current mode and generate a character or perform other related operations at the appropriate position around the corresponding object;
[0024] Sp4: Stop Stroke Component: Create a component specifically for handling mouse hover stroke. After obtaining the component by class, set the stroke color, style and other properties according to the object tag. Enable the stroke effect when the mouse starts hovering and cancel the stroke when the mouse ends, enhancing the visual interaction effect of the object in the scene.
[0025] Sp5: Function configuration: Use the Tag tag to configure, decide whether to enable the details panel and set whether to enable the stroke function for the object, providing a flexible function control mechanism.
[0026] Preferably, the UI module further comprises the following steps:
[0027] Sp1: UI creation and button binding: Create a UI interface and add multiple buttons. Bind these buttons to the functions of switching the UI and displaying the type selection panel when entering a specific mode, providing users with an intuitive operation entry.
[0028] Sp2: Type selection display logic: When the type button is pressed, the corresponding details panel can pop up according to the specified type field custom calibrated in the model or the class information in the UE, realizing the function of filtering and displaying object details by type.
[0029] Preferably, the visual switching and control module further includes the following contents:
[0030] Sp1: Camera Actor Setup: Create a new Actor that contains the camera and asset module child actors, traverse all child actors and bind the event dispatcher to receive model information from the asset module;
[0031] Sp2: Camera position calculation: The camera position is accurately calculated through the model passed by the distributor, the maximum XY value of the model boundary is obtained and multiplied by the coefficient to limit the maximum and minimum values to determine the horizontal distance between the camera and the model; the Z-axis value of the model boundary is obtained and divided by the coefficient to set the height of the viewing angle. The coefficient can be modified uniformly for the same type according to the model tag or modified separately for a single model. This algorithm is encapsulated into a pure function and the target position of the camera can be returned by passing it into the model;
[0032] Sp3: Smooth camera transition: Use the timer to smoothly transition the relative position of the camera to the clicked object. During the transition, gradually adjust the camera position according to the set time interval. When the camera reaches the specified position, the timer is destroyed to ensure the smoothness and naturalness of the perspective switching.
[0033] Sp4: View switching method call: When the view needs to be switched, call the SetViewTargetwithBlend method, pass in the target camera to be switched to, and set the jump duration, so as to achieve a smooth switch to the target camera view, providing users with a seamless view switching experience;
[0034] Sp5: Camera control logic component: Create a component for writing camera control logic, record the values generated by the left mouse button, mouse XY axis movement, mouse wheel and other operations and store them as variables, and save some related data at the same time. Mount the component on the player controller to make it an independent input event module. By obtaining the stored variable parameters, set the camera's XY axis movement and the wheel to control the camera's distance from the target, and realize flexible camera control functions;
[0035] Sp6: Character position setting: Go to the vicinity of the selected object, write a function to find a suitable position, pass in the transmission position, and perform a loop search. In the loop, generate a character at a position with a random offset of X from the specified position and check whether there is a collision. If there is a collision after multiple searches, give a corresponding prompt or directly use the last position for forced setting. Then set the position on the server and client through RPC (remote procedure call) to ensure the accuracy and consistency of the character position.
[0036] Preferably, in the asset module, the event distributor adopts an efficient event distribution mechanism to ensure timely and accurate transmission of mouse click events in multi-object and complex scenes, and the average delay time of event transmission does not exceed 5 milliseconds to ensure the real-time and smoothness of the interaction.
[0037] Preferably, the UI interface layout created by the UI module follows the design principles of simplicity, intuitiveness and ease of operation. The layout of each button and display area conforms to ergonomics and visual habits, and the response time of the UI interface is within 10 milliseconds, ensuring the timeliness of user operation feedback.
[0038] Preferably, the timer setting used for the smooth transition of the camera in the visual switching and control module can automatically adjust the time interval according to the scene complexity and hardware performance. On low-performance devices, the time interval is automatically increased to avoid lag, and on high-performance devices, the time interval is reduced to enhance the delicacy of the transition effect. The time interval adjustment range is 0.02-0.1 seconds.
[0039] Preferably, in the camera position calculation of the perspective switching and control module, the coefficients used to calculate the distance between the camera and the model and the perspective height are preset with default values according to the size and visual effects of common scene objects, and can be modified through a visual configuration interface without writing code, making it convenient for artists and planners to adjust the scene.
[0040] Beneficial Effects
[0041] The present invention provides a method for switching the perspective of an object based on UE5 runtime. It has the following beneficial effects:
[0042] 1. The functional configuration of the asset module of the present invention is realized by using the Tag tag, which can conveniently determine whether to enable the details panel and whether to enable the stroke function of the object, without tedious code modification or complex scene object adjustment. For example, in the digital twin project, facing a large number of different types of interactive objects, the display and interaction details of each object can be easily customized according to the needs, which greatly enhances the flexibility of scene construction, avoids the inconvenience of placing and carefully adjusting each Actor one by one in the traditional way, and effectively reduces the workload and time cost of art and program in scene layout. The UI module creates an intuitive UI interface and binds related buttons and display logic. In particular, pressing the type button can pop up the details panel according to the model calibration information or UE class information, realizing the function of fast type screening and display of object details. Whether it is the large-scale scene monitoring display in smart cities or the display and management of various building components in architectural design, users can quickly locate and obtain the detailed information of the required objects without manual search in the complex scene hierarchy, which greatly improves the convenience and efficiency of operation, making scene display and interaction more flexible and efficient.
[0043] 2. The present invention uses the camera position calculation in the visual switching and control module through the encapsulated pure function, based on the model boundary data and the flexibly adjustable coefficient, to accurately calculate the distance and viewing angle height between the camera and the model, and the coefficient can be unified or individually customized according to the model label. This makes it easy to obtain the best camera viewing angle setting in scenes of different scales and types, such as large industrial manufacturing scenes showing fine equipment or small building interior space display, avoiding the inefficient operation of adjusting the viewing angle distance for each object independently in the traditional way, significantly improving the accuracy and flexibility of viewing angle switching, and bringing users an immersive scene browsing experience. The camera smoothly transitions with the help of a timer to achieve a smooth transition of the relative position to the clicked object, and destroys the timer after the transition is completed. Combined with the SetViewTargetwithBlend method, seamless viewing angle switching is achieved, and the camera control logic component can flexibly control the camera movement according to the mouse operation record variable. When displaying a custom scene, whether the user quickly switches the viewing angle to observe the scene layout, or carefully checks the details of the object to perform zooming and rotation operations, they can enjoy a smooth and natural viewing angle switching effect, just like freely moving and observing in a real scene, which greatly enhances the interactivity and immersion of the user and the three-dimensional scene.
[0044] 3. The present invention adopts a character position setting component to find a suitable position near the selected object to place the character through a cyclic search and collision detection mechanism, and ensures the synchronization of the server and client positions through RPC. In the multi-person collaboration scenario of the digital twin project or the personnel path simulation scenario of complex architectural design, the character can be accurately positioned in the appropriate position to avoid scene logic confusion or visual conflict caused by unreasonable character position, effectively improving the accuracy and reliability of the interaction between the character and the scene objects, and ensuring the stability and integrity of the entire scene simulation or interaction system. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 It is a diagram of the method steps of the present invention;
[0046] Figure 2 A diagram of a method for switching viewing angles according to the present invention;
[0047] Figure 3 This is a diagram showing the change of the camera smooth transition time interval with the device performance of the present invention;
[0048] Figure 4 It is the distribution diagram of the viewing angle height coefficient of different types of objects of the present invention;
[0049] Figure 5 A comparison chart of the scene arrangement workload with and without functional configuration optimization of the present invention. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Specific embodiment one:
[0052] like Figures 1 to 5 As shown, a method for switching the perspective of an object based on UE5 runtime selection is provided. The perspective switching method includes an asset module, a UI module, and a visual switching and control module. The steps of the perspective switching method are as follows:
[0053] Sp1: Initialize the asset module, create the base class Actor, bind mouse events and other basic operations;
[0054] Sp2: The UI module creates and initializes the UI interface, binds related buttons and display logic;
[0055] Sp3: The view switching and control module performs camera settings and initial calculations based on the information transmitted by the asset module;
[0056] Sp4: When there is an interactive operation, the asset module triggers an event and passes it to the perspective switching and control module;
[0057] Sp5: The perspective switching and control module performs smooth camera transition and perspective switching based on the interaction information;
[0058] Sp6: If the role position changes, the perspective switching and control module searches and sets the role position and synchronizes it through RPC.
[0059] This method is built based on Unity5. It not only effectively solves the limitations of the traditional 3D engine development process, improves its own application efficiency in digital twin engineering and custom scene display, but also provides new technical ideas and reference examples for other 3D engines such as Unity. This good system integration and scalability will help promote the development and innovation of the entire 3D visualization technology field, promote the exchange and integration of technologies between different engines, and provide developers with a broader range of technical choices and optimization space in multi-engine application scenarios, accelerate the project development process and improve the quality of the final product. Specific embodiment 2:
[0061] like Figures 1 to 5 As shown, according to the contents in the above specific embodiments, the following contents are further disclosed:
[0062] The asset module further includes the following steps:
[0063] Sp1: Create the base class Actor: First create an Actor as a base class to build a framework for subsequent components and functions;
[0064] Sp2: Event and mouse interaction processing: When the event starts running, get the components by class and traverse them, bind the mouse click event, write macros to distinguish single-click and double-click operations, and handle different logics respectively. When the mouse click occurs, call the event distributor and pass in the model information clicked, so that the click event can be uniformly processed and distributed later;
[0065] Sp3: Object details panel settings: Create a hidden object details panel, determine the position of the panel by obtaining the height of the object's bounding box, and save the world position of the object. In this way, when you double-click to focus on the object, you can use the saved position information to exit the current mode and generate a character or perform other related operations at the appropriate position around the corresponding object;
[0066] Sp4: Stop Stroke Component: Create a component specifically for handling mouse hover stroke. After obtaining the component by class, set the stroke color, style and other properties according to the object tag. Enable the stroke effect when the mouse starts hovering and cancel the stroke when the mouse ends, enhancing the visual interaction effect of the object in the scene.
[0067] Sp5: Function configuration: Use the Tag tag to configure, decide whether to enable the details panel and set whether to enable the stroke function for the object, providing a flexible function control mechanism.
[0068] In the asset module, the event distributor adopts an efficient event distribution mechanism to ensure the timely and accurate transmission of mouse click events in multi-object and complex scenes. The average delay time of event transmission does not exceed 5 milliseconds to ensure the real-time and smoothness of interaction. The functional configuration of the asset module is implemented using the Tag tag, which can conveniently decide whether to enable the details panel and set whether to enable the stroke function for the object. There is no need for tedious code modification or complex scene object adjustment. For example, in the digital twin project, faced with a large number of different types of interactive objects, the display and interaction details of each object can be easily customized according to needs, which greatly enhances the flexibility of scene construction and avoids the inconvenience of placing and carefully adjusting each Actor one by one in the traditional way, effectively reducing the workload and time cost of art and programming in scene layout.
[0069] The UI module further includes the following steps:
[0070] Sp1: UI creation and button binding: Create a UI interface and add multiple buttons. Bind these buttons to the functions of switching the UI and displaying the type selection panel when entering a specific mode, providing users with an intuitive operation entry.
[0071] Sp2: Type selection display logic: When the type button is pressed, the corresponding details panel can pop up according to the specified type field custom calibrated in the model or the class information in the UE, realizing the function of filtering and displaying object details by type.
[0072] The UI interface layout created by the UI module follows the design principles of simplicity, intuitiveness and ease of operation. The layout of each button and display area conforms to ergonomics and visual habits, and the response time of the UI interface is within 10 milliseconds to ensure the timeliness of user operation feedback. The I module creates an intuitive UI interface and binds related buttons and display logic. In particular, pressing the type button can pop up the details panel based on the model calibration information or UE class information, realizing the function of quickly filtering and displaying object details by type. Whether it is the large-scale scene monitoring display in smart cities or the display and management of various building components in architectural design, users can quickly locate and obtain detailed information on the required objects without manual search in complex scene hierarchies, which greatly improves the convenience and efficiency of operation and makes scene display and interaction more flexible and efficient.
[0073] The visual switching and control module further includes the following:
[0074] Sp1: Camera Actor Setup: Create a new Actor that contains the camera and asset module child actors, traverse all child actors and bind the event dispatcher to receive model information from the asset module;
[0075] Sp2: Camera position calculation: The camera position is accurately calculated through the model passed by the distributor, the maximum XY value of the model boundary is obtained and multiplied by the coefficient to limit the maximum and minimum values to determine the horizontal distance between the camera and the model; the Z-axis value of the model boundary is obtained and divided by the coefficient to set the height of the viewing angle. The coefficient can be modified uniformly for the same type according to the model tag or modified separately for a single model. This algorithm is encapsulated into a pure function and the target position of the camera can be returned by passing it into the model;
[0076] Sp3: Smooth camera transition: Use the timer to smoothly transition the relative position of the camera to the clicked object. During the transition, gradually adjust the camera position according to the set time interval. When the camera reaches the specified position, the timer is destroyed to ensure the smoothness and naturalness of the perspective switching.
[0077] Sp4: View switching method call: When the view needs to be switched, call the SetViewTargetwithBlend method, pass in the target camera to switch to, and set the jump duration, so as to achieve a smooth switch to the target camera view, providing users with a seamless view switching experience;
[0078] Sp5: Camera control logic component: Create a component for writing camera control logic, record the values generated by the left mouse button, mouse XY axis movement, mouse wheel and other operations and store them as variables, and save some related data at the same time. Mount the component on the player controller to make it an independent input event module. By obtaining the stored variable parameters, set the camera's XY axis movement and the wheel to control the camera's distance from the target, and realize flexible camera control functions;
[0079] Sp6: Character position setting: Go to the vicinity of the selected object, write a function to find a suitable position, pass in the transmission position, and perform a loop search. In the loop, generate a character at a position with a random offset of X from the specified position and check whether there is a collision. If there is a collision after multiple searches, give a corresponding prompt or directly use the last position for forced setting. Then set the position on the server and client through RPC (remote procedure call) to ensure the accuracy and consistency of the character position.
[0080] The timer setting used for the smooth transition of the camera in the visual switching and control module can automatically adjust the time interval according to the scene complexity and hardware performance. On low-performance devices, the time interval automatically increases to avoid jamming. On high-performance devices, the time interval is reduced to improve the delicateness of the transition effect. The time interval adjustment range is 0.02-0.1 seconds. In the camera position calculation of the perspective switching and control module, the coefficient used to calculate the distance between the camera and the model and the perspective height is preset according to the size and visual effects of common scene objects, and can be modified through a visual configuration interface without writing code, which is convenient for artists and planners to adjust the scene. The camera position calculation in the visual switching and control module is encapsulated by pure Function, based on the model boundary data and flexibly adjustable coefficients, can accurately calculate the distance and viewing angle height between the camera and the model, and the coefficients can be unified or customized according to the model tag. This makes it easy to obtain the best camera viewing angle settings in scenes of different scales and types, such as large industrial manufacturing scenes displaying fine equipment or small building interior spaces. It avoids the inefficient operation of adjusting the viewing angle distance for each object independently in the traditional way, significantly improves the accuracy and flexibility of viewing angle switching, and brings users an immersive scene browsing experience. The machine smooth transition uses a timer to achieve a smooth transition of the relative position to the clicked object, and destroys the timer after the transition is completed. Combined with SetViewTargetwithB l end method realizes seamless perspective switching. At the same time, the camera control logic component can flexibly control the camera movement according to the mouse operation record variables. When displaying custom scenes, users can enjoy smooth and natural perspective switching effects whether they quickly switch perspectives to observe the scene layout or carefully view the details of objects for zooming and rotating. It is like freely moving and observing in real scenes, which greatly enhances the interactivity and immersion of users with three-dimensional scenes. The character position setting component uses a loop search and collision detection mechanism to find a suitable position near the selected object to place the character, and ensures the synchronization of the server and client positions through RPC. In the multi-person collaboration scenario of the digital twin project or the personnel path simulation scenario of complex architectural design, the character can be accurately positioned in the appropriate position to avoid scene logic confusion or visual conflict caused by unreasonable character position, effectively improving the accuracy and reliability of the interaction between the character and the scene objects, and ensuring the stability and integrity of the entire scene simulation or interaction system. Specific embodiment three:
[0082] like Figures 1 to 5 As shown, based on the contents in the above specific embodiments, the following contents are further disclosed:.
[0083] The above-mentioned whole perspective switching method further includes the following algorithm content:
[0084] The algorithms related to the asset module mainly involve steps such as creating the base class Actor to build the framework, handling events and mouse interactions, setting the body details panel, creating hover stroke components, and performing function configuration. Through these operations, the basic interactive settings of objects in the scene and flexible function control are realized;
[0085] Event and mouse interaction processing algorithm:
[0086] Implementation steps: When the event starts running, get the components by class and traverse them, bind the mouse click event, write a macro to distinguish single-click and double-click operations, and handle different logics respectively. When the mouse click occurs, call the event dispatcher and pass in the model information clicked;
[0087] Operation logic: find the corresponding mouse click event binding point by traversing the components, use macros to determine the click type, and then pass the relevant model information to the event distributor, so that these click events can be processed and distributed uniformly in the future to ensure the accuracy and orderliness of the interaction;
[0088] Beneficial effects: It can accurately distinguish different mouse click operations, reasonably handle interactive events of multiple objects in complex scenarios, improve the real-time and smoothness of the interaction, and facilitate the implementation of diversified functional responses for different click situations, such as focusing on objects, popping up detail panels, etc.
[0089] Volume details panel setting algorithm: mainly determines the position of the panel by obtaining the height of the object's bounding box and saves the object's world position. Here, "the height of the object's bounding box" refers to the size of the object's bounding box (bounding box) in the vertical direction (usually the Z-axis direction) in the three-dimensional space. This size-related information is used to determine the specific placement of the panel in space; "the world position of the object" is the coordinate position of the object in the world coordinate system of the entire scene, which is saved for subsequent operations (such as generating a character at a suitable position around the corresponding object after exiting the mode);
[0090] Implementation steps: Create a hidden object details panel, get the object's bounding box height to determine its position, and save the object's world position;
[0091] Operation logic: Arrange the display position of the details panel reasonably according to the spatial size and location information of the object itself, so as to perform related operations according to the saved location information later, such as generating characters at appropriate locations, etc., to achieve more reasonable scene interaction logic;
[0092] Beneficial effects: It is convenient to implement subsequent related functions based on the saved information when focusing on an object, etc., which enhances the coherence and rationality of scene interaction and avoids the interaction inconvenience caused by randomly placing panels.
[0093] Hover stroke component algorithm:
[0094] Implementation steps: Create a component specifically for handling mouse hover strokes. After obtaining the component by class, set the stroke color, style and other properties according to the object tag. Enable the stroke effect when the mouse starts hovering and cancel the stroke when the mouse ends hovering.
[0095] Operation logic: By identifying object tags, the corresponding stroke attributes are configured for different objects in a targeted manner, and the display and hiding of the stroke effect are accurately controlled when the mouse hover action occurs and ends, thereby enhancing the visual interaction effect of the object in the scene;
[0096] Beneficial effects: Allow users to more intuitively identify objects that the mouse is hovering over in the scene, improve the visualization of the interaction, and facilitate quick positioning and differentiation of different objects in complex scenes.
[0097] Function configuration algorithm:
[0098] Implementation steps: Use the Tag tag to configure, decide whether to enable the details panel and set whether to enable the stroke function for the object;
[0099] Operation logic: Based on the tag content set for the object, the details panel and stroke function are simply and quickly controlled to enable or not, thus realizing a flexible function control mechanism;
[0100] Beneficial effects: The display and interaction details of each object can be easily customized without complicated code modification, which greatly reduces the workload and time cost of artists and programmers in scene layout and enhances the flexibility of scene construction.
[0101] The UI module-related algorithms include UI creation and button binding as well as type selection and display logic, which aims to provide users with an intuitive operation entry and implement the function of filtering and displaying object details by type;
[0102] UI creation and button binding algorithm:
[0103] Implementation steps: Create a UI interface and add multiple buttons, and bind these buttons to the functions of switching the UI and displaying the type selection panel when entering a specific mode;
[0104] Operation logic: layout buttons on the created UI interface, and associate the button click and other operations with the corresponding function implementation, so that when the user clicks the button, the corresponding UI switching or panel display functions can be triggered;
[0105] Beneficial effects: Provide users with an intuitive operation portal, allowing them to quickly perform related operations in the scene, thereby improving the convenience and efficiency of operations.
[0106] Type selection displays the logic algorithm:
[0107] Implementation steps: When the type button is pressed, the corresponding details panel can be popped up according to the specified type field of the custom calibration in the model or the class information in the UE;
[0108] Operation logic: According to the type identification defined by the model itself or the class-related information in the UE, the corresponding object details are accurately filtered out and displayed in the pop-up panel when the button is pressed, realizing the function of filtering and displaying object details by type;
[0109] Beneficial effects: Whether in large-scale or complex structure scenes, users can quickly locate and obtain detailed information of the required objects without manually searching in complex scene hierarchies, which greatly improves the convenience and efficiency of operations and makes scene display and interaction more flexible and efficient.
[0110] Visual switching and control module related algorithms: covering camera Actor settings, camera position calculation, camera smooth transition, view switching method call, camera control logic component creation, and character position settings, etc., mainly used to achieve accurate camera view settings, smooth view switching, and reasonable character position placement, etc.
[0111] The formula for calculating the horizontal distance between the camera and the model is: Horizontal distance = Get the maximum XY value of the model boundary * coefficient (the coefficient can be modified uniformly for the same type or individually for a single model according to the model tag), and limit the maximum and minimum values. Here, "the maximum XY value of the model boundary" means the maximum coordinate value of the bounding box boundary of the object on a two-dimensional plane (usually the plane formed by the X and Y axes). The appropriate horizontal distance is adjusted by multiplying the coefficient, and then the maximum and minimum values are limited to ensure that the distance is within a reasonable range;
[0112] The formula for calculating the viewing angle height is: viewing angle height = Z-axis value of the model boundary / coefficient. The "Z-axis value of the model boundary" is the relevant value of the boundary of the object's bounding box in the vertical direction (Z axis). Divide it by the coefficient to determine the appropriate height of the viewing angle. Similarly, the coefficient can be flexibly modified to adapt to different scenes and objects. This algorithm is encapsulated into a pure function and passed into the model to return the target position of the camera.
[0113] Implementation steps: Use the model delivered by the distributor to accurately calculate the camera position, calculate the horizontal distance and viewing angle height according to the above formula, and then determine the target position of the camera;
[0114] Operation logic: Based on the spatial boundary data of the object itself, combined with the flexibly adjustable coefficients, the camera's position is accurately calculated, so that the best viewing angle setting can be obtained in scenes of different scales and types, avoiding the inefficient operation of adjusting the viewing angle distance for each object independently in the traditional way;
[0115] Beneficial effects: The accuracy and flexibility of perspective switching have been significantly improved. Whether it is a large industrial manufacturing scene displaying fine equipment or a small building interior space display, it can easily adapt to the best perspective, bringing users an immersive scene browsing experience.
[0116] Camera smooth transition algorithm: mainly uses the timer to achieve a smooth transition of the camera's relative position to the clicked object. During the transition process, the camera position is gradually adjusted according to the set time interval. The timer is destroyed after reaching the specified position. The "time interval" can be automatically adjusted according to the scene complexity and hardware performance. The adjustment range is 0.02-0.1 seconds. On low-performance devices, the time interval is automatically increased to avoid lag, and on high-performance devices, the time interval is reduced to improve the delicacy of the transition effect.
[0117] Implementation steps: Set a timer, continuously adjust the camera position according to the set time interval, and destroy the timer after reaching the target position;
[0118] Operation logic: The camera position is gradually changed according to a certain rhythm through the timer to achieve a smooth transition from the current position to the target position. The time interval can be automatically adapted according to the device performance to ensure a smooth and natural transition effect under different hardware conditions.
[0119] Beneficial effects: The smoothness and naturalness of perspective switching are ensured, and combined with subsequent perspective switching methods, a seamless perspective switching experience is provided for users, which enhances the interactivity and immersion of users with three-dimensional scenes.
[0120] Perspective switching method calling algorithm:
[0121] Implementation steps: When you need to switch the perspective, call the SetViewTargetwithBlend method, pass in the target camera to switch to, and set the jump duration to achieve a smooth switch to the target camera perspective;
[0122] Operation logic: Use the SetViewTargetwithBlend method of UE5 to smoothly switch the current view to the target camera view according to the set jump duration to achieve seamless conversion of view.
[0123] Beneficial effects: It provides users with a smooth and natural perspective switching effect, just like freely moving and observing in a real scene, which greatly enhances the interactivity and immersion of users with the three-dimensional scene.
[0124] Camera control logic component algorithm:
[0125] Implementation steps: Create a component for writing camera control logic, record the values generated by the left mouse button, mouse XY axis movement, mouse wheel and other operations and store them as variables, save some related data at the same time, mount the component on the player controller to make it an independent input event module, and set the camera's XY axis movement and the wheel to control the camera's distance from the target by obtaining the stored variable parameters;
[0126] Operation logic: Real-time capture and storage of data generated by mouse-related operations. When the camera needs to be controlled, the camera's movement in the X and Y axis directions is adjusted based on these stored variables, and the distance between the camera and the target is controlled by the scroll wheel, thus achieving flexible camera control functions.
[0127] Beneficial effect: Users can quickly switch perspectives to observe the scene layout, or carefully view the details of objects and perform zooming and rotating operations, all of which can be easily achieved through mouse operations, which enhances the flexibility and convenience of camera control and improves the interactive experience between users and scenes.
[0128] Character position setting algorithm: mainly write a function to find a suitable position. After the transmission position is passed in, a loop search is performed. In the loop, a character is generated at a position with a random offset of X from the specified position and checked for collision. If there is a collision after multiple searches, a corresponding prompt is given or the last position is used for forced setting. Then the position is set on the server and client through RPC (remote procedure call);
[0129] Implementation steps: First, pass in the target position to start the search function, generate the character position according to the rules in the loop and detect collision, select the appropriate processing method based on the collision detection results, and finally synchronize the position through RPC;
[0130] Operation logic: By looping and trying different position generation methods and detecting collisions, we can ensure that the appropriate position for the character is found. We use RPC to ensure the consistency of the server and client positions, and avoid scene logic confusion or visual conflicts caused by unreasonable character positions.
[0131] Beneficial effects: In scenarios such as multi-person collaboration or personnel path simulation, the characters can be accurately positioned at appropriate locations, effectively improving the accuracy and reliability of the interaction between the characters and scene objects, and ensuring the stability and integrity of the entire scene simulation or interaction system.
[0132] In summary, the entire UE5 runtime-based object selection perspective switching method achieves many beneficial effects such as convenient and flexible scene interaction, accurate and smooth perspective switching, and reasonable and reliable character position setting through the collaborative work of these algorithms in each module, which improves the user's operating experience, interactivity and immersion in the three-dimensional scene. Specific embodiment four:
[0134] like Figures 1 to 5 As shown, based on the contents in the above specific embodiments, the following contents are further disclosed:.
[0135] The above perspective switching method, when actually used, further includes the following contents for selecting the perspective switching method of the object:
[0136] Asset Module
[0137] Event and mouse interaction processing: In addition to distinguishing between single-click and double-click operations, mouse operation events can be further expanded, such as mouse long-press events. When an object is long-pressed, a continuous information display function can be triggered, such as displaying more detailed attribute information of the object on the UI, including material composition, physical parameters, etc. This information can be pre-stored in a data structure associated with the object. The long-press time threshold can be set to about 1 second. When the long-press time exceeds this threshold, the event distributor passes the corresponding detailed attribute information to the UI module for display. When processing mouse click events for a large number of objects, in order to avoid delays or freezes in event processing, an event queue mechanism can be used. When mouse click events are triggered quickly and continuously, these events are put into the queue in the order of triggering, and then a dedicated event processing thread takes out the events from the head of the queue for processing, ensuring that each event can get an orderly and timely response, further improving the smoothness and stability of the interaction.
[0138] Object details panel settings: For the display position of the object details panel, in addition to the object bounding box height, the object's orientation information can also be considered. If the object has an obvious frontal orientation (for example, through specific component markings or model design conventions), the details panel can be set at a suitable position on the front of the object, and the size and transparency of the panel can be dynamically adjusted according to the distance from the object to the camera. When the distance is close, the panel is appropriately reduced and the transparency is reduced to avoid blocking too much of the object; when the distance is far, the panel is enlarged and the transparency is increased so that the user can clearly see the information on the panel. In order to improve the interactivity and immersion of the scene, after double-clicking to focus on the object and display the details panel, some transition animation effects can be added. For example, the panel slowly slides out from the edge of the object's bounding box and fades in. At the same time, the surrounding scene elements (except the focused object) can be appropriately blurred or darkened to highlight the focused object and its details panel. The duration of the animation can be set between 0.3-0.5 seconds to make the entire interaction process more natural and smooth.
[0139] Hover stroke component: The stroke color and style can be dynamically adjusted according to the state of the object or the scene environment. For example, when the object is selected, the stroke color can be changed to a striking red and bold style to clearly indicate the currently selected object; when the object has a certain relationship with other objects (such as parent-child relationship, interaction relationship, etc.), the stroke color can be changed to blue or other specific colors, and a dotted line style can be used to distinguish them, helping users to better understand the logical relationship between objects in the scene. The stroke effect can be enabled and disabled at the start and end of a simple mouse hover, and a gradient effect can be added to the stroke. When the mouse starts hovering, the stroke color gradually transitions from transparent to the set stroke color, and the transition time is set to about 0.2 seconds, making the stroke effect softer and more natural, enhancing the visual appeal and the delicacy of the interaction.
[0140] Function configuration: When using tags for function configuration, you can introduce a hierarchical structure of tags. For example, for objects of different areas or types in a large scene, you can set the parent tag to represent the area or large type, and the child tag to represent the specific function or attribute. In this way, when configuring the function, you can batch set all objects of a certain area or type at one time, or you can individually set an object with a special child tag, which greatly improves the flexibility and efficiency of function configuration. By adding a preview mode for function configuration, when artists or planners adjust the Tag configuration function, they can view the configuration effect in a separate preview window without actually applying it to the entire scene, which is convenient for timely adjustment and optimization of the configuration, and avoids scene loading and operation efficiency problems caused by repeated configuration modifications.
[0141] UI Module
[0142] UI creation and button binding: When creating a UI interface, in addition to considering the binding of buttons and functions, you should also pay attention to the adaptive layout design of the UI. For display devices with different resolutions (such as the common 1920x1080, 2560x1440, 3840x2160, etc.) and different display ratios (such as 16:9, 16:10, 21:9, etc.), buttons, panels and other elements in the UI interface can automatically adjust the size, position and spacing to ensure good visual effects and operational convenience on any device. You can use a layout based on percentages or relative coordinates and combine it with some adaptive frameworks or algorithms to achieve it. In order to improve the convenience of user operations, you can add some shortcut keys to associate with UI button functions. For example, pressing a specific keyboard shortcut can directly trigger the same function as a button. For example, pressing the "F" key is equivalent to clicking the focus object button, and the "T" key is equivalent to switching the type display button. In this way, users can reduce the frequency of mouse operations during operation and improve operational efficiency, especially in scenarios where certain operations need to be performed frequently.
[0143] Type selection display logic: When the details panel pops up based on the model calibration information or UE class information, a search function can be added. The user can enter keywords (such as object name, type name, specific attribute value, etc.) in the search box. The UI module will quickly search and match all model information in the background, and then only display the object details panel related to the search keyword, so that users can quickly locate specific objects or types among massive objects, further improving the search efficiency. For the display content and format of the details panel, a custom template function can be provided. Different types of users (such as designers, engineers, ordinary users, etc.) may have different concerns about object details information. Users are allowed to create or select different details panel templates according to their needs, decide which information to display, the order of information arrangement, and the display format (such as text, charts, pictures, etc.), so that the scene display and interaction are more personalized and in line with user needs.
[0144] Visual switching and control module
[0145] Camera Actor Settings: When creating a new Actor that contains a camera and an asset module child Actor, you can add some additional properties and functional components to the camera. For example, you can add a camera shake component. When a specific event occurs in the scene (such as explosions, earthquakes, and other simulated effects), the camera can produce a corresponding shake effect according to the set shake parameters (such as shake amplitude, frequency, duration, etc.) to enhance the realism and immersion of the scene. The shake amplitude can be dynamically adjusted according to the intensity of the event. For example, the greater the intensity of the explosion, the greater the camera shake amplitude. In order to better control the camera's field of view and occlusion in complex scenes, you can introduce camera clipping plane settings. By adjusting the distance between the near clipping plane and the far clipping plane, you can control the nearest and farthest objects that the camera can see, avoid unnecessary object drawing, and improve scene rendering efficiency. At the same time, you can dynamically adjust the position of the clipping plane according to the depth information of the scene. For example, when entering a narrow space, appropriately reduce the distance of the far clipping plane to reduce the drawing of distant objects and improve performance.
[0146] Camera position calculation: In calculating the distance between the camera and the model and the adjustment of the coefficient of the viewing angle height, in addition to type unification or individual customization based on the model tag, the lighting conditions of the scene can also be considered. In scenes with strong lighting and obvious reflections on the surface of objects, the distance coefficient between the camera and the object can be appropriately increased to avoid loss of object details or visual discomfort due to reflections; in scenes with darker lighting, the distance coefficient can be appropriately reduced to bring the camera closer to the object to highlight the outline and features of the object. For the viewing angle height coefficient, it can also be adjusted according to the terrain undulations of the scene. In scenes with large terrain undulations, the viewing angle height coefficient can be appropriately increased to better display the entire scene. For terrain features, an intelligent optimization algorithm for the camera position can be added. After calculating the initial camera position, the algorithm will further fine-tune and optimize the camera position based on factors such as the object distribution density in the scene, the location distribution of important objects, and the user's perspective history. For example, if the objects in a certain area of the scene are densely distributed and there are multiple important objects, the camera position will automatically adjust to a position that can better display these objects at the same time; if the user often pays attention to a specific area or object, the algorithm will tend to position the camera in a position that is more conducive to observing the area or object in subsequent perspective switches, thereby improving the user's browsing experience and scene display effect.
[0147] Camera smooth transition: During the camera smooth transition process, in addition to gradually adjusting the camera position according to the set time interval, the motion state of objects in the scene can also be considered. If there are objects in the scene that are moving quickly, the camera can appropriately adjust the transition speed and path during the transition process to avoid visual blur or discomfort caused by the incoordination between the camera movement and the object movement. For example, when an object moves quickly toward the camera, the camera can appropriately slow down the transition speed and slightly adjust the transition path so that the object always remains in the appropriate position within the camera's field of view, and the transition effect is more natural and smooth. In order to achieve a more delicate camera smooth transition effect, mathematical curves such as Bezier curves can be used to plan the camera's transition path. By setting the control points of the Bezier curve, the camera's transition trajectory from the starting position to the target position can be flexibly adjusted, so that it not only transitions smoothly in position, but also changes naturally in direction, further enhancing the visual effect and immersion of perspective switching.
[0148] Perspective switching method call: When calling the SetViewTargetwithBlend method to switch the perspective, you can add a perspective switching transition effect. For example, during the switching process, add a blurred gradient effect to the edge of the screen. When gradually transitioning from the current perspective to the target perspective, the blurred area gradually expands and eventually disappears. Or, use special effects such as rotation and scaling similar to movie lens switching to make the perspective switching process more creative and visually impactful, while also alleviating the visual discomfort that may be caused by sudden perspective switching. You can set a perspective switching priority system. When multiple perspective switching requests occur at the same time (for example, due to multiple interactive events being triggered at the same time), determine which perspective switching operation to execute first based on pre-set priority rules. The priority can be determined based on factors such as the importance of the event, the order of user operations, or the importance of the object in the scene, to ensure the rationality and orderliness of perspective switching in complex interactive scenes.
[0149] Camera control logic component: In the camera control logic component, in addition to recording the values generated by mouse operations, you can also add support for other input devices, such as game controllers, touchpads, etc. For game controllers, you can map different joysticks and button operations to control the movement, rotation, and zoom of the camera. For example, the left joystick controls the horizontal and vertical movement of the camera, the right joystick controls the rotation of the camera, and the shoulder buttons control the zoom of the camera. For touchpads, you can implement touch operations similar to those of a mouse to control the camera. At the same time, you can also add some touch gesture operations, such as two-finger zoom, three-finger rotation, etc., to provide users with more diverse camera control. In order to adapt to the operating habits and device usage scenarios of different users, an intelligent auxiliary function of camera control can be added. For example, when the user is observing a complex object or scene, the camera control logic component can automatically adjust the position and angle of the camera according to the structure of the object and the user's operating intention, so as to better display the details of the object or the overall picture of the scene. For example, when the user hovers the mouse pointer over a specific part of the object, the camera automatically zooms in and adjusts the angle to highlight the part; when the user moves the mouse quickly in the scene, the camera automatically adjusts the viewing angle and movement speed to provide a smoother browsing experience.
[0150] Character position setting: In the process of character position search and setting, in addition to simply randomly offsetting the X position to generate the character and check for collision, a path planning-based algorithm can also be used. First, the position relationship between the terrain, obstacles and target objects in the scene is analyzed, and then the optimal path from the current character position to the appropriate position near the target object is calculated based on some path planning algorithms (such as A* algorithm, Di jkstra algorithm, etc.). The character position is gradually generated along the path and the collision is checked. In this way, the appropriate character placement position can be found more accurately, especially in scenes with complex terrain and many obstacles. When synchronizing the character position through RPC, some data verification and error correction mechanisms can be added. Since network transmission may result in data loss or errors, after the client and server receive the character position information sent by the other party, data verification is performed, such as checking the rationality of the position coordinates, data integrity, etc. If data errors are found, they can be processed according to the pre-set error correction strategy, such as requesting to resend data, using the last correct position data, or estimating and correcting according to the scene information, etc., to ensure the consistency and accuracy of the character position on the server and client, and to ensure the stability of the entire scene simulation or interactive system.
[0151] Through the above in-depth supplements, the performance, interactivity, visual effects and user experience of the UE5 runtime-based object selection perspective switching method in actual use can be further optimized, so that it can better adapt to various complex scene requirements and user expectations.
[0152] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprising a reference structure" do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0153] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for switching the perspective of an object based on UE5 runtime, characterized in that: The following steps are involved: Sp1: Provide an asset module, initialize the asset module, create a base class Actor, bind mouse events and other basic operations; Sp2: Provide a UI module, create and initialize the UI interface for the UI module, and bind related buttons and display logic; Sp3: providing a visual switching and control module, which performs camera settings and initial calculations on the visual switching and control module according to information transmitted by the asset module; Sp4: When there is an interactive operation, an event is triggered through the asset module and transmitted to the perspective switching and control module; Sp5: Performing smooth camera transition and perspective switching according to the interactive information through the perspective switching and control module; Sp6: If the role position changes, the role position is searched and set through the perspective switching and control module and synchronized through RPC.
2. According to claim 1, a method for switching the perspective of an object based on UE5 runtime is characterized in that: The asset module system operation process includes the following steps: Sp1. Create the base class Actor, which includes: first create an Actor as a base class to build a framework for subsequent components and functions; Sp2. Process the event and mouse interaction, including: when the event starts running, get the components by class and traverse, bind the mouse click event, write macros to distinguish single-click and double-click operations, and handle different logics respectively. When the mouse click occurs, call the event distributor and pass in the model information clicked, so as to uniformly process and distribute the click event later; Sp3. Set up the object details panel, including: creating a hidden object details panel, determining the position of the panel by obtaining the height of the object's bounding box, and saving the world position of the object, so that when you double-click to focus on the object, you can use the saved position information to exit the current mode and generate a character or perform other related operations at a suitable position around the corresponding object; Sp4. Create a stop stroke component, including: creating a component specifically for handling mouse hover stroke, after obtaining the component by class, setting the stroke color, style and other properties according to the object tag, enabling the stroke effect when the mouse starts hovering, and canceling the stroke when the mouse ends hovering, to enhance the visual interaction effect of the object in the scene; Sp5. Perform function configuration, including: using Tag tags for configuration, deciding whether to enable the details panel and setting whether to enable the stroke function for the object, providing a flexible function control mechanism.
3. According to claim 1, a method for switching the perspective of an object selected based on UE5 runtime, characterized in that: The process of the system operation of the UI module includes the following steps: Sp1. UI creation and button binding: Create a UI interface and add multiple buttons. Bind these buttons to the functions of switching the UI and displaying the type selection panel when entering a specific mode, providing users with an intuitive operation entry; Sp2. Type selection display logic: When the type button is pressed, the corresponding details panel can pop up according to the specified type field custom calibrated in the model or the class information in the UE, realizing the function of filtering and displaying object details by type.
4. The method for switching the perspective of an object selected based on UE5 runtime according to claim 1, characterized in that: The operation process of the visual switching and control module system includes the following steps: Sp1. Camera Actor Setup: Create a new Actor that contains the camera and asset module child actors, traverse all child actors and bind event dispatchers to receive model information from the asset module; Sp2. Camera position calculation: The camera position is accurately calculated through the model passed by the distributor, the maximum XY value of the model boundary is obtained and multiplied by the coefficient to limit the maximum and minimum values to determine the horizontal distance between the camera and the model; the Z axis value of the model boundary is obtained and divided by the coefficient to set the height of the viewing angle. The coefficient can be modified uniformly for the same type or individually for a single model according to the model label. This algorithm is encapsulated into a pure function and the target position of the camera can be returned by passing it into the model; Sp3. Smooth camera transition: Use the timer to smoothly transition the relative position of the camera to the clicked object. During the transition, gradually adjust the camera position according to the set time interval. When the camera reaches the specified position, the timer is destroyed to ensure the smoothness and naturalness of the perspective switching. Sp4. View switching method call: When the view needs to be switched, call the SetViewTargetwithB lend method, pass in the target camera to switch to, and set the jump duration, so as to achieve a smooth switch to the target camera view, providing users with a seamless view switching experience; Sp5. Camera control logic component: Create a component for writing camera control logic, record the values generated by the left mouse button, mouse XY axis movement, mouse wheel and other operations and store them as variables, and save some related data at the same time. Mount the component on the player controller to make it an independent input event module. By obtaining the stored variable parameters, set the camera's XY axis movement and the wheel to control the camera's distance from the target, and realize flexible camera control functions; Sp6. Setting the character position: Go to the vicinity of the selected object, write a function to find a suitable position, pass in the position to be transferred, and perform a loop search. In the loop, generate a character at a position with a random offset of X from the specified position and check whether there is a collision. If there is a collision after multiple searches, give a corresponding prompt or directly use the last position for forced setting. Then set the position on the server and client through RPC (remote procedure call) to ensure the accuracy and consistency of the character position.
5. The method for switching the perspective of an object selected based on UE5 runtime according to claim 1, characterized in that: The asset module includes an event distributor, which adopts an efficient event distribution mechanism. The event distributor ensures the timely and accurate transmission of mouse click events in multi-object and complex scenes, and the average delay time of event transmission does not exceed 5 milliseconds.
6. The method for switching the perspective of an object selected based on UE5 runtime according to claim 1, characterized in that: The UI interface layout created by the UI module follows the design principles of simplicity, intuitiveness and ease of operation. The layout of each button and display area conforms to ergonomics and visual habits, and the response time of the UI interface is within 10 milliseconds.
7. The method for switching the perspective of an object selected based on UE5 runtime according to claim 1, characterized in that: The timer setting used for the smooth transition of the camera in the visual switching and control module can automatically adjust the time interval according to the scene complexity and hardware performance. On low-performance devices, the time interval is automatically increased to avoid lag. On high-performance devices, the time interval is reduced to improve the delicacy of the transition effect. The time interval adjustment range is 0.02-0.1 seconds.
8. The method for switching the perspective of an object selected based on UE5 runtime according to claim 1, characterized in that: In the camera position calculation of the perspective switching and control module, the coefficients used to calculate the distance between the camera and the model and the perspective height are preset according to the size and visual effects of common scene objects, and can be modified through a visual configuration interface without writing code, making it convenient for artists and planners to adjust the scene.