Multi-model path dynamic planning motion method based on UE4

By implementing the multi-model path dynamic programming motion method on the UE4 platform, the problems of incoherent motion and unreasonable attitude of the aircraft model are solved, high-quality model motion is achieved, and model collision is avoided.

CN119720572AActive Publication Date: 2025-03-28HARBIN ENG UNIV
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202411857860.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-03-28
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

In the prior art, the aircraft model movement is incoherent, the motion posture is unreasonable, and it is difficult to effectively improve the motion quality of the model.

Method used

The multi-model path dynamic programming motion method based on UE4 is adopted to communicate with external data through the UE4 platform, and multi-model path node data are obtained, and the blueprint nodes are used to realize the continuous motion of multiple models, adjust the model orientation angle and running speed, ensure that the model always faces the target node during the movement, and avoid model collisions.

Benefits of technology

The continuity of the aircraft model movement and the rationality of attitude are realized, the service quality of model movement is improved, the problem of model collision is avoided, and there is no need for excessive time overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119720572A_ABST
    Figure CN119720572A_ABST
Patent Text Reader

Abstract

The invention relates to a UE4-based multi-model path dynamic planning motion method. The invention relates to the technical field of 3D system simulation, and the method comprises the steps: carrying out the classification and extraction processing of obtained data, putting the data into a corresponding data structure, enabling a group of nodes to be in one-to-one correspondence with models, and obtaining a preset path; a blueprint in a UE4 platform is adopted, multi-model continuous motion is carried out based on a preset path, and multi-model continuous motion is realized by decomposing a group of nodes into a plurality of node pairs; needles are achieved through blueprint nodes of an unreal engine, and the problems that an existing model is not coherent in motion and unreasonable in motion posture are solved. Meanwhile, the method does not need too much time overhead, can effectively solve the current model motion problem, and better meets the motion service quality problem in the current 3D model motion process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of 3D system simulation, and is a multi-model path dynamic planning motion method based on UE4. Background Art

[0002] Unreal Engine 4 is a game development engine launched by Epic Games. Compared with other engines, Unreal Engine is not only efficient and versatile, but also allows developers to directly preview development results, giving developers stronger capabilities. In the Demo, Unreal Engine 4 fully demonstrates its powerful functions.

[0003] Blueprints are a powerful new technology introduced in Unreal Engine 4.

[0004] In simple terms, Blueprints are a way to create new UClasses without having to write or compile any code. When creating a Blueprint, you can choose to inherit from a 'native' C++ class or inherit from another Blueprint class. You can then add, arrange, and customize components, implement custom logic using a visual scripting language, react to events and interactions, define custom variables, handle input, and create a completely custom object type.

[0005] Each blueprint has a "construction script", which is similar to a constructor in C++ and is run when an object is created. This script can dynamically build Actor instances based on multiple factors. From this perspective, blueprints can also be seen as a very powerful prefabrication system.

[0006] Static Meshes can do a lot of things in UE4, such as changing their textures or materials during gameplay, or moving them throughout a level using Matinee. Regardless of how your Static Mesh behaves in your level, you may not want to be able to move through it or shoot through it. This is when you need to set up collision on your Static Mesh. By default, meshes do not have any collision set up. Without collision, Actors will be able to pass through the mesh, and if the mesh has physics simulated, the mesh will fall through the floor of the scene as soon as it starts running.

[0007] Aircraft model motion technology involves adjusting the aircraft's flight attitude frame by frame during the movement of the model, adjusting the aircraft's current position, and bringing an immersive and shocking experience to the user.

[0008] Based on C++, Unreal Engine 4 provides many blueprints written by functions. For example, the node for changing position in Unreal Engine 4 is SetActorLocation, which means teleporting from point A to point B, but there is no node for continuous movement of the model. Summary of the invention

[0009] In view of the shortcomings of the prior art, the present invention provides a multi-model path dynamic planning motion method based on UE4. The present invention is implemented by using the blueprint nodes that come with the Unreal Engine, which solves the existing problems of incoherent model motion and unreasonable model motion posture. At the same time, the method does not require excessive time overhead, can effectively improve the current model motion problem, and better meet the current motion service quality problem in the 3D model motion process.

[0010] The present invention provides the following technical solutions:

[0011] A multi-model path dynamic planning motion method based on UE4, the method comprising the following steps:

[0012] Step 1: Communicate with external data through the UE4 platform and select the file in the resource browser to obtain multi-model path node data, including the model's motion trajectory coordinates and speed data;

