Navigation grid generation method and device, equipment and storage medium

By generating a navigation mesh that is suitable for voxels, the problem of road finding stuck caused by mismatch between navigation mesh and voxel accuracy is solved, and the road finding efficiency and accuracy in virtual scenes are improved, especially in medium-length Performance is significantly improved when distance pathfinding.

CN119499653APending Publication Date: 2025-02-25HANGZHOU BULLET FINGER UNIVERSE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411222886.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

In the prior art, the accuracy of the navigation mesh and voxels do not match, resulting in pathfinding movements that may be stuck in the game, and long-distance pathfinding performance is poor.

Method used

By obtaining the original scene information of the virtual scene, the scene voxel data and the initial height field data of the navigation grid are generated, collision detection is performed, the target height field data of the navigation grid is determined, and based on the data, it is generated suitable for the voxel. Navigate the grid.

Benefits of technology

The problem of road finding stuck caused by mismatch between navigation mesh and voxel accuracy is solved, and the road finding efficiency and accuracy in virtual scenes are improved, especially during medium and long distance road finding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119499653A_ABST
    Figure CN119499653A_ABST
Patent Text Reader

Abstract

The invention relates to a navigation grid generation method and device, equipment and a storage medium, and the method comprises the steps: obtaining original scene information of a virtual scene, and generating scene voxel data and initial height field data of a navigation grid according to the original scene information; performing collision detection by adopting the scene voxel data and the initial height field data of the navigation grid to obtain a collision detection result; determining target height field data of the navigation grid according to the collision detection result and the initial height field data; and generating a navigation grid matched with the voxel according to the target height field data. According to the navigation grid disclosed by the invention, the path-finding efficiency and the path-finding accuracy in a virtual scene are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for generating a navigation grid. Background Art

[0002] 3D games usually have physics and pathfinding functional requirements. Physics can be implemented using voxels and pathfinding can be implemented using navigation meshes. However, since the two belong to different systems and have different precisions, the higher-precision navigation mesh is not compatible with the lower-precision voxels. Therefore, the voxels of the locations marked as reachable by the navigation mesh may not be reachable, resulting in conflicts. This causes problems in game applications, causing the pathfinding movement of game units to get stuck in certain places.

[0003] In the related art, the solution that uses voxels and jump point algorithms to achieve the pathfinding function will have serious performance problems when the pathfinding distance is long, so it is only suitable for short-distance pathfinding. The solution that generates the navigation mesh by extracting the outer surface of the voxels is very different from the navigation mesh generated by the original scene information: some narrow places will be eliminated, and the originally walkable areas will become unwalkable; the boundaries of some surfaces will be expanded, and the originally unwalkable areas will become walkable, which is not a good effect in the game. Summary of the invention

[0004] The present disclosure provides a method, apparatus, device and storage medium for generating a navigation grid, so as to at least solve the problem of stuck navigation grid path finding in the related art. The technical solution of the present disclosure is as follows:

[0005] According to a first aspect of an embodiment of the present disclosure, a method for generating a navigation grid is provided, comprising:

[0006] Acquire original scene information of the virtual scene, and generate scene voxel data and initial height field data of the navigation grid according to the original scene information;

[0007] Using the scene voxel data and the initial height field data of the navigation grid to perform collision detection to obtain a collision detection result;

[0008] Determining target height field data of the navigation grid according to the collision detection result and the initial height field data;

[0009] A navigation mesh adapted to the voxels is generated according to the target height field data.

[0010] In an exemplary embodiment, the performing collision detection using the scene voxel data and the initial height field data of the navigation grid to obtain a collision detection result includes:

[0011] Determining a first threshold value according to a data range of the initial height field data of the navigation grid on the z-axis; the first threshold value is a maximum value in the data range on the z-axis;

[0012] Determining a second threshold value according to a data range of the initial height field data of the navigation grid on the x-axis; the second threshold value is a maximum value in the data range on the x-axis;

[0013] Collision detection is performed according to the scene voxel data, the first threshold and the second threshold to obtain a collision detection result.

[0014] In an exemplary embodiment, performing collision detection according to the scene voxel data, the first threshold and the second threshold to obtain a collision detection result includes:

[0015] Traversing each coordinate point of the scene voxel data in the voxel coordinate system in sequence; each coordinate point includes an x-axis coordinate value and a z-axis coordinate value;

[0016] For each current coordinate point traversed, perform the following operations:

[0017] Determine whether the current z-axis coordinate value corresponding to the current coordinate point is less than the first threshold;

[0018] If the current z-axis coordinate value corresponding to the current coordinate point is less than the first threshold, determining whether the current x-axis coordinate value corresponding to the current coordinate point is less than the second threshold;

[0019] If the current x-axis coordinate value corresponding to the current coordinate point is less than the second threshold, the collision detection result corresponding to the current coordinate point is determined according to the data of the zx plane of the navigation grid in the world coordinate system.

[0020] In an exemplary implementation, determining the collision detection result corresponding to the current coordinate point according to the data of the zx plane of the navigation grid in the world coordinate system includes:

[0021] Acquire accuracy data of the zx plane of the navigation grid in the world coordinate system, a third threshold and a fourth threshold, wherein the third threshold is a minimum value of the navigation grid on the z-axis in the world coordinate system, and the fourth threshold is a minimum value of the navigation grid on the x-axis in the world coordinate system;

[0022] The collision detection result corresponding to the current coordinate point is determined according to the accuracy data of the zx plane of the navigation grid in the world coordinate system, the third threshold and the fourth threshold.

[0023] In an exemplary embodiment, determining the collision detection result corresponding to the current coordinate point according to the accuracy data of the zx plane of the navigation grid in the world coordinate system, the third threshold and the fourth threshold includes:

[0024] Determine an updated coordinate point of the zx plane in the world coordinate system according to the coordinate information of the current coordinate point, the accuracy data, the third threshold and the fourth threshold;

[0025] Constructing a bounding box of the current coordinate point in the zx plane of the voxel coordinate system according to the precision data and the updated coordinate point, and determining coordinate information of four vertices of the bounding box;

[0026] According to the coordinate information of the four vertices of the bounding box, a height range set of the voxel corresponding to each vertex is obtained;

[0027] Calculate the intersection of the four height range sets to obtain the collision detection result corresponding to the current coordinate point;

[0028] Determining target height field data of the navigation grid according to the collision detection result and the initial height field data includes:

[0029] Each height range in the intersection is added to the initial height field data of the navigation mesh to obtain the target height field data of the navigation mesh.

[0030] In an exemplary embodiment, constructing a bounding box of the current coordinate point in the zx plane of the voxel coordinate system according to the precision data and the updated coordinate point includes:

[0031] Obtain voxel precision data of voxels in the original scene information on the zx plane;

[0032] Constructing a conversion function from the world coordinate system to the voxel coordinate system according to the voxel accuracy data, the third threshold and the fourth threshold;

[0033] According to the conversion function, the precision data and the updated coordinate point, a bounding box of the current coordinate point in the zx plane in the voxel coordinate system is constructed.

[0034] In an exemplary embodiment, generating scene voxel data and initial height field data of a navigation mesh according to the original scene information includes:

[0035] Converting the original scene information into three-dimensional voxels to generate the scene voxel data;

[0036] The original scene information is converted into height field data to generate initial height field data of the navigation mesh.

[0037] In an exemplary embodiment, generating a navigation mesh adapted to the voxel according to the target height field data includes:

[0038] Obtaining voxels corresponding to the virtual scene and generation parameters of the navigation grid;

[0039] A navigation mesh adapted to the voxel is generated according to the target height field data, the voxel and generation parameters of the navigation mesh.

[0040] According to a second aspect of an embodiment of the present disclosure, there is provided a device for generating a navigation grid, including:

[0041] An information acquisition module is configured to acquire original scene information of a virtual scene, and generate scene voxel data and initial height field data of a navigation grid according to the original scene information;

[0042] A collision result determination module is configured to perform collision detection using the scene voxel data and the initial height field data of the navigation grid to obtain a collision detection result;

[0043] a target data determination module, configured to determine target height field data of the navigation grid according to the collision detection result and the initial height field data;

[0044] The navigation mesh generation module is configured to generate a navigation mesh adapted to the voxel according to the target height field data.

[0045] In an exemplary embodiment, the collision result determination module includes:

[0046] A first determining unit is configured to determine a first threshold value according to a data range of the initial height field data of the navigation grid on the z-axis; the first threshold value is a maximum value in the data range on the z-axis;

[0047] A second determining unit is configured to determine a second threshold value according to a data range of the initial height field data of the navigation grid on the x-axis; the second threshold value is a maximum value in the data range on the x-axis;

[0048] The collision result determination unit is configured to perform collision detection according to the scene voxel data, the first threshold and the second threshold to obtain a collision detection result.

[0049] In an exemplary embodiment, the collision result determination unit includes:

[0050] A traversal unit, configured to sequentially traverse each coordinate point of the scene voxel data in the voxel coordinate system; each coordinate point includes an x-axis coordinate value and a z-axis coordinate value;

[0051] The execution unit is configured to perform the following operations for each current coordinate point traversed:

[0052] Determine whether the current z-axis coordinate value corresponding to the current coordinate point is less than the first threshold;

[0053] If the current z-axis coordinate value corresponding to the current coordinate point is less than the first threshold, determining whether the current x-axis coordinate value corresponding to the current coordinate point is less than the second threshold;

[0054] If the current x-axis coordinate value corresponding to the current coordinate point is less than the second threshold, the collision detection result corresponding to the current coordinate point is determined according to the data of the zx plane of the navigation grid in the world coordinate system.

[0055] In an exemplary embodiment, the execution unit includes:

[0056] a data acquisition subunit, configured to execute acquisition of accuracy data of the navigation grid on the zx plane in the world coordinate system, a third threshold and a fourth threshold, wherein the third threshold is a minimum value of the navigation grid on the z-axis in the world coordinate system, and the fourth threshold is a minimum value of the navigation grid on the x-axis in the world coordinate system;

[0057] The collision result determination subunit is configured to determine the collision detection result corresponding to the current coordinate point according to the accuracy data of the zx plane of the navigation grid in the world coordinate system, the third threshold and the fourth threshold.

[0058] In an exemplary embodiment, the collision result determination subunit includes:

[0059] A coordinate point updating subunit, configured to determine an updated coordinate point on the zx plane in the world coordinate system according to the coordinate information of the current coordinate point, the accuracy data, the third threshold value and the fourth threshold value;

[0060] a vertex coordinate determination subunit, configured to construct a bounding box of the current coordinate point in the zx plane of the voxel coordinate system according to the precision data and the updated coordinate point, and determine coordinate information of four vertices of the bounding box;

[0061] A height acquisition subunit is configured to acquire a height range set of a voxel corresponding to each vertex according to the coordinate information of four vertices of the bounding box;

[0062] The calculation subunit is configured to calculate the intersection of the four height range sets to obtain the collision detection result corresponding to the current coordinate point.

[0063] The target data determination module is further configured to add each height range in the intersection to the initial height field data of the navigation grid to obtain the target height field data of the navigation grid.

[0064] In an exemplary embodiment, the vertex coordinate determination subunit includes:

[0065] A voxel precision acquisition subunit is configured to acquire voxel precision data of voxels in the original scene information on the zx plane;

[0066] a conversion function construction subunit, configured to execute, according to the voxel accuracy data, the third threshold value and the fourth threshold value, a conversion function from the world coordinate system to the voxel coordinate system;

[0067] The bounding box construction subunit is configured to execute, according to the conversion function, the precision data and the updated coordinate point, construction of a bounding box of the current coordinate point in the zx plane of the voxel coordinate system.

[0068] In an exemplary embodiment, the information acquisition module includes:

[0069] A first conversion unit is configured to convert the original scene information into three-dimensional voxels to generate the scene voxel data;

[0070] The second conversion unit is configured to convert the original scene information into height field data to generate initial height field data of the navigation mesh.

[0071] In an exemplary embodiment, the navigation grid generation module includes:

[0072] A parameter acquisition unit, configured to acquire voxels corresponding to the virtual scene and generation parameters of the navigation grid;

[0073] The mesh generation unit is configured to generate a navigation mesh adapted to the voxel according to the target height field data, the voxel and generation parameters of the navigation mesh.