[0013] Step 2: Classify and extract the acquired data and put it into the corresponding data structure so that a set of nodes correspond to the model one by one to obtain the preset path;

[0014] Step 3: Use the blueprint in the UE4 platform to perform continuous movement of multiple models based on the preset path, and realize continuous movement of multiple models by decomposing a group of nodes into several node pairs;

[0015] Step 4: Determine and adjust the orientation angle of the model in continuous motion so that it always faces the destination node during the motion process;

[0016] Step 5: When the model is about to collide, change the running speed before and after the collision so that the time for the model to reach the destination coordinate remains consistent.

[0017] Preferably, the step 1 is specifically:

[0018] Create a UClass in UE4 and name it OpenWindowsFile, and use the openwindows function in Visual Studio to pop up the resource manager, select the file and output its file path; use UE4's custom C++ class to write C++ code, and use the open() function in the ifstream class to read the file path output by the OpenWindowsFile function to obtain the relevant data in the file.

[0019] Preferably, the step 2 is specifically:

[0020] In the UE4 editor, create a structure that is consistent with the external file and use it to create a data table, so that the data in the data table is consistent with the data in the external file. Use the branches and judgments of the blueprint to make the model name correspond to the path and speed one by one.

[0021] Preferably, the step 3 is specifically:

[0022] Step 3.1: Encapsulate the initial coordinate A and destination coordinate B of the aircraft;

[0023] a 2 +b 2 =c 2

[0024] Calculate the flight distance S between the initial coordinates of the aircraft and the destination coordinates, and calculate the flight time T according to the flight speed V of the aircraft;

[0025] Step 3.2: Set the flight time TT, the initial value is 0:

[0026] S=VT

[0027] The number of frames n required for the aircraft to travel from the initial position to the destination B is fixed, so the distance traveled by the aircraft in each frame is constant and is 1 / n of the total distance S; then TT increases by 1 / n for each frame the aircraft flies, until TT = 1;

[0028] Step 3.3: When flying to the Kth frame, use the lerp function:

[0029] P=1-Q

[0030] Based on the flight time TT, linear interpolation is performed on the initial coordinates and the destination coordinates to obtain a vector, which is set as the current position of the aircraft;

[0031] When the aircraft reaches the destination coordinate B, the flight time is reset;

[0032] Step 3.4: According to the aircraft flight data, the current coordinates of the aircraft are set to the initial coordinates A, the next destination coordinates are set to B, and the above process is repeated.

[0033] Preferably, the step 4 is specifically:

[0034] When the aircraft flies from the initial coordinate A to the destination coordinate B, it needs to adjust its flight angle. The current coordinates and destination coordinates of the aircraft are obtained, the flight angle it should face is calculated through the findlookatrotation node, and the flight angle is set through setActorRotation.

[0035] Preferably, the step 5 is specifically:

[0036] Add components to the models, add a transparent ellipse to each model to surround the model, and use the OnComponentHit event for collision detection; when two ellipses collide, it is determined that the two models are about to "collide", and an early warning is issued. The IDs of the models that are about to collide are compared, and the speed of the model with the smaller ID is reduced by 50% using the node setmaxspeed and lasts for 2 seconds:

[0037] speed = speed / 2

[0038] When the "collision" warning is lifted, the speed of the model is increased by 3 times using the node setmaxspeed and lasts for 2 seconds:

[0039] speed=speed×3

[0040] After 2 seconds, use the node setmaxspeed to restore the speed to normal:

[0041] speed=2speed / 3.

[0043] Preferably, the flight angle that the aircraft should face is calculated through the findlookatrotation node, and the flight attitude is calculated dynamically.

[0044] A multi-model path dynamic planning motion system based on UE4, the system comprising:

[0045] A data acquisition module, which communicates with external data through the UE4 platform, selects files in the resource browser to obtain multi-model path node data, including the motion trajectory coordinates and speed data of the model;

[0046] A data processing module, which classifies and extracts the acquired data and puts it into a corresponding data structure, so that a set of nodes corresponds to the model one by one, and obtains a preset path;

[0047] A motion module, which uses a blueprint in the UE4 platform to perform continuous motion of multiple models based on a preset path, and realizes continuous motion of multiple models by decomposing a group of nodes into several node pairs;

[0048] An adjustment module, which determines and adjusts the orientation angle of the model in continuous motion so that the model always faces the destination node during the motion process;