[0074] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0075] processor;

[0076] a memory for storing instructions executable by the processor;

[0077] The processor is configured to execute the instructions to implement the method for generating a navigation grid as described above.

[0078] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for generating a navigation grid as described above.

[0079] According to a fifth aspect of an embodiment of the present disclosure, there is provided a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method for generating a navigation grid as described above is implemented.

[0080] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0081] The present invention obtains original scene information of a virtual scene, and generates scene voxel data and initial height field data of a navigation grid according to the original scene information; performs collision detection using the scene voxel data and the initial height field data of the navigation grid to obtain a collision detection result; determines target height field data of the navigation grid according to the collision detection result and the initial height field data; generates a navigation grid adapted to the voxels according to the target height field data; in the process of pathfinding in the virtual scene through the navigation grid, since the navigation grid is adapted to the voxels in the virtual scene, there will be no situation where pathfinding movement gets stuck. The navigation grid of the present invention improves pathfinding efficiency and pathfinding accuracy in virtual scenes.

[0082] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0083] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0084] Figure 1 The present invention is an application environment diagram of a method for generating a navigation grid according to an exemplary embodiment.

[0085] Figure 2 The present invention is a flowchart of a method for generating a navigation grid according to an exemplary embodiment.

[0086] Figure 3 The present invention is a flowchart of a method for performing collision detection using the scene voxel data and the initial height field data of the navigation grid to obtain a collision detection result according to an exemplary embodiment.

[0087] Figure 4 The present invention is a flowchart showing a method for determining a collision detection result corresponding to the current coordinate point according to data of the zx plane of the navigation grid in the world coordinate system according to an exemplary embodiment.

[0088] Figure 5 It is a flowchart of a method for determining a collision detection result corresponding to the current coordinate point according to accuracy data of the zx plane of the navigation grid in the world coordinate system, a third threshold and a fourth threshold according to an exemplary embodiment.

[0089] Figure 6 The figure is a flowchart of another method for generating a navigation grid according to an exemplary embodiment.

[0090] Figure 7 The present invention is a flowchart showing a method for performing collision detection using the scene voxel data and the initial height field data of the navigation grid according to an exemplary embodiment.

[0091] Figure 8 The present invention is a block diagram of a device for generating a navigation grid according to an exemplary embodiment.

[0092] Fig. 9 It is a block diagram of a server according to an exemplary embodiment.

[0093] Fig.10 It is a block diagram of an electronic device for generating a navigation grid according to an exemplary embodiment. DETAILED DESCRIPTION

[0094] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0095] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0096] In order to improve the pathfinding efficiency and pathfinding accuracy in a virtual scene, the present disclosure provides a method, apparatus, device and storage medium for generating a navigation grid.

[0097] See also Figure 1 , which is a diagram of an application environment of a method for generating a navigation grid according to an exemplary embodiment. The application environment may include a server 01 and a client 02.

[0098] Specifically, in the embodiments of this specification, the server 01 may include an independently operated server, or a distributed server, or a server cluster composed of multiple servers, and may also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Server 01 may include a network communication unit, a processor, a memory, and the like. Specifically, the server 01 can be used to generate a navigation grid adapted to the voxel and send the navigation grid to the client 02.

[0099] Specifically, in the embodiments of this specification, the client 02 may include physical devices such as smart phones, desktop computers, tablet computers, laptop computers, digital assistants, smart wearable devices, and vehicle-mounted terminals, and may also include software running in physical devices, such as web pages provided by some service providers to users, or applications provided by these service providers to users. Specifically, the client 02 may be used to find a path in a virtual scene according to a navigation grid.

[0100] Figure 2 is a flowchart of a method for generating a navigation grid according to an exemplary embodiment. Figure 2 As shown, this method can be applied to Figure 1 The server 01 shown includes the following steps.

[0101] In step S201, original scene information of a virtual scene is acquired, and scene voxel data and initial height field data of a navigation mesh are generated according to the original scene information.

[0102] In the disclosed embodiments, the virtual scene may include a scene in a game application or a scene in other applications; the original scene information may include background information, virtual objects and other information in the virtual scene; scene voxel data and initial height field data of the navigation mesh may be generated based on the original scene information. A navigation mesh (i.e., NavigationMesh, abbreviated as NavMesh) is a data structure used to describe the walkable surface of the game world and allows finding a path from one walkable location to another walkable location in the game world.

[0103] In step S203, collision detection is performed using the scene voxel data and the initial height field data of the navigation grid to obtain a collision detection result.

[0104] In the disclosed embodiments, collision detection in the voxel world refers to a technique for determining whether two objects collide in a virtual environment represented by three-dimensional voxels. Voxels are discretized units in three-dimensional space, similar to the role of pixels in two-dimensional images. Collision detection is an important computing task in a virtual environment, and it can be applied to game development, virtual reality, simulation and other fields. Collision detection in the voxel world can be divided into two types: discrete collision detection and continuous collision detection.

[0105] Discrete collision detection is performed in discrete time steps. It determines whether a collision occurs by comparing the voxel representation of the object. Common discrete collision detection algorithms include bounding box collision detection and mesh collision detection. Bounding box collision detection uses simple geometric shapes (such as cubes) to enclose objects and compares the intersection relationship between bounding boxes. Mesh collision detection uses a more accurate mesh to represent the shape of the object and performs collision detection by comparing the intersection relationship between meshes.

[0106] Continuous collision detection takes into account the continuity of objects in time. It can detect collisions between objects in motion. Continuous collision detection algorithms usually use the motion trajectory of objects for calculation. Common algorithms include linear interpolation-based methods and time slicing-based methods.

[0107] The scene voxel data corresponding to the same original scene information and the initial height field data of the navigation grid may be used to perform collision detection to obtain a collision detection result.

[0108] In step S205, target height field data of the navigation grid is determined according to the collision detection result and the initial height field data.

[0109] In the disclosed embodiment, the height field data obtained from the collision detection result may be added to the initial height field data to obtain the target height field data of the navigation mesh.

[0110] In step S207, a navigation mesh adapted to the voxel is generated according to the target height field data.

[0111] In the disclosed embodiment, after the target height field data corresponding to the navigation mesh is acquired, a navigation mesh adapted to the voxels may be generated, and the navigation mesh may be applied in the virtual scene.

[0112] The present invention obtains original scene information of a virtual scene, and generates scene voxel data and initial height field data of a navigation grid according to the original scene information; performs collision detection using the scene voxel data and the initial height field data of the navigation grid to obtain a collision detection result; determines target height field data of the navigation grid according to the collision detection result and the initial height field data; generates a navigation grid adapted to the voxels according to the target height field data; in the process of pathfinding in the virtual scene through the navigation grid, since the navigation grid is adapted to the voxels in the virtual scene, there will be no situation where pathfinding movement gets stuck. The navigation grid of the present invention improves pathfinding efficiency and pathfinding accuracy in virtual scenes.

[0113] In the embodiment of the present disclosure, generating scene voxel data and initial height field data of the navigation grid according to the original scene information includes:

[0114] Converting the original scene information into three-dimensional voxels to generate the scene voxel data;

[0115] The original scene information is converted into height field data to generate initial height field data of the navigation mesh.

[0116] In the disclosed embodiments, the virtual model in the original scene information corresponding to the virtual scene can be voxelized and converted into three-dimensional voxels, and the corresponding scene voxel data can be generated; at the same time, the original scene information can be converted into height field data, and the initial height field data of the navigation grid can be generated. Heightfield is a common technology for representing terrain. It is commonly used in game development, computer graphics and virtual reality. Heightfield consists of a two-dimensional array, and each element in the array represents a discrete height value. These height values ​​can be used to construct three-dimensional terrain by mapping the height values ​​to surface points in three-dimensional space.

[0117] In the disclosed embodiment, the original scene information may be converted into scene voxel data and initial height field data of the navigation grid, respectively, so as to facilitate subsequent collision detection between the voxel data and the height field data.

[0118] In the present disclosure, Figure 3 As shown, Figure 3 A method for performing collision detection using the scene voxel data and the initial height field data of the navigation grid to obtain a collision detection result includes:

[0119] S2031: determining a first threshold value according to a data range of the initial height field data of the navigation grid on the z-axis; the first threshold value is a maximum value in the data range on the z-axis;

[0120] S2033: determining a second threshold value according to a data range of the initial height field data of the navigation grid on the x-axis; the second threshold value is a maximum value in the data range on the x-axis;

[0121] S2035: Perform collision detection according to the scene voxel data, the first threshold, and the second threshold to obtain a collision detection result.

[0122] In the disclosed embodiment, the data range of the initial height field data of the navigation grid on the z-axis can be obtained, and the maximum value in the data range on the z-axis is used as the first threshold value H; the data range of the initial height field data of the navigation grid on the x-axis is obtained, and the maximum value in the data range on the x-axis is used as the second threshold value. Then, collision detection is performed according to the scene voxel data, the first threshold value, and the second threshold value W to obtain a collision detection result.

[0123] In the disclosed embodiment, collision detection can be performed using scene voxel data, a first threshold of the initial height field data of the navigation grid on the z-axis, and a second threshold of the initial height field data of the navigation grid on the x-axis, so that collision detection results between the voxel data and the height field data can be obtained quickly and accurately.

[0124] In the embodiment of the present disclosure, performing collision detection according to the scene voxel data, the first threshold and the second threshold to obtain a collision detection result includes:

[0125] Traversing each coordinate point of the scene voxel data in the voxel coordinate system in sequence; each coordinate point includes an x-axis coordinate value and a z-axis coordinate value;

[0126] For each current coordinate point traversed, perform the following operations:

[0127] Determine whether the current z-axis coordinate value corresponding to the current coordinate point is less than the first threshold;

[0128] If the current z-axis coordinate value corresponding to the current coordinate point is less than the first threshold, determining whether the current x-axis coordinate value corresponding to the current coordinate point is less than the second threshold;

[0129] If the current x-axis coordinate value corresponding to the current coordinate point is less than the second threshold, the collision detection result corresponding to the current coordinate point is determined according to the data of the zx plane of the navigation grid in the world coordinate system.

[0130] In the disclosed embodiment, the scene voxel data includes multiple coordinate points in the voxel coordinate system, and collision detection can be performed on each coordinate point in the voxel coordinate system in turn; each coordinate point includes the coordinate values ​​of the x-axis and the z-axis in the three-dimensional coordinate axis; each current coordinate point is traversed in turn, and it is determined whether the current z-axis coordinate value corresponding to the current coordinate point is less than the first threshold; when the current z-axis coordinate value corresponding to the current coordinate point is less than the first threshold, it is determined whether the current x-axis coordinate value corresponding to the current coordinate point is less than the second threshold; and when the current x-axis coordinate value corresponding to the current coordinate point is less than the second threshold, the collision detection result corresponding to the current coordinate point is determined according to the data of the zx plane of the navigation grid in the world coordinate system; wherein the zx plane in the world coordinate system is the plane formed by the z-axis and the x-axis.

[0131] In the disclosed embodiment, collision detection can be performed on each coordinate point of the scene voxel data in the voxel coordinate system in turn to obtain a collision detection result for each coordinate point, thereby facilitating accurate generation of a navigation grid adapted to the voxel based on the collision detection results of each coordinate point.

[0132] In the embodiment of the present disclosure, the method further includes:

[0133] If the current z-axis coordinate value corresponding to the current coordinate point is greater than or equal to the first threshold, the collision detection is ended.

[0134] If the current x-axis coordinate value corresponding to the current coordinate point is greater than or equal to the second threshold, then obtaining a next coordinate point corresponding to the current coordinate point, the next coordinate point has the same x-axis coordinate value as the current coordinate point, and the z-axis coordinate value of the next coordinate point is equal to the current x-axis coordinate value plus 1;

[0135] The next coordinate point is used as the current coordinate point again, and the process jumps to the step of determining whether the current x-axis coordinate value corresponding to the current coordinate point is less than the first threshold, and the steps after this step are repeated.

[0136] Exemplarily, the first coordinate point can be set to (z=0, x=0), and based on the first coordinate point, the next coordinate point can be determined to be (z=1, x=0) or (z=0, x=1); and so on, the collision detection results corresponding to each coordinate point in the scene voxel data can be automatically obtained.