[0049] A maintaining module is used to change the running speed before and after the collision when the model is about to collide, so that the time for the model to reach the destination coordinate remains consistent.

[0050] A computer-readable storage medium stores a computer program, which is executed by a processor to implement a multi-model path dynamic planning motion method based on UE4.

[0051] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements a multi-model path dynamic planning motion method based on UE4 when executing the computer program.

[0052] The present invention has the following beneficial effects:

[0053] Compared with the prior art, the present invention has the following advantages:

[0054] The present invention solves the problem of incoherent motion of aircraft models. The specific positioning and flight attitude of the aircraft are calculated in real time by calculating the flight time of the aircraft and combining the inherent characteristics of Unreal 4. The flight trajectory of the aircraft is determined coherently through the lerp function.

[0055] After the aircraft flies from the initial coordinates to the destination coordinates, the next flight destination is changed according to the data read from the external file according to the data table structure of the Unreal Engine, and the flight process is repeated. After the aircraft flies from the initial coordinates to the destination coordinates, the progress of the flight is dynamically controlled by changing the flight time.

[0056] During the flight, the findlookatrotation node is used to calculate the flight angle of the aircraft based on the current coordinates and destination coordinates of the aircraft, and its flight attitude is dynamically calculated.

[0057] The present invention is implemented using the blueprint nodes that come with the Unreal Engine, which solves the existing problems of incoherent model motion and unreasonable model motion posture; at the same time, the method does not require excessive time overhead, can effectively improve the current model motion problem, and better meet the current motion service quality problem in the 3D model motion process. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0059] Figure 1 Shown as step 3 flow chart of the present invention;

[0060] Figure 2 Shown is step 5 of the flow chart of the present invention. DETAILED DESCRIPTION

[0061] The present invention is described in detail below in conjunction with specific embodiments. Specific embodiment one:

[0063] according to Figure 1 to Figure 2 As shown, the specific optimization technical solution adopted by the present invention to solve the above technical problems is: the present invention relates to a multi-model path dynamic planning motion method based on UE4.

[0064] A multi-model path dynamic planning motion method based on UE4, the method comprising the following steps:

[0065] Step 1: Communicate with external data through the UE4 platform, select the file in the resource browser to obtain multi-model path node data, including the model's motion trajectory coordinates and speed data;

[0066] Step 2: Classify and extract the acquired data and put it into the corresponding data structure so that a set of nodes correspond to the model one by one and obtain the preset path;

[0067] Step 3: Use the blueprint in the UE4 platform to perform continuous movement of multiple models based on the preset path, and realize continuous movement of multiple models by decomposing a group of nodes into several node pairs;

[0068] Step 4: Determine and adjust the orientation angle of the model in continuous motion so that it always faces the destination node during the motion process;

[0069] Step 5: When the model is about to collide, change the running speed before and after the collision so that the time for the model to reach the destination coordinate remains consistent.

[0070] The present invention solves the problem of incoherent motion of aircraft models. The specific positioning and flight attitude of the aircraft are calculated in real time by calculating the flight time of the aircraft and combining the inherent characteristics of Unreal 4. The flight trajectory of the aircraft is determined coherently through the lerp function.

[0071] After the aircraft flies from the initial coordinates to the destination coordinates, the next flight destination is changed according to the data read from the external file according to the data table structure of the Unreal Engine, and the flight process is repeated. After the aircraft flies from the initial coordinates to the destination coordinates, the progress of the flight is dynamically controlled by changing the flight time.

[0072] During the flight, the findlookatrotation node is used to calculate the flight angle of the aircraft based on the current coordinates and destination coordinates of the aircraft, and its flight attitude is dynamically calculated. Specific embodiment 2:

[0074] The difference between the second embodiment of the present application and the first embodiment is that:

[0075] The step 1 is specifically as follows:

[0076] Create a UClass in UE4 and name it OpenWindowsFile, and use the openwindows function in Visual Studio to pop up the resource manager, select the file and output its file path; use UE4's custom C++ class to write C++ code, and use the open() function in the ifstream class to read the file path output by the OpenWindowsFile function to obtain the relevant data in the file. Specific embodiment three:

[0078] The difference between the third embodiment of the present application and the second embodiment is that:

[0079] The step 2 is specifically as follows:

[0080] In the UE4 editor, create a structure that is consistent with the external file and use it to create a data table, so that the data in the data table is consistent with the data in the external file. Use the branches and judgments of the blueprint to make the model name correspond to the path and speed one by one. Specific embodiment four:

[0082] The difference between the fourth embodiment of the present application and the third embodiment is that:

[0083] The step 3 is specifically as follows:

[0084] Step 3.1: Encapsulate the initial coordinate A and destination coordinate B of the aircraft;

[0085] a 2 +b 2 =c 2

[0086] Calculate the flight distance S between the initial coordinates of the aircraft and the destination coordinates, and calculate the flight time T according to the flight speed V of the aircraft;

[0087] Step 3.2: Set the flight time TT, the initial value is 0:

[0088] S=VT

[0089] The number of frames n required for the aircraft to travel from the initial position to the destination B is fixed, so the distance traveled by the aircraft in each frame is constant and is 1 / n of the total distance S; then TT increases by 1 / n for each frame the aircraft flies, until TT = 1;

[0090] Step 3.3: When flying to the Kth frame, use the lerp function:

[0091] P=1-Q

[0092] Based on the flight time TT, linear interpolation is performed on the initial coordinates and the destination coordinates to obtain a vector, which is set as the current position of the aircraft;

[0093] When the aircraft reaches the destination coordinate B, the flight time is reset;

[0094] Step 3.4: According to the aircraft flight data, the current coordinates of the aircraft are set to the initial coordinates A, the next destination coordinates are set to B, and the above process is repeated. Specific embodiment five:

[0096] The difference between the fifth embodiment of the present invention and the fourth embodiment is that:

[0097] The step 4 is specifically as follows:

[0098] When the aircraft flies from the initial coordinate A to the destination coordinate B, it needs to adjust its flight angle. The current coordinates and destination coordinates of the aircraft are obtained, the flight angle it should face is calculated through the findlookatrotation node, and the flight angle is set through setActorRotation. Specific embodiment six:

[0100] The difference between the sixth embodiment of the present invention and the fifth embodiment is that:

[0101] The step 5 is specifically as follows:

[0102] Add components to the models, add a transparent ellipse to each model to surround the model, and use the OnComponentHit event for collision detection; when two ellipses collide, it is determined that the two models are about to "collide", and an early warning is issued. The IDs of the models that are about to collide are compared, and the speed of the model with the smaller ID is reduced by 50% using the node setmaxspeed and lasts for 2 seconds:

[0103] speed = speed / 2

[0104] When the "collision" warning is lifted, the speed of the model is increased by 3 times using the node setmaxspeed and lasts for 2 seconds:

[0105] speed=speed×3

[0106] After 2 seconds, use the node setmaxspeed to restore the speed to normal:

[0107] speed=2speed / 3. Specific embodiment seven:

[0110] The difference between the seventh embodiment of the present invention and the sixth embodiment is that:

[0111] The findlookatrotation node is used to calculate the flight angle it should face and dynamically calculate its flight attitude. Specific embodiment eight:

[0113] The difference between the eighth embodiment of the present invention and the seventh embodiment is that:

[0114] The present invention provides a multi-model path dynamic planning motion system based on UE4, the system comprising:

[0115] A data acquisition module, which communicates with external data through the UE4 platform, selects files in the resource browser to obtain multi-model path node data, including the motion trajectory coordinates and speed data of the model;

[0116] A data processing module, which classifies and extracts the acquired data and puts it into a corresponding data structure, so that a set of nodes corresponds to the model one by one, and obtains a preset path;

[0117] A motion module, which uses a blueprint in the UE4 platform to perform continuous motion of multiple models based on a preset path, and realizes continuous motion of multiple models by decomposing a group of nodes into several node pairs;

[0118] An adjustment module, which determines and adjusts the orientation angle of the model in continuous motion so that the model always faces the destination node during the motion process;

[0119] A maintaining module is used to change the running speed before and after the collision when the model is about to collide, so that the time for the model to reach the destination coordinate remains consistent. Specific embodiment nine:

[0121] The difference between the ninth embodiment of the present invention and the eighth embodiment is that:

[0122] The present invention provides a computer-readable storage medium on which a computer program is stored. The program is executed by a processor to implement a multi-model path dynamic planning motion method based on UE4. Specific embodiment ten:

[0124] The difference between the tenth embodiment of the present invention and the ninth embodiment is that:

[0125] The present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements a multi-model path dynamic planning motion method based on UE4 when executing the computer program. Specific embodiment eleven:

[0127] The difference between the eleventh embodiment of the present invention and the tenth embodiment is that:

[0128] The present invention provides a method for setting the attitude adjustment of an aircraft model. The method is implemented using the blueprint node provided by the Unreal Engine, which solves the existing problems of incoherent model motion and unreasonable model motion attitude. At the same time, the method does not require excessive time overhead, can effectively improve the current model motion problem, and better meet the current motion service quality problem for the 3D model motion process.

[0129] The present invention is achieved through the following scheme:

[0130] A multi-model path dynamic planning motion method based on UE4, the matching method comprises the following steps:

[0131] Step 1: The UE4 platform communicates with external data and selects the file in the resource browser to obtain multi-model path node data, including the model's motion trajectory coordinates and speed data.

[0132] Step 2: Classify, extract and process the data in step 1, and put them into the corresponding data structure so that a set of nodes correspond to the models one by one, and the models are distinguished by unique and non-repeatable ID names.

[0133] Step 3: Use the blueprint in the UE4 platform to perform continuous movement of multiple models based on the preset path imported in step 2. By decomposing a group of nodes into several node pairs, continuous movement of multiple models can be achieved.

[0134] Step 4: Determine and adjust the orientation angle of the model in continuous motion in step 3 so that it always faces the destination node during the motion.

[0135] Step 5: Considering the "collision" problem that will occur in the process of multiple models moving according to the path planning in step 4, based on collision detection, when the model is about to collide, the running speed before and after the collision is changed, so that the time for the model to reach the destination coordinate remains the same. While ensuring that multiple models continue to run on the basis of following the path planning, possible "collision" problems are avoided.

[0136] The step 1 is as follows: create a UClass named OpenWindowsFile in UE4, and use the openwindows function in VisualStudio to pop up the resource manager, select a file and output its file path. Use the custom C++ class of UE4 to write C++ code, and use the open() function in the ifstream class to read the file path output by the OpenWindowsFile function to obtain the relevant data in the file.

[0137] The step 2 is specifically as follows: create a structure consistent with the external file in the UE4 editor and create a data table based on it, so that the data in the data table is consistent with the data in the external file. Use the branching and judgment of the blueprint to make the model name correspond to the path and speed one by one.

[0138] The step 3 is specifically as follows:

[0139] ① Encapsulate the initial coordinates A and destination coordinates B of the aircraft.

[0140] ② By

[0141] a 2 +b 2 =c 2

[0142] The flight distance S between the initial coordinates of the aircraft and the destination coordinates is calculated, and the flight time T is calculated according to the flight speed V of the aircraft.

[0143] ③ Set the flight time TT, the initial value is 0.

[0144] S=VT

[0145] The number of frames n required for the aircraft to travel from the initial position to the destination B is fixed, so the distance traveled by the aircraft in each frame is constant and is 1 / n of the total distance S. Therefore, TT increases by 1 / n for each frame the aircraft flies, until TT=1.

[0146] ④ When flying to the Kth frame, use the lerp function,

[0147] P=1-Q

[0148] Based on the flight time TT, linear interpolation is performed on the initial coordinates and the destination coordinates to obtain a vector, which is set as the current position of the aircraft.

[0149] ⑤ When the aircraft reaches the destination coordinate B, the flight time is reset.

[0150] ⑥ According to the aircraft flight data, the current coordinates of the aircraft are set to the initial coordinates A, the next destination coordinates are set to B, and the above process is repeated.

[0151] The specific step 4 is as follows: the aircraft needs to adjust its flight angle when flying from the initial coordinate A to the destination coordinate B. At this time, it is necessary to obtain the current coordinates and the destination coordinates of the aircraft, calculate the flight angle it should face through the findlookatrotation node, and set the flight angle through setActorRotation.

[0152] The step 5 is specifically as follows: add components to the models, add a transparent ellipse to each model to surround the model, and use the OnComponentHit event to perform collision detection. When two ellipses collide, it is determined that the two models are about to "collide", and an early warning is issued. The IDs of the models that are about to collide are compared, and the speed of the model with the smaller ID is reduced by 50% using the node setmaxspeed and lasts for 2 seconds.

[0153] speed = speed / 2

[0154] When the "collision" warning is lifted, the speed of the model is increased by 3 times using the node setmaxspeed and lasts for 2 seconds.

[0155] speed=speed×3

[0156] After 2 seconds, use the node setmaxspeed to restore the speed to normal.

[0157] speed=2speed / 3. Specific embodiment twelve:

[0160] Radar jamming scenario:

[0161] In the radar jamming scenario, the jamming drone passes through the radar station from the initial point to the destination. In this process, the jamming drone mainly performs the following steps:

[0162] Step 1: The UE4 platform communicates with external data and selects the file in the resource browser to obtain multi-model path node data, including the model's motion trajectory coordinates and speed data.

[0163] Step 2: Classify, extract and process the data in step 1, and put them into the corresponding data structure so that a set of nodes correspond to the models one by one, and the models are distinguished by unique and non-repeatable ID names.

[0164] Step 3: Use the blueprint in the UE4 platform to perform continuous movement of multiple models based on the preset path imported in step 2. By decomposing a group of nodes into several node pairs, continuous movement of multiple models can be achieved.

[0165] Step 4: Determine and adjust the orientation angle of the model in continuous motion in step 3 so that it always faces the destination node during the motion.

[0166] Step 5: Considering the "collision" problem that will occur in the process of multiple models moving according to the path planning in step 4, based on collision detection, when the model is about to collide, the running speed before and after the collision is changed, so that the time for the model to reach the destination coordinate remains the same. While ensuring that multiple models continue to run on the basis of following the path planning, possible "collision" problems are avoided.

[0167] The step 1 is as follows: create a UClass named OpenWindowsFile in UE4, and use the openwindows function in VisualStudio to pop up the resource manager, select a file and output its file path. Use the custom C++ class of UE4 to write C++ code, and use the open() function in the ifstream class to read the file path output by the OpenWindowsFile function to obtain the relevant data in the file.

[0168] The step 2 is specifically as follows: create a structure consistent with the external file in the UE4 editor and create a data table based on it, so that the data in the data table is consistent with the data in the external file. Use the branching and judgment of the blueprint to make the model name correspond to the path and speed one by one.

[0169] The step 3 is specifically as follows:

[0170] ① Encapsulate the initial coordinates A and destination coordinates B of the aircraft.

[0171] ② Calculate the flight distance S between the initial coordinates of the aircraft and the destination coordinates, and calculate the flight time T based on the flight speed V of the aircraft.

[0172] ③ Set the flight time TT, the initial value is 0. S = VT, the number of frames n required for the aircraft to travel from the initial position to the destination B is fixed, then the distance traveled by the aircraft in each frame is constant and is 1 / n of the total distance S. Then, for each frame the aircraft flies, TT increases by 1 / n until TT = 1.

[0173] ④ When flying to the Kth frame, use the lerp function, from P = 1-Q, and perform linear interpolation on the initial coordinates and the destination coordinates based on the flight time TT to obtain a vector, which is set as the current position of the aircraft.

[0174] When the aircraft reaches the destination coordinate B, the flight time is reset.

[0175] ⑥ According to the aircraft flight data, the current coordinates of the aircraft are set to the initial coordinates A, the next destination coordinates are set to B, and the above process is repeated.

[0176] The specific step 4 is as follows: the aircraft needs to adjust its flight angle when flying from the initial coordinate A to the destination coordinate B. At this time, it is necessary to obtain the current coordinates and the destination coordinates of the aircraft, calculate the flight angle it should face through the findlookatrotation node, and set the flight angle through setActorRotation.

[0177] The step 5 is specifically as follows: add components to the models, add a transparent ellipse to each model to surround the model, and use the OnComponentHit event to perform collision detection. When two ellipses collide, it is determined that the two models are about to "collide", and an early warning is issued. The IDs of the models that are about to collide are compared, and the speed of the model with the smaller ID is reduced by 50% using the node setmaxspeed and lasts for 2 seconds.

[0178] When the "collision" warning is lifted, the speed of the model is increased by 3 times using the node setmaxspeed and lasts for 2 seconds.

[0179] After 2 seconds, use the node setmaxspeed to restore the speed to normal.

[0180] Embodiment 13:

[0181] Multi-UAV wide-area reconnaissance,In the process of multi-UAV wide-area reconnaissance, first set the initial coordinates and flight trajectory coordinate data table of each UAV according to the external CSV file.,In the UAV wide-area reconnaissance scenario, the UAV needs to be close to the communication radiation source and data link radiation source and away from the interference radiation source.

[0182] After the settings are completed, enter the simulated drone flight process. The drone first reaches the first destination coordinates according to the following steps:

[0183] Step 1: The UE4 platform communicates with external data and selects the file in the resource browser to obtain multi-model path node data, including the model's motion trajectory coordinates and speed data.