[0137] In the present disclosure, Figure 4 As shown, Figure 4 A method for determining a collision detection result corresponding to the current coordinate point according to the data of the zx plane of the navigation grid in the world coordinate system, comprising:

[0138] S401: Acquire accuracy data of the zx plane of the navigation grid in the world coordinate system, a third threshold, and a fourth threshold, wherein the third threshold is a minimum value of the navigation grid on the z axis in the world coordinate system, and the fourth threshold is a minimum value of the navigation grid on the x axis in the world coordinate system;

[0139] S403: Determine a collision detection result corresponding to the current coordinate point according to the accuracy data of the zx plane of the navigation grid in the world coordinate system, a third threshold and a fourth threshold.

[0140] In the disclosed embodiment, the accuracy data cs of the navigation grid in the zx plane in the world coordinate system and the minimum value of the navigation grid on the z-axis in the world coordinate system, that is, the third threshold minz, can be obtained; and the fourth threshold is the minimum value of the navigation grid on the x-axis in the world coordinate system, that is, the fourth threshold minx; the coordinates of the current coordinate point in the voxel coordinate system in the zx plane of the world coordinate system can be determined based on the accuracy data of the zx plane in the world coordinate system, the third threshold and the fourth threshold, thereby obtaining the collision detection result of the current coordinate point.

[0141] In the disclosed embodiment, by determining the minimum value of the navigation grid on the z-axis, the minimum value on the x-axis and the accuracy data of the zx plane in the world coordinate system, the collision detection result of the current coordinate point in the voxel coordinate system can be further determined.

[0142] In the present disclosure, Figure 5 As shown, Figure 5 A method for determining a collision detection result corresponding to the current coordinate point according to the accuracy data of the zx plane of the navigation grid in the world coordinate system, a third threshold and a fourth threshold, comprising:

[0143] S4011: determining an updated coordinate point on the zx plane in the world coordinate system according to the coordinate information of the current coordinate point, the accuracy data, the third threshold and the fourth threshold;

[0144] S4013: constructing a bounding box of the current coordinate point in the zx plane in the voxel coordinate system according to the precision data and the updated coordinate point, and determining coordinate information of four vertices of the bounding box;

[0145] S4015: Obtain a height range set of voxels corresponding to each vertex according to the coordinate information of the four vertices of the bounding box;

[0146] S4017: Calculate the intersection of the four height range sets to obtain a collision detection result corresponding to the current coordinate point.

[0147] In the embodiment of the present disclosure, after determining the accuracy data cs, the third threshold minz and the fourth threshold minx of the navigation grid in the zx plane in the world coordinate system, the updated coordinate point of the zx plane in the world coordinate system may be calculated;

[0148] Exemplarily, the calculation formula of the updated coordinate point wp of the zx plane in the world coordinate system is as follows:

[0149] wp=[wpz,wpx]=[z*cs+minz,x*cs+minx];

[0150] Among them, cs is the accuracy data of the navigation grid in the zx plane in the world coordinate system, minz is the third threshold, minx is the fourth threshold; z is the z-axis coordinate value of the current coordinate point in the voxel coordinate system, and x is the x-axis coordinate value of the current coordinate point in the voxel coordinate system.

[0151] Then, based on the precision data and the updated coordinate point, the bounding box vbox of the current coordinate point in the zx plane of the voxel coordinate system is constructed, and the four vertex coordinate information of the bounding box vbox is determined; based on the four vertex coordinate information of the bounding box vbox, the height range set of the voxel corresponding to each vertex is obtained: and the intersection rs of the four height range sets is calculated to obtain the collision detection result corresponding to the current coordinate point.

[0152] In the embodiment of the present disclosure, constructing a bounding box of the current coordinate point in the zx plane of the voxel coordinate system according to the precision data and the updated coordinate point includes:

[0153] Obtain voxel precision data of voxels in the original scene information on the zx plane;

[0154] Constructing a conversion function from the world coordinate system to the voxel coordinate system according to the voxel accuracy data, the third threshold and the fourth threshold;

[0155] According to the conversion function, the precision data and the updated coordinate point, a bounding box of the current coordinate point in the zx plane in the voxel coordinate system is constructed.

[0156] In the embodiment of the present disclosure, voxel accuracy data of voxels in the zx plane in the original scene information can be obtained, and the data represents the accuracy of the voxels in the zx plane; then, according to the voxel accuracy data, the third threshold and the fourth threshold, a conversion function from the world coordinate system to the voxel coordinate system is constructed; illustratively, the formula of the conversion function is as follows:

[0157] worldToVoxel(wpz,wpx)=[(wpz-minz) / CELL_SIZE,(wpx-minx) / CELL_SIZE]

[0158] Among them, CELL_SIZE is the accuracy data of the voxel in the zx plane; minz is the third threshold, and minx is the fourth threshold.

[0159] A bounding box of the current coordinate point in the zx plane of the voxel coordinate system may be constructed according to the conversion function, the precision data and the updated coordinate point; thereby determining coordinate information of four vertices of the bounding box;

[0160] Exemplarily, the coordinate information of the four vertices of the bounding box is as follows:

[0161] p[0]=worldToVoxel(wpz,wpx), p[1]=worldToVoxel(wpz+cs,wpx),

[0162] p[2]=worldToVoxel(wpz,wpx+cs), p[3]=worldToVoxel(wpz+cs,wpx+cs)

[0163] Among them, the coordinates of the updated coordinate point wp in the zx plane in the world coordinate system are: [wpz, wpx], and cs is the precision data of the navigation grid in the zx plane in the world coordinate system.

[0164] In the disclosed embodiment, a conversion function from the world coordinate system to the voxel coordinate system can be accurately constructed based on the voxel precision data, the third threshold value, and the fourth threshold value; and then a bounding box of the current coordinate point in the zx plane of the voxel coordinate system is constructed based on the conversion function, the precision data, and the updated coordinate point, so as to quickly and accurately determine the collision detection result corresponding to the current coordinate point.

[0165] In the embodiment of the present disclosure, determining the target height field data of the navigation grid according to the collision detection result and the initial height field data includes:

[0166] Each height range in the intersection is added to the initial height field data of the navigation mesh to obtain the target height field data of the navigation mesh.