[0184] Step 2: Classify, extract and process the data in step 1, and put them into the corresponding data structure so that a set of nodes correspond to the models one by one, and the models are distinguished by unique and non-repeatable ID names.

[0185] Step 3: Use the blueprint in the UE4 platform to perform continuous movement of multiple models based on the preset path imported in step 2. By decomposing a group of nodes into several node pairs, continuous movement of multiple models can be achieved.

[0186] Step 4: Determine and adjust the orientation angle of the model in continuous motion in step 3 so that it always faces the destination node during the motion.

[0187] Step 5: Considering the "collision" problem that will occur in the process of multiple models moving according to the path planning in step 4, based on collision detection, when the model is about to collide, the running speed before and after the collision is changed, so that the time for the model to reach the destination coordinate remains the same. While ensuring that multiple models continue to run on the basis of following the path planning, possible "collision" problems are avoided.

[0188] The step 1 is as follows: create a UClass named OpenWindowsFile in UE4, and use the openwindows function in VisualStudio to pop up the resource manager, select a file and output its file path. Use the custom C++ class of UE4 to write C++ code, and use the open() function in the ifstream class to read the file path output by the OpenWindowsFile function to obtain the relevant data in the file.

[0189] The step 2 is specifically as follows: create a structure consistent with the external file in the UE4 editor and create a data table based on it, so that the data in the data table is consistent with the data in the external file. Use the branching and judgment of the blueprint to make the model name correspond to the path and speed one by one.

[0190] The step 3 is specifically as follows:

[0191] ① Encapsulate the initial coordinates A and destination coordinates B of the aircraft.

[0192] ② Calculate the flight distance S between the initial coordinates of the aircraft and the destination coordinates, and calculate the flight time T based on the flight speed V of the aircraft.

[0193] ③ Set the flight time TT, the initial value is 0. S = VT, the number of frames n required for the aircraft to travel from the initial position to the destination B is fixed, then the distance traveled by the aircraft in each frame is constant and is 1 / n of the total distance S. Then, for each frame the aircraft flies, TT increases by 1 / n until TT = 1.

[0194] ④ When flying to the Kth frame, use the lerp function, from P = 1-Q, and perform linear interpolation on the initial coordinates and the destination coordinates based on the flight time TT to obtain a vector, which is set as the current position of the aircraft.

[0195] ⑤ When the aircraft reaches the destination coordinate B, the flight time is reset.

[0196] ⑥ According to the aircraft flight data, the current coordinates of the aircraft are set to the initial coordinates A, the next destination coordinates are set to B, and the above process is repeated.

[0197] The specific step 4 is as follows: the aircraft needs to adjust its flight angle when flying from the initial coordinate A to the destination coordinate B. At this time, it is necessary to obtain the current coordinates and the destination coordinates of the aircraft, calculate the flight angle it should face through the findlookatrotation node, and set the flight angle through setActorRotation.

[0198] The step 5 is specifically as follows: add components to the models, add a transparent ellipse to each model to surround the model, and use the OnComponentHit event to perform collision detection. When two ellipses collide, it is determined that the two models are about to "collide", and an early warning is issued. The IDs of the models that are about to collide are compared, and the speed of the model with the smaller ID is reduced by 50% using the node setmaxspeed and lasts for 2 seconds.

[0199] When the "collision" warning is lifted, the speed of the model is increased by 3 times using the node setmaxspeed and lasts for 2 seconds.

[0200] After 2 seconds, use the node setmaxspeed to restore the speed to normal.

[0201] The above is only a preferred implementation of a multi-model path dynamic planning motion method based on UE4. The protection scope of a multi-model path dynamic planning motion method based on UE4 is not limited to the above embodiment. All technical solutions under this idea belong to the protection scope of the present invention. It should be pointed out that for those skilled in the art, several improvements and changes without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A multi-model path dynamic planning motion method based on UE4, characterized by: The method comprises the following steps: Step 1: Communicate with external data through the UE4 platform and select the file in the resource browser to obtain multi-model path node data, including the model's motion trajectory coordinates and speed data; Step 2: Classify and extract the acquired data and put it into the corresponding data structure so that a set of nodes correspond to the model one by one and obtain the preset path; Step 3: Use the blueprint in the UE4 platform to perform continuous movement of multiple models based on the preset path, and realize continuous movement of multiple models by decomposing a group of nodes into several node pairs; Step 4: Determine and adjust the orientation angle of the model in continuous motion so that it always faces the destination node during the motion process; Step 5: When the model is about to collide, change the running speed before and after the collision so that the time for the model to reach the destination coordinate remains consistent.