[0167] In the disclosed embodiment, each height range in the intersection rs in the collision detection result may be added to the initial height field data of the navigation grid to obtain the target height field data of the navigation grid.

[0168] In the disclosed embodiment, the initial height field data of the navigation grid is height field data of a relatively large range, and each height range in the intersection rs is added to the data to further accurately define the height field data of the navigation grid.

[0169] In the embodiment of the present disclosure, generating a navigation grid adapted to the voxel according to the target height field data includes:

[0170] Obtaining voxels corresponding to the virtual scene and generation parameters of the navigation grid;

[0171] A navigation mesh adapted to the voxel is generated according to the target height field data, the voxel and generation parameters of the navigation mesh.

[0172] In the disclosed embodiment, the generation parameters of the navigation grid may include but are not limited to generation accuracy, proxy radius, proxy height, proxy step height and other parameters. The voxels corresponding to the virtual scene and the generation parameters of the navigation grid may be custom data input by the user; the data may be set and adjusted according to actual conditions; after obtaining the height field data of the navigation grid, the target height field data, the voxels and the generation parameters of the navigation grid may be combined to generate a navigation grid that matches the voxels.

[0173] In the disclosed embodiment, by setting the voxels corresponding to the virtual scene and the generation parameters of the navigation grid, the target height field data, the voxels and the generation parameters of the navigation grid are combined, so as to accurately generate a navigation grid adapted to the voxels.

[0174] In the embodiment of the present disclosure, after generating a navigation mesh adapted to the voxel according to the target height field data, the method further includes:

[0175] Finding a path in the virtual scene based on the navigation grid to obtain a navigable route;

[0176] Based on the navigable route, the movement of virtual objects in the virtual scene is controlled.

[0177] In the disclosed embodiment, pathfinding can be performed in the virtual scene according to the navigation grid to obtain a navigable route; based on the navigable route, the movement of virtual objects in the virtual scene can be controlled in the virtual scene, thereby avoiding the situation where the virtual objects are stuck in pathfinding and movement, thereby improving the travel efficiency of the virtual objects in the virtual scene.

[0178] In an exemplary embodiment, if Figure 6 As shown, Figure 6 A flowchart of another method for generating a navigation grid, comprising:

[0179] S601: In response to a parameter input instruction, input the voxel and the generation parameters of the navigation mesh;

[0180] S602: Generate scene voxel data according to the original scene information of the virtual scene;

[0181] S603: Generate the initial height field data of the navigation mesh according to the original scene information;

[0182] S604: Use the scene voxel data and the initial height field data of the navigation mesh to perform collision detection, and obtain the target height field data of the navigation mesh;

[0183] S605: Generate a navigation mesh according to the target height field data of the navigation mesh, the voxels, and the generation parameters of the navigation mesh.

[0184] In an exemplary embodiment, as Figure 7 shown, Figure 7 a method for performing collision detection using the scene voxel data and the initial height field data of the navigation mesh includes:

[0185] S701: Let z = 0, x = 0

[0186] S702: Determine whether z < H is satisfied; where H is the maximum range of the initial height field data of the navigation mesh on the z-axis. If satisfied, go to step S703; otherwise, end the algorithm;

[0187] S703: Determine whether x < W is satisfied; where W is the maximum range of the initial height field data of the navigation mesh on the x-axis. If satisfied, go to step S704; otherwise, go to step S709;

[0188] S704: Calculate the coordinates wp = [wpz, wpx] = [z * cs + minz, x * cs + minx] of the zx plane in the world coordinate system, where cs is the precision on the zx plane of the navigation mesh, minz is the minimum range of the z-axis in the world coordinate system of the navigation mesh, and minx is the minimum range of the x-axis in the world coordinate system of the navigation mesh;

[0189] S705: Calculate the bounding box vbox of the zx plane in the voxel coordinate system, and its four vertex coordinates are:

[0190] p[0] = worldToVoxel(wpz, wpx), p[1] = worldToVoxel(wpz + cs, wpx),

[0191] p[2] = worldToVoxel(wpz, wpx + cs), p[3] = worldToVoxel(wpz + cs, wpx + cs)

[0192] Among them, the coordinates of the updated coordinate point wp in the zx plane in the world coordinate system are: [wpz, wpx], and cs is the precision data of the navigation grid in the zx plane in the world coordinate system.

[0193] Among them, worldToVoxel is the conversion function from the world coordinate system to the voxel coordinate system, which is defined as:

[0194] worldToVoxel(wpz,wpx)=[(wpz-minz) / CELL_SIZE,(wpx-minx) / CELL_SIZE]

[0195] Among them, CELL_SIZE is the accuracy data of the voxel in the zx plane; minz is the third threshold, and minx is the fourth threshold.

[0196] S706: Obtain a height range set of corresponding voxels according to the four vertices of the vbox, and obtain rs by finding the intersection of the four range sets;

[0197] S707: Add each height range in rs to the initial height field data of the navigation grid to obtain the target height field data of the navigation grid

[0198] S708: x=x+1, and jump to step S703;

[0199] S709:z=z+1.

[0200] The technical solution of this embodiment has high operating efficiency in the game. Compared with the path-finding solution that directly uses voxels and jumping point algorithms, the performance exceeds one order of magnitude in medium and long distance situations. The processing of generating a voxel-adapted navigation mesh in this solution occurs in the preprocessing stage, which does not occupy additional game runtime performance, and problems are easy to troubleshoot and handle. This solution uses a method of collision detection with voxels. Compared with the method of generating a navigation mesh using the outer surface of voxels, the generated navigation mesh is closer to the original navigation mesh and has a better effect.

[0201] This embodiment adopts the voxel collision detection method to modify the intermediate data of the navigation mesh height field to generate a voxel-adapted navigation mesh. The generated navigation mesh is very close to the original navigation mesh and has a good effect. The generated voxel-adapted navigation mesh is used to solve the conflict problem caused by the joint use of voxels and navigation meshes in the game because the two belong to different systems and have mismatched precision. This method has high path finding efficiency.

[0202] Figure 8 is a block diagram of a navigation grid generation device according to an exemplary embodiment. Figure 8 , the device comprises:

[0203] The information acquisition module 810 is configured to acquire original scene information of the virtual scene, and generate scene voxel data and initial height field data of the navigation grid according to the original scene information;

[0204] The collision result determination module 820 is configured to perform collision detection using the scene voxel data and the initial height field data of the navigation grid to obtain a collision detection result;

[0205] A target data determination module 830 is configured to determine target height field data of the navigation grid according to the collision detection result and the initial height field data;

[0206] The navigation mesh generation module 840 is configured to generate a navigation mesh adapted to the voxels according to the target height field data.

[0207] In an exemplary embodiment, the collision result determination module includes:

[0208] A first determining unit is configured to determine a first threshold value according to a data range of the initial height field data of the navigation grid on the z-axis; the first threshold value is a maximum value in the data range on the z-axis;

[0209] A second determining unit is configured to determine a second threshold value according to a data range of the initial height field data of the navigation grid on the x-axis; the second threshold value is a maximum value in the data range on the x-axis;

[0210] The collision result determination unit is configured to perform collision detection according to the scene voxel data, the first threshold and the second threshold to obtain a collision detection result.

[0211] In an exemplary embodiment, the collision result determination unit includes:

[0212] A traversal unit, configured to sequentially traverse each coordinate point of the scene voxel data in the voxel coordinate system; each coordinate point includes an x-axis coordinate value and a z-axis coordinate value;

[0213] The execution unit is configured to perform the following operations for each current coordinate point traversed:

[0214] Determine whether the current z-axis coordinate value corresponding to the current coordinate point is less than the first threshold;

[0215] If the current z-axis coordinate value corresponding to the current coordinate point is less than the first threshold, determining whether the current x-axis coordinate value corresponding to the current coordinate point is less than the second threshold;

[0216] If the current x-axis coordinate value corresponding to the current coordinate point is less than the second threshold, the collision detection result corresponding to the current coordinate point is determined according to the data of the zx plane of the navigation grid in the world coordinate system.

[0217] In an exemplary embodiment, the execution unit includes:

[0218] a data acquisition subunit, configured to execute acquisition of accuracy data of the navigation grid on the zx plane in the world coordinate system, a third threshold and a fourth threshold, wherein the third threshold is a minimum value of the navigation grid on the z-axis in the world coordinate system, and the fourth threshold is a minimum value of the navigation grid on the x-axis in the world coordinate system;

[0219] The collision result determination subunit is configured to determine the collision detection result corresponding to the current coordinate point according to the accuracy data of the zx plane of the navigation grid in the world coordinate system, the third threshold and the fourth threshold.

[0220] In an exemplary embodiment, the collision result determination subunit includes:

[0221] A coordinate point updating subunit, configured to determine an updated coordinate point on the zx plane in the world coordinate system according to the coordinate information of the current coordinate point, the accuracy data, the third threshold value and the fourth threshold value;

[0222] a vertex coordinate determination subunit, configured to construct a bounding box of the current coordinate point in the zx plane of the voxel coordinate system according to the precision data and the updated coordinate point, and determine coordinate information of four vertices of the bounding box;

[0223] A height acquisition subunit is configured to acquire a height range set of a voxel corresponding to each vertex according to the coordinate information of four vertices of the bounding box;

[0224] The calculation subunit is configured to calculate the intersection of the four height range sets to obtain the collision detection result corresponding to the current coordinate point.

[0225] The target data determination module is further configured to add each height range in the intersection to the initial height field data of the navigation grid to obtain the target height field data of the navigation grid.

[0226] In an exemplary embodiment, the vertex coordinate determination subunit includes:

[0227] A voxel precision acquisition subunit is configured to acquire voxel precision data of voxels in the original scene information on the zx plane;

[0228] a conversion function construction subunit, configured to execute, according to the voxel accuracy data, the third threshold value and the fourth threshold value, a conversion function from the world coordinate system to the voxel coordinate system;

[0229] The bounding box construction subunit is configured to execute, according to the conversion function, the precision data and the updated coordinate point, construction of a bounding box of the current coordinate point in the zx plane of the voxel coordinate system.

[0230] In an exemplary embodiment, the information acquisition module includes:

[0231] A first conversion unit is configured to convert the original scene information into three-dimensional voxels to generate the scene voxel data;

[0232] The second conversion unit is configured to convert the original scene information into height field data to generate initial height field data of the navigation mesh.

[0233] In an exemplary embodiment, the navigation grid generation module includes:

[0234] A parameter acquisition unit, configured to acquire voxels corresponding to the virtual scene and generation parameters of the navigation grid;

[0235] The mesh generation unit is configured to generate a navigation mesh adapted to the voxel according to the target height field data, the voxel and generation parameters of the navigation mesh.

[0236] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0237] In an exemplary embodiment, an electronic device is also provided, including a processor; a memory for storing processor executable instructions; wherein the processor is configured to implement the navigation grid generation method provided in any of the above embodiments when executing the instructions stored in the memory.

[0238] The electronic device may be a terminal, a server or a similar computing device. For example, the electronic device is a server. Fig. 9 is a block diagram of an electronic device according to an exemplary embodiment. Fig. 9As shown, the server 900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 910 (the processor 910 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 930 for storing data, and one or more storage media 920 (such as one or more mass storage devices) for storing application programs 923 or data 922. Among them, the memory 930 and the storage medium 920 can be short-term storage or permanent storage. The program stored in the storage medium 920 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processing unit 910 can be configured to communicate with the storage medium 920 and execute a series of instruction operations in the storage medium 920 on the server 900. The server 900 may also include one or more power supplies 960, one or more wired or wireless network interfaces 950, one or more input and output interfaces 940, and / or one or more operating systems 921, such as Windows ServerTM, Mac OSXTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0239] The input / output interface 940 may be used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the server 900. In one example, the input / output interface 940 includes a network adapter (Network Interface Controller, NIC), which may be connected to other network devices via a base station so as to communicate with the Internet. In one example, the input / output interface 940 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0240] It can be understood by those skilled in the art that Fig. 9 The structure shown is only for illustration and does not limit the structure of the above electronic device. Fig. 9 More or fewer components as shown, or with Fig. 9 Different configurations are shown.

[0241] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 930 including instructions, and the instructions can be executed by the processor 910 of the device 900 to complete the above method. Alternatively, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0242] Fig.10 is a block diagram of an electronic device for generating a navigation grid according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.10 As shown. The electronic device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for generating a navigation grid is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.