2. The method according to claim 1, characterized in that: The step 1 is specifically as follows: Create a UClass in UE4 and name it OpenWindowsFile, and use the openwindows function in Visual Studio to pop up the resource manager, select the file and output its file path; use UE4's custom C++ class to write C++ code, and use the open() function in the ifstream class to read the file path output by the OpenWindowsFile function to obtain the relevant data in the file.

3. The method according to claim 2, characterized in that: The step 2 is specifically as follows: In the UE4 editor, create a structure that is consistent with the external file and use it to create a data table, so that the data in the data table is consistent with the data in the external file. Use the branches and judgments of the blueprint to make the model name correspond to the path and speed one by one.

4. The method according to claim 1, characterized in that: The step 3 is specifically as follows: Step 3.1: Encapsulate the initial coordinate A and destination coordinate B of the aircraft; a 2 +b 2 =c 2 Calculate the flight distance S between the initial coordinates of the aircraft and the destination coordinates, and calculate the flight time T according to the flight speed V of the aircraft; Step 3.2: Set the flight time TT, the initial value is 0: S=VT The number of frames n required for the aircraft to travel from the initial position to the destination B is fixed, so the distance traveled by the aircraft in each frame is constant and is 1 / n of the total distance S; then TT increases by 1 / n for each frame the aircraft flies, until TT = 1; Step 3.3: When flying to the Kth frame, use the lerp function: P=1-Q Based on the flight time TT, linear interpolation is performed on the initial coordinates and the destination coordinates to obtain a vector, which is set as the current position of the aircraft; When the aircraft reaches the destination coordinate B, the flight time is reset; Step 3.4: According to the aircraft flight data, the current coordinates of the aircraft are set to the initial coordinates A, the next destination coordinates are set to B, and the above process is repeated.

5. The method according to claim 4, characterized in that: The step 4 is specifically as follows: When the aircraft flies from the initial coordinate A to the destination coordinate B, it needs to adjust its flight angle. The current coordinates and destination coordinates of the aircraft are obtained, the flight angle it should face is calculated through the findlookatrotation node, and the flight angle is set through setActorRotation.

6. The method according to claim 1, characterized in that: The step 5 is specifically as follows: Add components to the models, add a transparent ellipse to each model to surround the model, and use the OnComponentHit event for collision detection; when two ellipses collide, it is determined that the two models are about to "collide", and an early warning is issued. The IDs of the models that are about to collide are compared, and the speed of the model with the smaller ID is reduced by 50% using the node setmaxspeed and lasts for 2 seconds: speed = speed / 2 When the "collision" warning is lifted, the speed of the model is increased by 3 times using the node setmaxspeed and lasts for 2 seconds: speed=speed×3 After 2 seconds, use the node setmaxspeed to restore the speed to normal: speed=2speed / 3.

7. The method according to claim 6, characterized in that: The findlookatrotation node is used to calculate the flight angle it should face and dynamically calculate its flight attitude.

8. A multi-model path dynamic planning motion system based on UE4, characterized by: The system comprises: A data acquisition module, which communicates with external data through the UE4 platform, selects files in the resource browser to obtain multi-model path node data, including the motion trajectory coordinates and speed data of the model; A data processing module, which classifies and extracts the acquired data and puts it into a corresponding data structure, so that a set of nodes corresponds to the model one by one, and obtains a preset path; A motion module, which uses a blueprint in the UE4 platform to perform continuous motion of multiple models based on a preset path, and realizes continuous motion of multiple models by decomposing a group of nodes into several node pairs; An adjustment module, which determines and adjusts the orientation angle of the model in continuous motion so that the model always faces the destination node during the motion process; A maintaining module is used to change the running speed before and after the collision when the model is about to collide, so that the time for the model to reach the destination coordinate remains consistent.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the method according to claims 1-7.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method of claims 1-7 is implemented.

Citation Information

Patent Citations

  • Space manipulator global collision-free trajectory planning system

    CN110340890A

  • Multi-unmanned aerial vehicle cooperative target allocation attack method

    CN111766901A

  • Biped biological simulation motion system architecture based on network dual-state machine technology

    CN114344904A

  • Collision detection method and system based on unreal engine, medium and equipment

    CN115671737A

  • Simulation operation control method and system based on unreal engine

    CN117032895A