[0243] Those skilled in the art will understand that Fig.10 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0244] In an exemplary embodiment, there is also provided an electronic device, comprising:

[0245] A processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the above-mentioned method for generating a navigation grid.

[0246] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the instructions can be executed by a processor of an electronic device to complete the above-mentioned method for generating a navigation grid. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0247] In an exemplary embodiment, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, the above-mentioned method for generating a navigation grid is implemented.

[0248] The present invention obtains original scene information of a virtual scene, and generates scene voxel data and initial height field data of a navigation grid according to the original scene information; performs collision detection using the scene voxel data and the initial height field data of the navigation grid to obtain a collision detection result; determines target height field data of the navigation grid according to the collision detection result and the initial height field data; generates a navigation grid adapted to the voxels according to the target height field data; in the process of pathfinding in the virtual scene through the navigation grid, since the navigation grid is adapted to the voxels in the virtual scene, there will be no situation where pathfinding movement gets stuck. The navigation grid of the present invention improves pathfinding efficiency and pathfinding accuracy in virtual scenes.

[0249] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0250] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0251] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for generating a navigation grid, characterized in that: include: Acquire original scene information of the virtual scene, and generate scene voxel data and initial height field data of the navigation grid according to the original scene information; Using the scene voxel data and the initial height field data of the navigation grid to perform collision detection to obtain a collision detection result; Determining target height field data of the navigation grid according to the collision detection result and the initial height field data; A navigation mesh adapted to the voxels is generated according to the target height field data.

2. The method according to claim 1, characterized in that The method of performing collision detection using the scene voxel data and the initial height field data of the navigation grid to obtain a collision detection result includes: Determining a first threshold value according to a data range of the initial height field data of the navigation grid on the z-axis; the first threshold value is a maximum value in the data range on the z-axis; Determining a second threshold value according to a data range of the initial height field data of the navigation grid on the x-axis; the second threshold value is a maximum value in the data range on the x-axis; Collision detection is performed according to the scene voxel data, the first threshold and the second threshold to obtain a collision detection result.

3. The method according to claim 2, characterized in that The performing collision detection according to the scene voxel data, the first threshold and the second threshold to obtain a collision detection result includes: Traversing each coordinate point of the scene voxel data in the voxel coordinate system in sequence; each coordinate point includes an x-axis coordinate value and a z-axis coordinate value; For each current coordinate point traversed, perform the following operations: Determine whether the current z-axis coordinate value corresponding to the current coordinate point is less than the first threshold; If the current z-axis coordinate value corresponding to the current coordinate point is less than the first threshold, determining whether the current x-axis coordinate value corresponding to the current coordinate point is less than the second threshold; If the current x-axis coordinate value corresponding to the current coordinate point is less than the second threshold, the collision detection result corresponding to the current coordinate point is determined according to the data of the zx plane of the navigation grid in the world coordinate system.

4. The method according to claim 3, characterized in that Determining the collision detection result corresponding to the current coordinate point according to the data of the zx plane of the navigation grid in the world coordinate system includes: Acquire accuracy data of the zx plane of the navigation grid in the world coordinate system, a third threshold and a fourth threshold, wherein the third threshold is a minimum value of the navigation grid on the z-axis in the world coordinate system, and the fourth threshold is a minimum value of the navigation grid on the x-axis in the world coordinate system; The collision detection result corresponding to the current coordinate point is determined according to the accuracy data of the zx plane of the navigation grid in the world coordinate system, the third threshold and the fourth threshold.

5. The method according to claim 4, characterized in that The determining, according to the accuracy data of the zx plane of the navigation grid in the world coordinate system, the third threshold and the fourth threshold, a collision detection result corresponding to the current coordinate point includes: Determine an updated coordinate point of the zx plane in the world coordinate system according to the coordinate information of the current coordinate point, the accuracy data, the third threshold and the fourth threshold; Constructing a bounding box of the current coordinate point in the zx plane of the voxel coordinate system according to the precision data and the updated coordinate point, and determining coordinate information of four vertices of the bounding box; According to the coordinate information of the four vertices of the bounding box, a height range set of the voxel corresponding to each vertex is obtained; Calculate the intersection of the four height range sets to obtain the collision detection result corresponding to the current coordinate point; Determining target height field data of the navigation grid according to the collision detection result and the initial height field data includes: Each height range in the intersection is added to the initial height field data of the navigation mesh to obtain the target height field data of the navigation mesh.

6. The method according to claim 5, characterized in that The step of constructing a bounding box of the current coordinate point in the zx plane of the voxel coordinate system according to the precision data and the updated coordinate point includes: Obtain voxel precision data of voxels in the original scene information on the zx plane; Constructing a conversion function from the world coordinate system to the voxel coordinate system according to the voxel accuracy data, the third threshold and the fourth threshold; According to the conversion function, the precision data and the updated coordinate point, a bounding box of the current coordinate point in the zx plane in the voxel coordinate system is constructed.

7. The method according to any one of claims 1 to 6, characterized in that: The generating scene voxel data and initial height field data of the navigation grid according to the original scene information comprises: Converting the original scene information into three-dimensional voxels to generate the scene voxel data; The original scene information is converted into height field data to generate initial height field data of the navigation mesh.

8. The method according to any one of claims 1 to 6, characterized in that: Generating a navigation grid adapted to the voxel according to the target height field data includes: Obtaining voxels corresponding to the virtual scene and generation parameters of the navigation grid; A navigation mesh adapted to the voxel is generated according to the target height field data, the voxel and generation parameters of the navigation mesh.

9. A navigation grid generation device, characterized in that: include: An information acquisition module is configured to acquire original scene information of a virtual scene, and generate scene voxel data and initial height field data of a navigation grid according to the original scene information; A collision result determination module is configured to perform collision detection using the scene voxel data and the initial height field data of the navigation grid to obtain a collision detection result; a target data determination module, configured to determine target height field data of the navigation grid according to the collision detection result and the initial height field data; The navigation mesh generation module is configured to generate a navigation mesh adapted to the voxel according to the target height field data.

10. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method for generating a navigation grid as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for generating a navigation grid as described in any one of claims 1 to 8.