Collision data processing method, collision data processing device, computer program, and electronic device
By converting complex collision objects into regular solids, the method addresses the inefficiency of collision data processing in virtual scenes, enhancing processing speed and reducing computational load.
Patent Information
- Application Number
- JP2023568723
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-06-22
- Filing Date
- 2022-06-02
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2042-06-02
AI Technical Summary
Existing collision data processing methods in virtual game scenes require high computational effort due to complex geometric structures of virtual objects, leading to low processing efficiency.
Convert convex polyhedron collision objects into regular solids based on vertex distance relationships, simplifying the structure and reducing the complexity of collision data processing by using methods like converting vertex data into formats matching rectangular parallelepipeds or cylinders.
This approach significantly reduces calculation consumption and improves processing efficiency by simplifying collision data, enabling faster and more efficient collision calculations in virtual environments.
Smart Images

Figure 0007782921000001 
Figure 0007782921000002 
Figure 0007782921000003
Abstract
Description
[Technical Field]
[0001] This application claims priority from a Chinese patent application filed with the China Patent Office on June 22, 2021, bearing application number 202110694872.2 and entitled "Method and apparatus for processing collision data, storage medium, and electronic device," the entire contents of which are incorporated herein by reference.
[0002] The present application relates to the computer field, and more particularly to crash data processing methods, devices, storage media, program products, and electronic devices. [Background technology]
[0003] In a virtual game scene, many interactive actions often occur between different virtual objects, so it is necessary to calculate collision data generated by collision bodies corresponding to the above virtual objects and facilitate accurate control of the virtual objects according to the calculation results.
[0004] Collision data in related technologies is typically created in a graphics engine (e.g., 3dmax) and then imported into a game engine for use. This method requires relatively high artistic costs, and the cost of creating accurate, relatively simple collisions increases even further. Another method uses the mesh of a model directly for collisions. While this method produces highly accurate calculation results, it has the problem of high data calculation consumption due to the large number of mesh vertices in the model. The consumption here includes the following three types: 1. Consumption for searching for solids within the 3D space provided in the virtual game scene: It is necessary to search for collision bounding boxes that may collide, and the fewer the number, the lower the consumption. 2. Consumption for finding physical intersections between the above solids: The simpler the solid, the lower the consumption for finding the intersections. 3. Physical usage consumption: The less used, the lower the consumption.
[0005] In other words, the related art requires a large amount of computational effort for collision calculations of virtual objects that collide in a virtual scene, which increases the difficulty of processing collision data of collision bodies corresponding to virtual objects, resulting in a problem of low processing efficiency. Summary of the Invention [Problem to be solved by the invention]
[0006] The embodiments of the present application provide a crash data processing method, device, storage medium, program product, and electronic device that help solve the technical problem of low processing efficiency caused by the high operational difficulty of crash data processing in the related art. [Means for solving the problem]
[0007] According to one aspect of an embodiment of the present application, there is provided a collision data processing method executed by an electronic device, the method including: determining a target collision object to be processed in a virtual scene, the target collision object being a convex polyhedron including vertices; acquiring a distance relationship between vertices of the target collision object, the distance relationship representing a shape characteristic of the target collision object; and, when the target collision object is converted into a regular solid based on the distance relationship, acquiring collision data of the target collision object by converting vertex data of the target collision object in a data format matching the regular solid.
[0008] According to another aspect of the embodiment of the present application, there is further provided a collision data processing device, the device including: a first determination unit that determines a target collision object to be processed in a virtual scene, the target collision object being a convex polyhedron including vertices; a first acquisition unit that acquires a distance relationship between vertices of the target collision object, the distance relationship representing a shape characteristic of the target collision object; and a first processing unit that, when the target collision object is converted into a regular solid based on the distance relationship, acquires collision data of the target collision object by converting vertex data of the target collision object in a data format matching the regular solid.
[0009] According to another aspect of the present invention, there is further provided a computer-readable storage medium having a computer program stored therein, the computer program being configured to cause execution of the above-described crash data processing method when executed.
[0010] According to another aspect of the present invention, there is further provided an electronic device including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described crash data processing method by the computer program.
[0011] According to another aspect of an embodiment of the present application, there is further provided a computer program product including computer instructions stored on a computer-readable storage medium, the computer instructions, when executed by a processor, causing the processor to perform a collision data processing method. [Brief explanation of the drawings]
[0012] The drawings described herein are intended to provide further understanding of the present application and constitute a part of the present application. The schematic examples and the description thereof are intended to aid in the interpretation of the present application and are not to be construed as undue limitations of the present application.
[0013] [Figure 1] FIG. 1 is a schematic diagram of a hardware environment for an optional collision data processing method according to an embodiment of the present application. [Figure 2] 1 is a flowchart of an optional crash data processing method according to an embodiment of the present application. [Figure 3] FIG. 2 is a schematic diagram of an optional collision data processing method according to an embodiment of the present application. [Figure 4] FIG. 10 is a schematic diagram of another optional method for processing collision data according to an embodiment of the present application. [Figure 5] FIG. 10 is a schematic diagram of another optional method for processing collision data according to an embodiment of the present application. [Figure 6] FIG. 10 is a schematic diagram of another optional method for processing collision data according to an embodiment of the present application. [Figure 7] FIG. 10 is a schematic diagram of another optional method for processing collision data according to an embodiment of the present application. [Figure 8] 10 is a flowchart of another optional method for processing crash data according to an embodiment of the present application. [Figure 9] FIG. 2 is a schematic diagram of an optional crash data processing arrangement according to an embodiment of the present application; [Figure 10] FIG. 2 is a schematic diagram of an optional electronic device configuration according to an embodiment of the present application. DETAILED DESCRIPTION OF THE INVENTION
[0014] In order to help those skilled in the art understand the present invention better, the present invention will be described in detail below with reference to the drawings of the present invention. It is clear that the described embodiments are only some of the embodiments of the present invention, and not all of the embodiments. All other embodiments that those skilled in the art can obtain from the embodiments of the present invention without creative efforts should fall within the scope of protection of the present invention.
[0015] It should be understood that terms such as "first," "second," and the like in the specification, claims, and drawings of this application are used to distinguish between similar objects and are not necessarily used to describe a particular order or priority. term may be interchanged where appropriate, such that the embodiments of the present application described herein may be performed in orders other than those illustrated or described herein. Also, the terms "comprises," "includes," and any variations thereof are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to the explicitly listed steps or units, but may include other steps or units that are not explicitly listed or that are inherent to the process, method, product, or apparatus.
[0016] According to one aspect of the embodiment of the present application, a collision data processing method is provided. The collision data processing method may be applied to a collision data processing system in a hardware environment such as, but not limited to, the one shown in FIG. 1 . Here, the collision data processing system may include, but is not limited to, a terminal device 102, a network 104, a server 106, and a database 108. The terminal device 102 runs a target client (e.g., a game client as shown in FIG. 1 ) logged in with a target user account. The terminal device 102 includes a human-computer interaction screen, a processor, and a memory. The human-computer interaction screen displays a virtual scene (e.g., a virtual game scene in a game task appears on the display interface shown in FIG. 1 ) and provides a human-computer interaction interface for receiving human-computer interaction operations to control virtual objects. The virtual object can detect interactions of its physical attributes occurring in the virtual scene with the target collision body placed relative to it, i.e., can detect whether a collision occurs between the target collision body corresponding to the virtual object, but is not limited to this. The processor generates an interaction command in response to the above human-computer interaction operation and sends the interaction command to the server. The memory stores attribute data related to the virtual object.
[0017] The server 106 also includes a processing engine, which performs storage or read operations on the database 108. Specifically, the processing engine determines whether the target collision body can be converted into a regular solid based on the distance relationship, and if it is determined that the target collision body can be converted into a regular solid, converts the vertex data of the target collision body into a data format matching the regular solid and stores it in the database 108, and also reads the simplified collision data from the database 108 for collision calculation.
[0018] The specific process is as follows: In step S102, the server 106 acquires, via the network 104, a target collision object 100 to be processed in the virtual scene determined by the terminal device 102 (which may be a collision object corresponding to a part of the body of the virtual object, as shown in FIG. 1). The target collision object here is a convex polyhedron including vertices. Next, in steps S104 to S106, the server 106 acquires the distance relationship between the vertices of the target collision object, and if the server 106 converts the target collision object into a regular solid based on the distance relationship, acquires collision data of the target collision object by converting the vertex data of the target collision object in a data format that matches the regular solid.
[0019] For illustrative purposes, in this embodiment, a target collision object to be processed in a virtual scene is determined, and then the distance relationship between the vertices of the target collision object is obtained. Based on the distance relationship, it is determined whether the target collision object can be converted into a regular solid with a simplified structure. If it is determined that the target collision object can be converted into a regular solid, the vertex data of the target collision object is converted into a data format matching the regular solid, thereby obtaining collision data of the target collision object after the simplification process. This enables the target collision object with a complex structure to be converted into a regular solid with a simplified structure, and the collision data of the collision object to be stored in a data format matching the regular solid. Performing collision calculations using the simplified collision data reduces the calculation consumption of the collision data by electronic devices, improves the processing efficiency of the collision data by electronic devices, and overcomes the problem of low collision data processing efficiency in related art.
[0020] In one embodiment, the terminal device may be a terminal device on which a target client is located, and may include, but is not limited to, at least one of a mobile phone (e.g., an Android mobile phone, an iOS mobile phone, etc.), a laptop, a tablet computer, a palmtop computer, a mobile internet device (MID), a PAD, a desktop computer, a smart TV, etc. The target client may be a client configured with a virtual object requiring physical interaction, such as a video client, an instant communication client, a browser client, or an education client, and the virtual object performs interaction collision calculations using a collision object. The network may include, but is not limited to, a wired network and a wireless network. The wired network includes a local area network, a metropolitan area network, and a wide area network, and the wireless network includes Bluetooth, Wi-Fi, and other networks that enable wireless communication. The server may be a single server, a server cluster consisting of multiple servers, or a cloud server. The above is merely an example. However, the present embodiment is not limited thereto.
[0021] In one embodiment, as shown in Fig. 2, the collision data processing method may be performed in, for example, an electronic device, such as the terminal device or server shown in Fig. 1. The method includes the following steps:
[0022] In S202, a target collision object to be processed in the virtual scene is determined, and the target collision object is a convex polyhedron including vertices.
[0023] The target collision object may be, but is not limited to, a collision object placed against a virtual object in a virtual scene (e.g., a three-dimensional object in a virtual scene). The virtual object here may be, but is not limited to, a dynamic object that appears in the virtual scene, such as a virtual character, a virtual item, or a vehicle controlled by a user, or a static object that has been placed in advance, such as a building or a plant landscape. The collision object may be, but is not limited to, a carrier placed against the virtual object for detecting a collision that occurs during interaction. The target collision object in this embodiment has a complex structure designed to fit the structural frame of the virtual object itself (e.g., the skeletal frame of a virtual character, the steel structural frame of a building, etc.), i.e., a convex polyhedron including multiple vertices.
[0024] In S204, the distance relationship between the vertices of the target collision body is acquired. The distance relationship is used to represent the shape characteristics of the target collision body.
[0025] It should be noted that in related art, the large consumption of collision calculations in electronic devices is due to the fact that the geometric structure of the collision object is usually complex, requiring the introduction of a large amount of vertex data, resulting in the consumption of a large amount of data calculations when performing collision calculations and artistic production. To overcome the above problem, this embodiment provides a configuration for simplifying the target collision object based on the distance relationship between the vertices of the target collision object, converting the target collision object into a regular solid with a simplified structure, and storing collision data in the regular solid, thereby improving the calculation efficiency of the electronic device's processing of collision data of the collision object (for example, improving the calculation efficiency of determining whether the collision object will collide).
[0026] In one embodiment, the distance relationship between each vertex represents the result of comparing the distances between each vertex. This distance relationship can reflect the shape characteristics of the target impactor. The distance relationship may be a relationship between multiple distances determined by scanning each vertex of the target impactor, setting each vertex as the current vertex, and respectively obtaining the distances between the current vertex and each of the other vertices (i.e., vertices other than the current vertex). This distance relationship can be used to recognize the target impactor as a regular solid with a similar structure. Here, regular solids may include, but are not limited to, a rectangular parallelepiped and a cylindrical solid. The vertex data of the target impactor is converted into the data format of a similar regular solid, i.e., the format of the vertex data is converted into the data format of a similar regular solid, thereby achieving the goal of simplifying the impactor collision data.
[0027] In S206, when the target collision object is converted into a regular solid based on the distance relationship, collision data of the target collision object is acquired by converting the vertex data of the target collision object into a data format that matches the regular solid. The data format of the collision data matches the data format of the regular solid. The collision data of the target collision object is for representing the target collision object with a simplified structure.
[0028] In one embodiment, the data format corresponding to the regular solid may be, but is not limited to, a format corresponding to the index parameters of the regular solid. For example, if the regular solid is a rectangular parallelepiped, the index parameters of the regular solid may include a center point coordinate and a convergence direction of a oriented bounding box. If the regular solid is a cylinder, the index parameters of the regular solid may include, but are not limited to, a center point coordinate and a radius. This is merely an example. However, this embodiment is not limiting in any way.
[0029] In one embodiment, the regular three-dimensional rectangular parallelepiped may include, but is not limited to, a standard rectangular parallelepiped and a reference rectangular parallelepiped, and the reference rectangular parallelepiped may be, but is not limited to, a structure similar to the structure of the standard rectangular parallelepiped, i.e., an approximate rectangular parallelepiped.
[0030] In one embodiment, after determining the reference rectangular parallelepiped, The method comprises: To further recognize a structure specifically corresponding to the reference rectangular parallelepiped in the virtual scene, the method may further include, but is not limited to, extracting convex features of the reference rectangular parallelepiped (e.g., performing feature extraction on the convex surface of the reference rectangular parallelepiped). For example, if the side lengths of two of the three axes (length, width, and height) of the reference rectangular parallelepiped are small and much smaller than the side length of the third axis, the reference rectangular parallelepiped can be recognized as a wooden stick. If the side length of one axis is short and much smaller than the side lengths of the other axes, the reference rectangular parallelepiped can be recognized as a roof. The side lengths of the three axes are three values including the length, width, and height of the reference rectangular parallelepiped. This is merely an example. However, this embodiment is not limiting in any way.
[0031] In one embodiment, the above collision data processing method may be applied to the data optimization process of a collision body corresponding to a single virtual object model, but is not limited thereto. The simplification and optimization process may also be performed in batch on the data of collision bodies corresponding to all virtual object models in a virtual scene, thereby improving the efficiency of collision data processing by electronic devices.
[0032] In addition, in one embodiment, different precision levels may be selected to process collision data according to different specific applications, but are not limited to this. For example, when applied to a client, the precision requirement for collision data processing may be relatively high, while when applied to a server, the precision requirement for collision data processing may be relatively low. It should be noted that the precision level referred to here may refer to, but is not limited to, the data precision when converting collision data. By distinguishing between different precision levels in collision data processing, art designers are not required to have a deep understanding of simplification and optimization algorithms and their parameters, and processing operations with multiple precision levels can be easily provided, thereby achieving the goal of simplifying processing operations and improving the processing efficiency of electronic devices.
[0033] According to an embodiment of the present application, a target collision object to be processed in a virtual scene is determined, and then the distance relationship between the vertices of the target collision object is obtained. Based on the distance relationship, it is determined whether the target collision object can be converted into a regular solid with a simplified structure. If it is determined that the target collision object can be converted into a regular solid, the vertex data of the target collision object is converted into a data format matching the regular solid, thereby obtaining collision data of the target collision object after the simplification process. This enables the target collision object with a complex structure to be converted into a regular solid with a simplified structure, and the collision data of the collision object to be stored in a data format matching the regular solid. Performing collision calculations using the simplified collision data reduces the calculation consumption of the collision data and improves the processing efficiency of the collision data, thereby overcoming the problem of low collision data processing efficiency in electronic devices in the related art.
[0034] Optionally, the step of obtaining a distance relationship between each vertex of the target impactor includes: When the number of vertices of the target collision object reaches a first threshold, the method includes a step of respectively obtaining distance relationships between a plurality of sides connected to each vertex of the target collision object, i.e., determining a comparison result of the lengths of the plurality of sides.
[0035] Additionally, the collision data processing method further includes a step of converting the target collision body into a standard rectangular parallelepiped when the distance relationship indicates that three sides connected to one target vertex of the target collision body are perpendicular to each other, where the regular solid includes a standard rectangular parallelepiped, where one target vertex is a vertex having three sides connected thereto that are perpendicular to each other.
[0036] In one embodiment, the first threshold may be, but is not limited to, the number of vertices of a standard rectangular parallelepiped. The first threshold may be, but is not limited to, 8. That is, when the number of vertices of the target impactor reaches 8, the distances between the vertices are obtained, and based on the relationship between the distances, it is determined whether the target impactor is a standard rectangular parallelepiped.
[0037] In one embodiment, before obtaining the collision data of the target impactor by converting the vertex data of the target impactor in a data format that matches the regular solid, The method comprises: determining a current vertex from among the vertices of the target collision body, and determining a first reference point and a second reference point that are closest to the current vertex; obtaining a first distance between the current vertex and a first reference point and a second distance between the current vertex and a second reference point; determining a third distance based on the first distance and the second distance, the third distance being the length of the hypotenuse of a right-angled triangle, the right-angled triangle having the first distance and the second distance as the lengths of the right angles of the triangle; Among the vertices of the target collision body, the current vertex, the first reference Light point and determining a third reference point from among the vertices excluding the second reference point according to a third distance, where the distance between the current vertex and the third reference point is the third distance; determining a reference plane of the target impactor based on the first reference point, the second reference point, and the third reference point; Among the vertices of the target collision body, the current vertex, the first reference Light pointdetermining a fourth reference point that is closest to the current vertex from among the vertices excluding the second and third reference points, wherein a line connecting the fourth reference point and the current vertex is perpendicular to the reference plane; determining the current vertex as a target vertex, and determining a convergence direction of an oriented bounding box matched to the standard cuboid based on the first distance, the second distance, and a fourth distance between the current vertex and a fourth reference point, wherein the vertex data includes a direction vector of the convergence direction of the oriented bounding box.
[0038] Specifically, the description will be made with reference to the target impactor shown in FIG.
[0039] When it is determined that the number of vertices of the target impactor has reached 8, it scans and calculates from any one point. As shown in FIG. 3, it is assumed that the calculation starts from the current vertex, vertex A. Find the two closest vertices B (i.e., the first reference point) and vertex C (i.e., the second reference point) from vertex A. The distance AB corresponds to L1 (the thick horizontal line shown in FIG. 3, i.e., the first distance), and the distance AC corresponds to L2 (the thick vertical line shown in FIG. 3, i.e., the second distance). Based on the rectangular parallelepiped rule, it can be determined that vertex A, vertex B, and vertex C are adjacent vertices, and AB is perpendicular to AC.
[0040] Next, based on the positions of vertices B and C and the distances L1 and L2 between them, the hypotenuse of triangle ABC is calculated. B Calculate the distance Lx of C. Scan the remaining vertices of the target impactor to sequentially obtain the distance between each vertex and vertex A. Determine vertex D (i.e., the third reference point), whose distance to vertex A is also Lx (i.e., the third distance), as the last point on the plane on which triangle ABC is located (i.e., the reference plane).
[0041] Next, the distances from the remaining vertices, excluding vertices B, C, and D, to vertex A are scanned to find vertex E, which is closest to vertex A. From the geometric relationship of the rectangular parallelepiped, it can be determined that AB, AC, and AE are the three mutually perpendicular edges of the rectangular parallelepiped. The vectors corresponding to these three edges can be determined as the forward vector, right vector, and up vector of the standard rectangular parallelepiped. The lengths of the three edges are scanned and compared, and the longest edge AE (whose distance is the fourth distance) is recognized as the forward vector of the rectangular parallelepiped, which is determined as the precise convergence direction of the oriented bounding box (OBB) of the currently recognized standard rectangular parallelepiped.
[0042] According to the embodiment provided in the present application, when the number of vertices of the target impactor reaches a first threshold and the three edges connected to the target vertices are perpendicular to each other, the target impactor is recognized as a standard rectangular parallelepiped, and then the convergence direction of the OBB of the standard rectangular parallelepiped is determined based on the distance relationship between the target vertices and the other vertices. Then, the vertex data of the target impactor is converted into a data format corresponding to the standard rectangular parallelepiped to obtain collision data of the target impactor converted into a simplified standard rectangular parallelepiped, thereby simplifying the collision data and achieving the effect of improving the efficiency of electronic equipment using the collision data during collision calculation.
[0043] Optionally, the step of obtaining a distance relationship between each vertex of the target impactor includes: Step S1: when the number of vertices of the target impactor reaches a first threshold, determining a center coordinate point of all vertices of the target impactor, where the center coordinate point is an average value of the coordinate values of all vertices; and step S2 of obtaining a distance relationship between each vertex and the central coordinate point, where the distance relationship corresponding to any one vertex represents the distance between the vertex and the central coordinate point.
[0044] In one embodiment, in addition to determining the distance relationship, the collision data processing method includes: Step 1) of determining that the target collision object is recognized as a reference rectangular parallelepiped when the distance relationship indicates that the distance between each vertex and the central coordinate point is smaller than a first distance threshold, and the regular solid includes the reference rectangular parallelepiped; The method may further include step 2) determining that the target impactor is recognized as a reference rectangular parallelepiped when at least two sets of parallel planes are determined based on the distance relationship between the vertices, where the regular solid includes the reference rectangular parallelepiped, where each set of parallel planes includes two parallel planes, and each of the two parallel planes includes, for example, four vertices.
[0045] It should be noted that not all collision objects appearing in the virtual scene are standard rectangular parallelepipeds, but most are approximate rectangular parallelepipeds (i.e., reference rectangular parallelepipeds, also called roughly standard rectangular parallelepipeds). Therefore, in this embodiment, whether a target collision object is a roughly standard rectangular parallelepiped may be determined by at least one of the following methods: 1) If the distances between all vertices of the collision object and the central coordinate point are roughly equal (i.e., all distances between each vertex and the central coordinate point are smaller than a first distance threshold), the collision object can be determined to be a roughly standard rectangular parallelepiped. 2) If there are at least two pairs of roughly parallel planes at the eight vertices of the collision object (i.e., at least two pairs of parallel planes are determined based on each vertex), the collision object can be determined to be a roughly standard rectangular parallelepiped.
[0046] In one embodiment, after determining that the target impact body is recognized as the reference rectangular parallelepiped, the impact data processing method further includes the steps of obtaining a first volume value corresponding to the target impact body and a second volume value corresponding to the reference rectangular parallelepiped, determining a ratio between the first volume value and the second volume value, and determining that the target impact body is converted into the reference rectangular parallelepiped if the ratio reaches a second threshold.
[0047] It should be noted that the second threshold value may be different depending on the specific application scenario, but is not limited thereto. For example, when applied to a client, the accuracy requirement for crash data processing is relatively high, so the threshold value is set to a high value. When applied to a server, the accuracy requirement for crash data processing is relatively low, so the threshold value is set to a low value. Here, the range of the second threshold value is a value equal to or less than 1.
[0048] For example, assuming the second threshold is 1, if the ratio between the first volume value V1 corresponding to the target collision object and the second volume value V2 corresponding to the reference cuboid is p, the ratio p is compared with the second threshold 1. If p=1, it is determined that the target collision object recognized as the reference cuboid can be converted into the reference cuboid. If the ratio is smaller than the second threshold 1, it indicates that there is a large difference between the two, and there is no need to convert the target collision object recognized as the reference cuboid into the reference cuboid, and therefore there is no need to convert the vertex data of the target collision object into collision data that matches the data format of the reference cuboid.
[0049] According to the embodiment provided herein, if the distance between each vertex and the central coordinate point is smaller than a first distance threshold, or if each vertex has at least two pairs of parallel faces, the target collision object is recognized as a reference rectangular parallelepiped (approximate rectangular parallelepiped). In this case, the reliability of the approximate recognition result is verified using the volume comparison result between the target collision object and the reference rectangular parallelepiped. If the volume comparison result indicates that the threshold condition is met, it is determined to convert the vertex data of the target collision object into collision data in a format corresponding to the simplified reference rectangular parallelepiped, in order to achieve the effect of improving the efficiency of processing using collision data during collision calculation.
[0050] Optionally, after determining to transform the target impactor into a reference cuboid, the impact data processing method comprises: Step S1 of determining a projection plane corresponding to a reference rectangular parallelepiped; Step S2 of obtaining projection points corresponding to each vertex by mapping each vertex of the reference rectangular parallelepiped onto the projection plane; Step S3 of obtaining a first plane vertex set and a second plane vertex set by grouping each vertex based on a projection distance from the vertex to a corresponding projection point, where the vertices in the first plane vertex set are located on a first plane, and the vertices in the second plane vertex set are located on a second plane; If the first plane and the second plane are parallel, the method further includes step S4 of determining a convergence direction of an oriented bounding box matched to the reference rectangular parallelepiped based on the first plane and the second plane, wherein the vertex data includes a direction vector of the convergence direction of the oriented bounding box.
[0051] It should be noted that after recognizing the target collision object as a reference rectangular parallelepiped, it is necessary to convert it into a Box collision box and also recognize the convergence direction of the OBB corresponding to the bounding box. As an optional example, the convergence direction of the OBB of the reference rectangular parallelepiped may be determined by, but is not limited to, a projection plane separation axial OBB convergence algorithm.
[0052] Specifically, the description will be made with reference to the target impactor shown in FIG.
[0053] As shown in Figure 4, it is assumed that the target impactor is recognized as a reference rectangular prism, and the projection plane corresponding to the reference rectangular prism is determined to be a plane constituted by the shaded area shown in Figure 4, which is a vertical plane perpendicular to the horizontal plane.
[0054] Next, all vertices of the reference rectangular parallelepiped are scanned, and the explanation will continue using vertex A as an example. A projection point A1 of vertex A on the projection plane is calculated, and then projection points corresponding to each of the other vertices on the projection plane are found. Furthermore, assume that the distance between the projection point B1 of vertex B and the projection point A1 on the projection plane (the distance between the dotted lines A1 and B1 in the figure) is the shortest. Next, the projection distances of AA1 and BB1 are compared, and based on the distance comparison results, vertices A and B are divided into far plane points and near plane points.
[0055] After scanning all the vertices of the reference rectangular parallelepiped, four vertices of the far-distance plane and four vertices of the near-distance plane are determined from the eight vertices of the reference rectangular parallelepiped, i.e., a first plane vertex set and a second plane vertex set. If the vertices in the first plane vertex set are located on the first plane, the vertices in the second plane vertex set are located on the second plane, and the first and second planes are approximately parallel, it can be further determined that the reference rectangular parallelepiped is an approximate rectangular parallelepiped. Next, for the reference rectangular parallelepiped determined based on the method described herein, the three axial directions of the rectangular parallelepiped, i.e., forward, right, and up, are recognized using the above method.
[0056] After determining the three axis directions, a scan calculation is performed again for all vertices of the reference rectangular parallelepiped, and the vertices are projected in each of the three axis directions to obtain the maximum and minimum values. Next, based on the maximum and minimum values obtained here, the average values along each axis, i.e., the half-edge length value in the X-axis direction (ExtendX), the half-edge length value in the Y-axis direction (ExtendY), and the half-edge length value in the Z-axis direction (ExtendZ), are calculated. Next, the correct convergence direction of the OBB is obtained through convergence.
[0057] Without the OBB convergence algorithm, the impactor's display effect is badly mismatched, as shown in the left image of Figure 5. With a rough calculation of the OBB orientation, the display effect is oriented correctly but still poorly matched, as shown in the center image of Figure 5. With the full OBB convergence algorithm, the display effect can accurately match the original model, as shown in the right image of Figure 5.
[0058] According to the embodiment provided in the present application, a projection plane separation axial OBB convergence algorithm is used to determine a more accurate convergence direction relative to a reference rectangular prism, thereby facilitating conversion to collision data that is easy to store and process.
[0059] Optionally, after determining to transform the target impactor into a reference cuboid, the impact data processing method comprises: Step S1 of determining a forward direction vector corresponding to a geometric center point of a reference rectangular parallelepiped and determining a vertical plane including said forward direction vector; A vertical plane with the direction of the forward vector as an axis Duplicate Rotate it a number of times (e.g., rotate it N times, where N is a positive integer), and after each rotation: Step S2 of performing an operation of obtaining a third plane vertex set and a fourth plane vertex set by grouping each vertex of the reference rectangular parallelepiped based on a vertical distance from each vertex to a vertical plane, wherein the vertices in the third plane vertex set are located on the third plane, and the vertices in the fourth plane vertex set are located on the fourth plane; If the third plane and the fourth plane are parallel, the method further includes step S3 of determining a convergence direction of an oriented bounding box matched to the reference rectangular parallelepiped based on the third plane and the fourth plane, wherein the vertex data includes a direction vector of the convergence direction of the oriented bounding box.
[0060] It should be noted that after recognizing the target collision object as a reference cuboid, it is necessary to convert it into a Box collision box and also recognize the convergence direction of the OBB corresponding to the bounding box. As an optional example, the convergence direction of the OBB of the reference cuboid may be determined by, but not limited to, a rotational recursive convergence OBB algorithm.
[0061] Specifically, the following example will be used for explanation: Let us take horizontal rotation recursion as an example.
[0062] A forward vector is generated based on the geometric center point of the reference rectangular parallelepiped, and recursive calculations are performed by rotating 0 to 360 degrees around the axis forward, using the vertical plane of the forward direction as a reference.
[0063] In each recursive rotation, the vertical plane is controlled to rotate by one degree around the axis, and then, at that angle, the vertical distances from all vertices of the reference rectangular parallelepiped to the vertical plane are calculated, and sets of vertices with approximately the same vertical distance are tallied to obtain multiple sets of vertices with approximately the same distance.
[0064] After the 360-degree rotation process is completed and the recursive rotation operation result is obtained, a set of vertices with the largest number and the closest distance is found from the vertical plane and determined as a candidate plane vertex set. Furthermore, it is determined whether the plane determined based on the candidate plane vertex set is parallel to the reference vertical plane. If it is determined that they are parallel, it can further be determined that the reference rectangular parallelepiped is an approximate rectangular parallelepiped. Next, for the reference rectangular parallelepiped determined based on the method described herein, the three axial directions of the rectangular parallelepiped, i.e., forward, right, and up, are recognized using the above method.
[0065] After determining the three axis directions, we perform a scan calculation again for all vertices of the reference rectangular parallelepiped, project them in each of the three axis directions, and obtain the maximum and minimum values. Based on these maximum and minimum values, we calculate the average values along each axis, i.e., the half-edge length value in the X-axis direction (ExtendX), the half-edge length value in the Y-axis direction (ExtendY), and the half-edge length value in the Z-axis direction (ExtendZ). Next, we obtain the correct convergence direction of the OBB through convergence.
[0066] According to the embodiment provided in this application, a rotational recursive convergence OBB algorithm is used to determine a more accurate convergence direction relative to a reference rectangular parallelepiped, facilitating conversion to collision data that is easy to store and process.
[0067] Optionally, after determining the ratio between the first volume value and the second volume value, the collision data processing method further comprises: If the ratio does not reach the second threshold, extracting a convex feature of the reference rectangular parallelepiped, the convex feature including the side lengths of three axial sides corresponding to the reference rectangular parallelepiped, the three axial sides being mutually perpendicular sides of the reference rectangular parallelepiped; determining that the reference rectangular parallelepiped is to be converted into a long rod-type rectangular parallelepiped when a first difference between the side length of the first axis direction side and the side length of the third axis direction side and a second difference between the side length of the second axis direction side and the side length of the third axis direction side are both greater than a second distance threshold; The method further includes a step of determining to convert the reference rectangular prism into a roof-type rectangular prism if a third difference between the side length of the first axis direction side and the side length of the second axis direction side and a fourth difference between the side length of the first axis direction side and the side length of the third axis direction side are both greater than a third distance threshold.
[0068] It should be noted that the transformation method provided in the above method of this embodiment supports transforming the convex hull of most obvious collision objects into a rectangular parallelepiped or other regular solids (such as a cylinder or a capsule), but there are still some special and highly variable collision objects that cannot be directly subjected to the appropriate simplified transformation process. These special collision objects can have obvious geometric characteristics, but are not limited to:
[0069] One implementation example In the above, the geometric features to be referenced when transforming the above special collision body may include, but are not limited to, a convex feature, which is the distance relationship between the three axial sides of the OBB recognized from the reference rectangular prism.
[0070] For example, if two of the three axial sides are short and much smaller than the third axial side, the reference rectangular prism here is converted into a long rod-type prism. If one of the three axial sides is short and much smaller than the other axial sides, the reference rectangular prism here is converted into a roof-type prism.
[0071] According to the embodiment provided in the present application, some special collision objects are further recognized and converted based on some recognizable convex features, and then converted into a determined specific rectangular prism data format, thereby achieving the effect of performing a simplification process on the collision data of the collision objects.
[0072] Optionally, after obtaining the distance relationship between each vertex and the center coordinate point, the collision data processing method includes: If it is determined that the target impactor is not a reference rectangular parallelepiped, a step S1 of obtaining a geometric center point of the target impactor; Step S2 of obtaining the distance between each vertex of the target impact body and the geometric center point; Step S3: if the difference between the distances of the connecting lines is smaller than a third threshold, recognize the target impact object as a cylindrical body, where the regular solid includes a cylindrical body; and Step S4 of constructing a spatial function of the cylinder based on the coordinates of the geometric center point and the radius of the cylinder, where the vertex data includes the spatial function of the cylinder.
[0073] It should be noted that if the number of vertices of the target impactor is not the first threshold, it is determined that the target impactor does not meet the recognition condition for a rectangular prism, and it can be further determined whether the target impactor meets the recognition condition for a cylindrical prism.
[0074] For example, the geometric center point of the target collision object is determined based on each vertex of the target collision object. Next, the distance of the vertical vector from each vertex to the geometric center point (i.e., the distance of the line connecting each vertex to the geometric center point) is calculated. If the distances from all vertices to the geometric center point are approximately equal (i.e., the difference between the line distances is smaller than a third threshold), the target collision object is recognized as a cylinder, not a reference rectangular parallelepiped.
[0075] Next, by constructing the spatial function of the cylinder directly based on the coordinates and radius of the geometric center point of the cylinder recognized above, it is easy to convert the vertex data of the target impactor with the above complex structure into the format of the spatial function that matches the cylinder.
[0076] It should be noted that if the radius of the recognized cylinder is not the same at the top and bottom, for example, if the cylinder is larger at the top and smaller at the bottom, it needs to be segmented. For example, a complex convex body can be decomposed and merged into multiple simple bounding boxes. The segmentation method of the cylinder can be similar to, but not limited to, the segmentation method of the convex body decomposition algorithm.
[0077] According to the embodiment provided in the present application, if it is determined that the target impactor is not a reference rectangular parallelepiped, it is determined whether the target impactor can be recognized as a cylinder. If the target impactor is recognized as a cylinder, data of the target impactor that matches the cylinder is determined to facilitate simplified conversion. This achieves the purpose of reducing the operational complexity when storing the impact data of the target impactor, and further improves the processing efficiency when the electronic device retrieves the stored impact data to perform impact calculations.
[0078] Optionally, before obtaining the collision data of the target impactor by converting the vertex data of the target impactor in a data format that matches the regular solid, the collision data processing method includes: Step S1 of obtaining multiple sub-impact bodies by decomposing the target impact body using equidistant bounding boxes; Step S2 of determining an intersection point between a line connecting each vertex of the target collision body and each of the sub-collision bodies of the plurality of sub-collision bodies; Step S3: Obtaining a sub-boundary box corresponding to each sub-impact body by sequentially performing convergent combination on the intersection points within each sub-impact body; Step S4: Obtain a body bounding box corresponding to the target impactor by scanning each sub-bounding box and merging the sub-bounding boxes whose size difference is less than a fourth threshold; The method further includes step S5 of setting the vertex data of the body bounding box as the vertex data of the target collision body.
[0079] It should be noted that, in this embodiment, for a convex body with a complex structure, a convex body decomposition algorithm may be used to decompose the complex target impactor and then merge it into multiple simple bounding boxes, but this is not limited to this.
[0080] Specifically, the description will be made with reference to the flow of the convex body decomposition algorithm shown in FIG.
[0081] Assume that the target impactor (hereinafter referred to as the convex body) is a cone as shown in Figure 6(a). The convex body is selected to perform the decomposition process as shown in Figure 6(b). For example, depending on the size of the convex body, an equidistant bounding box constructed at unit distance is used to decompose the convex body into multiple sub-impactors. The decomposition result may be three equally sized rectangular parallelepipeds as shown in Figure 6(c).
[0082] Next, the intersections of the lines connecting the vertices of the target impactor and each sub-impactor are determined. For example, the convex body shown in FIG. 7(a) is the convex body shown in FIG. 6(a). As shown in FIG. 7(b), the upper intersection determination process is performed from the lower vertex upward, and the lower intersection determination process is performed from the upper vertex downward. Here, intersection determination refers to determining the intersections.
[0083] Next, by sequentially performing convergent combination on the intersections within each sub-body, a bounding box with a small usage space, i.e., a bounding box consisting of all intersections, is obtained. The bounding box indicated by the dotted frame in Figure 6(d) is a sub-bounding box obtained by converging the equidistant decomposition bounding box (shown by the thick solid line in the figure) in Figure 6(c). Furthermore, a size determination is performed on the sub-bounding boxes, and bounding boxes whose sizes are similar and smaller than a threshold (i.e., the size difference is smaller than a fourth threshold) are merged into a larger bounding box (i.e., the body bounding box). As shown in Figure 6(e), the two lower sub-bounding boxes are merged into one larger bounding box.
[0084] According to the embodiment provided in the present application, the target impactor is divided by an equidistant bounding box, and then simplified into sub-impactors that use less space. The sub-impactors are then recombined and merged to simplify the structure of the target impactor, thereby achieving the same goal of obtaining simplified and optimized impact data.
[0085] Optionally, after converting the target impactor into a regular solid based on the distance relationship, the impact data processing method includes: If the regular solid contains several regular subsolids, a step S1 of determining the size of each regular subsolid; a step S2 of merging two adjacent regular sub-solids if the difference in size between the two adjacent regular sub-solids is less than a fifth threshold; Among multiple regular sub-solids, the size of the first regular sub-solid and the size of the second regular sub-solid Size and the difference is smaller than a sixth threshold value and the first regular sub-solid is located inside the second regular sub-solid, the step S3 of removing the first regular sub-solid.
[0086] For illustrative purposes, when a regular solid contains multiple regular subsolids, further processing may be performed using, but not limited to, a combining and merging algorithm or a small object removal algorithm. The combining and merging algorithm merges two adjacent rectangular parallelepipeds into a single rectangular parallelepiped if they are close in size (i.e., the difference in size between two adjacent regular subsolids is less than a fifth threshold) or if they are contained within each other. The small object removal algorithm merges two adjacent rectangular parallelepipeds into a single rectangular parallelepiped if their bounding boxes are much smaller than the surrounding bounding boxes (i.e., the size of the first regular subsolid is smaller than the size of the second regular subsolid). Size If a bounding box is embedded inside another bounding box (the difference between the two is smaller than the sixth threshold), it is directly removed.
[0087] In this embodiment, an error check may be performed after the conversion is completed, but is not limited to this. Each vertex of the converted rectangular parallelepiped is compared with that of the original target collision object, and if the difference is smaller than the error range, it indicates that the conversion is successful; otherwise, the conversion is not performed.
[0088] According to the embodiments provided herein, combinations and mergers are used to facilitate simplified crash data acquisition. Removal By the method of (1), a unified simplification process is performed on a complex regular solid containing a plurality of regular sub-solids.
[0089] Optionally, obtaining collision data of the target impactor by converting vertex data of the target impactor in a data format that matches the regular solid includes obtaining collision data by converting vertex data of the target impactor in a data format of geometrical characteristics that matches the regular solid.
[0090] Optionally, in this embodiment, when the target impact body is transformed into a rectangular parallelepiped, it is transformed and stored in a data format of geometric indicators that match the rectangular parallelepiped, such as the coordinates of the center coordinate point and the direction vector of the convergence direction of the OBB, etc. When the target impact body is transformed into a cylindrical body, it is transformed and stored in a data format of geometric indicators that match the cylinder, such as the geometric center point and radius of the cylinder, etc.
[0091] According to the embodiment provided in the present application, the vertex data of the target impact body is stored in a data format of geometrical indices that match a regular solid, simplifying the storage method of the collision data of the target impact body with a complex structure and improving the processing efficiency when retrieving the collision data and performing collision calculations.
[0092] More specifically, the example shown in FIG. 8 will be described.
[0093] After obtaining the target collision object, it is physically simplified. First, it is determined whether the target collision object is a capsule (i.e., a cylinder). If the target collision object is a capsule, it is directly converted into a capsule object, which is easier to process, and the vertex data of the target collision object is converted and stored in a data format corresponding to the capsule object. The conversion process can be performed by referring to the flow of a rectangular parallelepiped (e.g., a box) as follows.
[0094] If it is determined that the target impactor is not a capsule but a standard rectangular parallelepiped, the Box transformation process is used to accurately transform the target impactor into a standard rectangular parallelepiped, and the corresponding OBB convergence direction is calculated. Next, the vertex data of the target impactor is converted into a standard rectangular parallelepiped data format to obtain the collision data. Here, the OBB convergence direction calculation methods include a projection plane solution method and a rotation recursive solution method. Then, the converted standard rectangular parallelepiped undergoes a combination / merging or small object removal process and an error check process. After passing the check, the converted collision data is exported for use.
[0095] If it is determined that the target collision object is not a capsule body but a roughly standard rectangular parallelepiped, a roughly box transformation flow is used to perform unit decomposition and independent convergence decomposition processing, and the decomposed bounding boxes are merged. Then, the vertex data of the target collision object is converted into a roughly standard rectangular parallelepiped data format to obtain collision data. Then, an error check process is performed on it. After the check is passed, the converted collision data is exported and used.
[0096] The above figure 8 The flow shown in is an example, but the present embodiment is not limited to it.
[0097] For ease of explanation, each of the above-described method embodiments is expressed as a combination of a series of operations, but those skilled in the art should know that the present application is not limited by the order of the operations described, since some steps can be performed in other orders or simultaneously. Next, those skilled in the art should also know that all of the embodiments described in the specification belong to preferred embodiments, and that such operations and modules are not necessarily required for the present application.
[0098] According to another aspect of the present invention, there is further provided a collision data processing device for implementing the above collision data processing method. As shown in FIG. 9, the device comprises: a first determination unit 902 for determining a target impactor to be processed in the virtual scene, the target impactor being a convex polyhedron with vertices; a first acquisition unit 904 for acquiring a distance relationship between each vertex of the target impact body, the distance relationship being for representing a shape feature of the target impact body; and a first processing unit 906 that, when the target collision body is converted into a regular solid based on the distance relationship, acquires collision data of the target collision body by converting the vertex data of the target collision body into a data format that matches the regular solid.
[0099] In this embodiment, the embodiment of the collision data processing device can refer to the above method embodiment, but is not limited thereto, and the description thereof will be omitted here.
[0100] Optionally, the first acquisition unit: a first acquisition module for acquiring distance relationships between a plurality of edges connected to each of the vertices of the target collision object when the number of vertices of the target collision object reaches a first threshold; and a first determination module that determines to convert the target collider into a standard rectangular parallelepiped when the distance relationship indicates that three sides connected to one target vertex of the target collider are perpendicular to each other, where the regular solid includes a standard rectangular parallelepiped. A target vertex refers to a vertex having three sides connected thereto that are perpendicular to each other.
[0101] In this embodiment, the embodiment of the collision data processing device may refer to the embodiment of the method described above, but is not limited thereto, and a description thereof will be omitted here.
[0102] Optionally, the collision data processing device comprises: Before acquiring the collision data of the target collision body, the vertex data of the target collision body is converted into a data format that matches the regular solid. determining a current vertex from among the vertices of the target collision body, and determining a first reference point and a second reference point that are closest to the current vertex; obtaining a first distance between the current vertex and a first reference point and a second distance between the current vertex and a second reference point; determining a third distance based on the first distance and the second distance, the third distance being the length of a hypotenuse of a right-angled triangle, the right-angled triangle having the first distance and the second distance as the lengths of its right angles; Among the vertices of the target collision body, the current vertex, the first reference Light point and determining a third reference point from among the vertices excluding the second reference point according to a third distance, where the distance between the current vertex and the third reference point is the third distance; determining a reference plane of the target impactor based on the first reference point, the second reference point, and the third reference point; Among the vertices of the target collision body, the current vertex, the first reference Light point determining a fourth reference point that is closest to the current vertex from among the vertices excluding the second and third reference points, wherein a line connecting the fourth reference point and the current vertex is perpendicular to the reference plane; determining the current vertex as a target vertex, and determining a convergence direction of an oriented bounding box matched to the standard cuboid based on the first distance, the second distance, and a fourth distance between the current vertex and a fourth reference point, wherein the vertex data includes a direction vector of the convergence direction of the oriented bounding box.
[0103] In this embodiment, the embodiment of the collision data processing device may refer to the embodiment of the method described above, but is not limited thereto, and a description thereof will be omitted here.
[0104] Optionally, the first acquisition unit: a second determination module for determining a center coordinate point of all vertices of the target impactor when the number of vertices of the target impactor reaches a first threshold; a second acquisition module for acquiring a distance relationship between each vertex and a central coordinate point; a third determination module that determines to recognize the target collision object as a reference rectangular parallelepiped when the distance relationship indicates that the distance between each vertex and the central coordinate point is less than a first distance threshold, and the regular solid includes the reference rectangular parallelepiped; and a fourth determination module that determines to recognize the target impact body as a reference rectangular parallelepiped when at least two sets of parallel planes are determined based on the distance relationship of each vertex, wherein the regular solid includes the reference rectangular parallelepiped.
[0105] In this embodiment, the embodiment of the collision data processing device may refer to the embodiment of the method described above, but is not limited thereto, and a description thereof will be omitted here.
[0106] Optionally, the collision data processing device comprises: a third acquisition module for acquiring a first volume value corresponding to the target impact object and a second volume value corresponding to the reference rectangular parallelepiped after the target impact object is determined to be the reference rectangular parallelepiped; a fifth determining module that determines a ratio of the first volume value to the second volume value; and a sixth determination module that determines to transform the target impactor into the reference rectangular parallelepiped if the ratio reaches a second threshold.
[0107] In this embodiment, the embodiment of the collision data processing device may refer to the embodiment of the method described above, but is not limited thereto, and a description thereof will be omitted here.
[0108] Optionally, the crash data processing device further includes a first processing module, the first processing module comprising: After determining that the target impactor is transformed into a reference rectangular parallelepiped, determining a projection plane corresponding to the reference rectangular parallelepiped; By mapping each vertex of the reference rectangular parallelepiped onto the projection plane, a projection point corresponding to each vertex is obtained; Obtain a first plane vertex set and a second plane vertex set by grouping each vertex based on a projection distance from the vertex to a corresponding projection point, the vertices in the first plane vertex set being located on a first plane, and the vertices in the second plane vertex set being located on a second plane; If the first plane and the second plane are parallel, a convergence direction of an oriented bounding box matched to the reference rectangular parallelepiped is determined based on the first plane and the second plane, and the vertex data includes a direction vector of the convergence direction of the oriented bounding box.
[0109] In this embodiment, the embodiment of the collision data processing device may refer to the embodiment of the method described above, but is not limited thereto, and a description thereof will be omitted here.
[0110] Optionally, the crash data processing device further includes a second processing module, which is After determining that the target impactor is transformed into a reference rectangular parallelepiped, a forward direction vector corresponding to a geometric center point of the reference rectangular parallelepiped is determined, and a vertical plane that includes the forward direction vector is determined; The vertical plane is rotated a plurality of times around the direction of the forward vector, and after each rotation, an operation of obtaining a third plane vertex set and a fourth plane vertex set by grouping each vertex of the reference rectangular parallelepiped based on a vertical distance from each vertex to a vertical plane, wherein the vertices in the third plane vertex set are located on the third plane, and the vertices in the fourth plane vertex set are located on the fourth plane; If the third plane and the fourth plane are parallel, an operation is performed to determine a convergence direction of an oriented bounding box matched to the reference rectangular parallelepiped based on the third plane and the fourth plane, wherein the vertex data includes a direction vector of the convergence direction of the oriented bounding box.
[0111] In this embodiment, the embodiment of the collision data processing device may refer to the embodiment of the method described above, but is not limited thereto, and a description thereof will be omitted here.
[0112] Optionally, the collision data processing device comprises: an extraction module that extracts a convex feature of the reference rectangular parallelepiped when the ratio between the first volume value and the second volume value is not reached after the ratio has been determined, the convex feature including the lengths of three axial sides corresponding to the reference rectangular parallelepiped, the three axial sides being perpendicular to each other; a seventh determination module that determines to convert the reference rectangular parallelepiped into a long bar-type rectangular parallelepiped when a first difference between the side length of the first axis direction side and the side length of the third axis direction side and a second difference between the side length of the second axis direction side and the side length of the third axis direction side are both greater than a second distance threshold; and an eighth determination module that determines to convert the reference rectangular parallelepiped into a roof-type rectangular parallelepiped when a third difference between the side length of the first axis direction side and the side length of the second axis direction side and a fourth difference between the side length of the first axis direction side and the side length of the third axis direction side are both greater than a third distance threshold.
[0113] In this embodiment, the embodiment of the collision data processing device may refer to the embodiment of the method described above, but is not limited thereto, and a description thereof will be omitted here.
[0114] Optionally, the collision data processing device comprises: After the distance relationship between each vertex and the central coordinate point is obtained, the geometric center point of the target impact body is obtained, and the distance of the line connecting each vertex of the target impact body to the geometric center point is obtained. If the difference between the distances of each connecting line is smaller than a third threshold, the target impact body is recognized as a cylinder, and a spatial function of the cylinder is constructed based on the coordinates of the geometric center point and the radius of the cylinder, where the regular solid includes a cylinder and the vertex data includes the spatial function of the cylinder.
[0115] In this embodiment, the embodiment of the collision data processing device may refer to the embodiment of the method described above, but is not limited thereto, and a description thereof will be omitted here.
[0116] Optionally, the collision data processing device comprises: a decomposition unit for decomposing the target collider using an equidistant bounding box to obtain multiple sub-colliders before obtaining collision data of the target collider by converting vertex data of the target collider into a data format that matches a regular solid; a second determination unit that determines an intersection point between a line connecting each vertex of the target impact body and each of the sub-impact bodies of the plurality of sub-impact bodies; a combination unit for sequentially performing convergent combination on intersections within each sub-impact body to obtain a sub-boundary box corresponding to the sub-impact body; a first merging unit for scanning each sub-bounding box and merging the sub-bounding boxes whose size difference is less than a fourth threshold to obtain a body bounding box corresponding to the target impactor; and a third determining unit for determining the vertex data of the body bounding box as the vertex data of the target collision body.
[0117] In this embodiment, the embodiment of the collision data processing device may refer to the embodiment of the method described above, but is not limited thereto, and a description thereof will be omitted here.
[0118] Optionally, The collision data processing device comprises: a fourth determination unit for determining the size of each regular sub-solid after transforming the target impactor into a regular solid based on the distance relationship, if the regular solid includes multiple regular sub-solids; a second merging unit that merges two adjacent regular sub-solids if the difference in size between the two adjacent regular sub-solids is less than a fifth threshold; Among multiple regular sub-solids, the size of the first regular sub-solid and the size of the second regular sub-solid Size and a removal unit for removing the first regular sub-solid if the difference between the first regular sub-solid and the second regular sub-solid is smaller than a sixth threshold and the first regular sub-solid is located inside the second regular sub-solid.
[0119] Optionally, the first processing unit: Obtain collision data by converting the vertex data of the target collision body into a data format of geometrical characteristics that match a regular solid. conversion Includes modules.
[0120] In this embodiment, the embodiment of the collision data processing device may refer to the embodiment of the method described above, but is not limited thereto, and a description thereof will be omitted here.
[0121] According to another aspect of the embodiment of the present application, there is further provided an electronic device for implementing the above-described collision data processing method. The electronic device may be the terminal device or server shown in FIG. 1. In this embodiment, a case where the electronic device is a server will be described as an example. As shown in FIG. 10, the electronic device includes a memory 1002 and a processor 1004. A computer program is stored in the memory 1002, and the processor 1004 is configured to execute the steps of any one of the above-described method embodiments in accordance with the computer program.
[0122] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0123] Optionally, in this embodiment, the processor may be configured by a computer program to perform the following steps:
[0124] In S1, a target collision object to be processed in the virtual scene is determined, and the target collision object is a convex polyhedron including vertices.
[0125] In S2, the distance relationship between each vertex of the target collision body is obtained.
[0126] In S3, when the target collision body is converted into a regular solid based on the distance relationship, the vertex data of the target collision body is converted into a data format that matches the regular solid, thereby obtaining collision data of the target collision body.
[0127] Optionally, as will be appreciated by those skilled in the art, the configuration shown in FIG. 10 is merely schematic. , electric The child device may be a terminal device such as a smartphone (e.g., an Android smartphone, an iOS smartphone, etc.), a tablet computer, a palmtop computer, a mobile internet device (MID), a PAD, etc. Telegraph This does not limit the configuration of the child device. For example, , electric The child devices may include more or fewer components (eg, network interfaces, etc.) than those shown in FIG. 10, or may be arranged differently than those shown in FIG.
[0128] Here, the memory 1002 can be used to store software programs and modules, such as program instructions / modules corresponding to the crash data processing method and apparatus of the present application. The processor 1004 executes the software programs and modules stored in the memory 1002 to perform various functional applications and data processing, i.e., to realize the above-mentioned crash data processing method. The memory 1002 is configured to store high-speed random accessThe memory 1002 may include a memory, and may include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1002 may further include a memory located remotely from the processor 1004, and the remote memory may be connected to the terminal via a network. Examples of the network include, but are not limited to, the Internet, a corporate intranet, a local area network, a mobile communication network, and combinations thereof. Here, the memory 1002 may specifically be used to store information such as, but not limited to, collision data of a target impactor. For example, as shown in FIG. 10 , the memory 1002 may include, but is not limited to, a first determination unit 902, a first acquisition unit 904, and a first processing unit 906 in the collision data processing device. Also, The memory 1002 includes: The collision data processing device may further include other module units, but is not limited to these, and the description thereof will be omitted in this example.
[0129] Optionally , transmission The transmitting device 1006 transmits and receives data over a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmitting device 1006 includes a network interface controller (NIC) that can be connected to other network devices and routers via a network cable, thereby communicating with the Internet or a local area network. In one example, the transmitting device 1006 is a radio frequency (RF) module used to communicate with the Internet wirelessly.
[0130] The electronic device further includes a display 1008 for displaying the virtual scene and virtual objects corresponding to the target impactors appearing therein, and a connection bus 1010 for connecting the modular components of the electronic device.
[0131] In another embodiment, the terminal device or server may be a node of a distributed system, where the distributed system may be a blockchain system. , complex The blockchain system may be a distributed system in which multiple nodes are connected in the form of network communication, where the nodes can form a peer-to-peer (P2P) network, and any type of computing device, such as a server or terminal, can become a node in the blockchain system by joining the peer-to-peer network.
[0132] According to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored on a computer-readable storage medium, the computer instructions read by a processor of a computing device from the computer-readable storage medium, and execution of the computer instructions by the processor causes the computing device to perform the above-described crash data processing method, wherein the computer program, when executed, is configured to perform the steps of any one of the above-described method embodiments.
[0133] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for causing the computer to execute the following steps:
[0134] In S1, a target collision object to be processed in the virtual scene is determined, and the target collision object is a convex polyhedron including vertices.
[0135] In S2, the distance relationship between each vertex of the target impactor is obtained, and the distance relationship is for representing the shape characteristics of the target impactor.
[0136] In S3, when the target collision body is converted into a regular solid based on the distance relationship, the vertex data of the target collision body is converted into a data format that matches the regular solid, thereby obtaining collision data of the target collision body.
[0137] Optionally, in this embodiment, as can be understood by those skilled in the art, all or part of the steps of each method in the above embodiment may be executed by instructing relevant hardware of the terminal device through a program. The program may be stored in a computer-readable storage medium. The storage medium may include a flash disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, an optical disk, etc.
[0138] The numbers of the above-mentioned embodiments of the present application are for illustrative purposes only and do not indicate the superiority or inferiority of the embodiments.
[0139] The integrated units in the above embodiments may be realized in the form of a software functional unit and stored in the above computer-readable storage medium when sold or used as an independent product. Based on this understanding, the configurations of the present application may essentially, in other words, the portion contributing to the prior art, or all or part of the configurations, be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application.
[0140] In the above embodiments of the present application, the description of each embodiment has its own focus, and for the parts not described in detail in one embodiment, reference can be made to the relevant descriptions of other embodiments.
[0141] In some embodiments provided herein, it should be understood that the displayed client may be implemented in other ways. The above-described device embodiments are merely schematic. For example, the division of the units is merely a logical division of functions, and other division methods may be used in actual implementation. For example, multiple units or components may be combined or incorporated into other systems, or some features may be ignored or not implemented. Furthermore, the shown or discussed mutual couplings, direct couplings, or communication connections may be via some interfaces, and the indirect couplings or communication connections of units or modules may be electrical or other types.
[0142] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units, i.e., they may be located in one place or distributed across multiple units on a network. Depending on actual needs, some or all of the units may be selected to achieve the objectives of the invention according to this embodiment.
[0143] Furthermore, the functional units in each embodiment of the present application may be integrated into one processing unit, each unit may exist physically as an individual unit, or two or more units may be integrated into one unit. The above-mentioned integrated units may be realized in the form of hardware or in the form of a software functional unit.
[0144] The above is only a preferred embodiment of the present application. It should be noted that those skilled in the art can make some improvements and modifications without departing from the principle of the present application. These improvements and modifications should also be considered as part of the protection scope of the present application. [Explanation of symbols]
[0145] 100 Target Impactor 102 Terminal Equipment 104 Network 106 Server 108 databases 902 First Decision Unit 904 First Acquisition Unit 906 First Processing Unit 1002 memory 1004 processor 1006 Transmission equipment 1008 Display 1010 Connection Bus
Claims
1. 1. A crash data processing method executed by an electronic device, comprising: determining a target impactor in the virtual scene to be processed, the target impactor being a convex polyhedron including vertices; obtaining a distance relationship between each vertex of the target impactor, the distance relationship being for representing a shape feature of the target impactor; When the target collision object is converted into a regular solid based on the distance relationship, vertex data of the target collision object is converted into a data format that matches the regular solid, thereby acquiring collision data of the target collision object; Including, the step of acquiring the distance relationship between each vertex of the target collision body includes a step of acquiring, when the number of vertices of the target collision body reaches a first threshold, a distance relationship between each of a plurality of edges connected to each of the vertices of the target collision body; Before converting the vertex data of the target impactor in a data format that matches the regular solid, the method further includes a step of determining to convert the target impactor into a standard rectangular parallelepiped if the distance relationship indicates that three edges connected to one target vertex of the target impactor are perpendicular to each other, wherein the regular solid includes the standard rectangular parallelepiped. method.
2. Before acquiring the collision data of the target impactor by converting the vertex data of the target impactor into a data format that matches the regular solid, determining a current vertex from among the vertices of the target impact body, and determining a first reference point and a second reference point that are closest to the current vertex; obtaining a first distance between the current vertex and the first reference point, and a second distance between the current vertex and the second reference point; determining a third distance based on the first distance and the second distance, the third distance being the length of a hypotenuse of a right-angled triangle, the right-angled triangle having the first distance and the second distance as the lengths of its right angles; determining a third reference point from among the vertices of the target impact body excluding the current vertex, the first reference point, and the second reference point according to the third distance, wherein the distance between the current vertex and the third reference point is the third distance; determining a reference plane of the target impactor based on the first reference point, the second reference point, and the third reference point; a step of determining a fourth reference point that is closest to the current vertex from among the vertices of the target collision body excluding the current vertex, the first reference point, the second reference point, and the third reference point, wherein a line connecting the fourth reference point and the current vertex is perpendicular to the reference plane; determining the current vertex as the target vertex, and determining a convergence direction of an oriented bounding box matched to the standard rectangular parallelepiped based on the first distance, the second distance, and a fourth distance between the current vertex and the fourth reference point, wherein the vertex data includes a direction vector of the convergence direction of the oriented bounding box. The method of claim 1.
3. The step of obtaining the distance relationship between the vertices of the target impact body includes: determining a center coordinate point of all vertices of the target impactor when the number of vertices of the target impactor reaches a first threshold; obtaining a distance relationship between each vertex and the central coordinate point; Before converting the vertex data of the target impactor in a data format that matches the regular solid, the method includes: If the target collision object is not recognized as the standard rectangular parallelepiped, and if the distance relationship indicates that the distances between each of the vertices and the central coordinate point are all smaller than a first distance threshold, determining that the target collision object is recognized as a reference rectangular parallelepiped, wherein the regular solid includes the reference rectangular parallelepiped, and the reference rectangular parallelepiped has a structure similar to that of the standard rectangular parallelepiped; and determining that the target collision object is to be recognized as a reference rectangular parallelepiped when at least two pairs of parallel planes are determined based on the distance relationship between the vertices. The method of claim 1.
4. After determining that the target impactor is a reference rectangular parallelepiped, obtaining a first volume value corresponding to the target impactor and a second volume value corresponding to the reference rectangular parallelepiped; determining a ratio between the first volume value and the second volume value; If the ratio reaches a second threshold, determining to transform the target impactor into the reference rectangular parallelepiped. The method of claim 3.
5. After determining that the target impactor is transformed into the reference rectangular parallelepiped, determining a projection plane corresponding to the reference rectangular parallelepiped; Mapping each vertex of the reference rectangular parallelepiped onto the projection plane to obtain a projection point corresponding to each of the vertices; obtaining a first set of plane vertices and a second set of plane vertices by grouping each of the vertices based on a projection distance from the vertex to a corresponding projection point, wherein the vertices in the first set of plane vertices are located in a first plane and the vertices in the second set of plane vertices are located in a second plane; If the first plane and the second plane are parallel, determining a convergence direction of an oriented bounding box matched to the reference rectangular parallelepiped based on the first plane and the second plane, wherein the vertex data includes a direction vector of the convergence direction of the oriented bounding box. The method of claim 4.
6. After determining that the target impactor is transformed into the reference rectangular parallelepiped, determining a forward direction vector corresponding to a geometric center point of the reference rectangular parallelepiped, and determining a vertical plane that includes the forward direction vector; The vertical plane is rotated a plurality of times around the direction of the forward vector, and after each rotation, obtaining a third set of plane vertices and a fourth set of plane vertices by grouping the vertices of the reference rectangular parallelepiped based on a vertical distance from the vertices to the vertical plane, wherein the vertices in the third set of plane vertices are located on a third plane, and the vertices in the fourth set of plane vertices are located on a fourth plane; If the third plane and the fourth plane are parallel, determining a convergence direction of an oriented bounding box matched to the reference rectangular parallelepiped based on the third plane and the fourth plane, wherein the vertex data includes a direction vector of the convergence direction of the oriented bounding box. The method of claim 4.
7. After determining the ratio of the first volume value to the second volume value, a step of extracting a convex feature of the reference rectangular parallelepiped when the ratio does not reach the second threshold, the convex feature including side lengths of three axial sides corresponding to the reference rectangular parallelepiped, the three axial sides being sides of the reference rectangular parallelepiped that are perpendicular to each other; determining that the reference rectangular parallelepiped is to be converted into a long rod-type rectangular parallelepiped when a first difference between the side length of the first axis direction side and the side length of the third axis direction side and a second difference between the side length of the second axis direction side and the side length of the third axis direction side are both greater than a second distance threshold; determining to convert the reference rectangular parallelepiped into a roof-type rectangular parallelepiped when a third difference between the side length of the first axis direction side and the side length of the second axis direction side and a fourth difference between the side length of the first axis direction side and the side length of the third axis direction side are both greater than a third distance threshold; The method of claim 4.
8. After obtaining the distance relationship between each vertex and the central coordinate point, if it is determined that the target impactor is not a reference rectangular parallelepiped, obtaining a geometric center point of the target impactor; obtaining the distance between each vertex of the target impactor and the geometric center point; a step of recognizing the target impact object as a cylinder when the difference between the distances of the connecting lines is smaller than a third threshold, and the regular solid includes the cylinder; constructing a spatial function of the cylinder based on the coordinates of the geometric center point and the radius of the cylinder, wherein the vertex data includes a spatial function of the cylinder. The method of claim 3.
9. Before acquiring the collision data of the target impactor by converting the vertex data of the target impactor into a data format that matches the regular solid, obtaining a plurality of sub-impact bodies by decomposing the target impact body using equidistant bounding boxes; determining an intersection point between a line connecting each vertex of the target impact body and each of the sub-impact bodies of the plurality of sub-impact bodies; Obtaining a sub-boundary box corresponding to each sub-impact body by sequentially performing convergent combination on intersection points within each sub-impact body; scanning each sub-bounding box and merging the sub-bounding boxes whose size difference is less than a fourth threshold to obtain a body bounding box corresponding to the target impactor; and setting the vertex data of the body bounding box as the vertex data of the target impact body. The method of claim 3.
10. After converting the target impactor into a regular solid based on the distance relationship, if the regular solid includes a plurality of regular sub-solids, determining the size of each of the regular sub-solids; merging two adjacent regular sub-solids if the difference in size between the two adjacent regular sub-solids is less than a fifth threshold; and removing the first regular subsolid from the plurality of regular subsolids when a difference between a size of a first regular subsolid and a size of a second regular subsolid is smaller than a sixth threshold and the first regular subsolid is located inside the second regular subsolid. The method of claim 1.
11. The step of obtaining collision data of the target collision object by converting vertex data of the target collision object in a data format that matches the regular solid, acquiring the collision data by converting vertex data of the target collision body into a data format of geometric characteristics that matches the regular solid, the data format of the geometric characteristics being a data format that represents the regular solid by a center coordinate and a direction vector of a convergence direction of an oriented bounding box; The method of claim 1.
12. A collision data processing device, a first determination unit for determining a target impactor to be processed in the virtual scene, the target impactor being a convex polyhedron including vertices; a first acquisition unit for acquiring a distance relationship between vertices of the target impact body, the distance relationship being for representing a shape feature of the target impact body; a first processing unit that, when the target collision object is converted into a regular solid based on the distance relationship, acquires collision data of the target collision object by converting vertex data of the target collision object into a data format that matches the regular solid; Including, Obtaining the distance relationship between each vertex of the target collision body includes, when the number of vertices of the target collision body reaches a first threshold, obtaining the distance relationship between each of a plurality of edges connected to each of the vertices of the target collision body; Before converting the vertex data of the target collision body into a data format matching the regular solid, the first determination unit further determines to convert the target collision body into a standard rectangular parallelepiped if the distance relationship indicates that three edges connected to one target vertex of the target collision body are perpendicular to each other, and the regular solid includes the standard rectangular parallelepiped. Device.
13. 12. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured by the computer program to execute a method according to any one of claims 1 to 11.
14. A computer program causing a computer to carry out the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Three-dimensional graphic drawing device
JP1996315180A
Map data processing method, and computer graphics processing method and device
JP2003281561A
Interference determination device, interference determination method, and interference determination program
JP2011165096A
Monitoring proximity of objects at construction jobsites via three-dimensional virtuality in real-time
US20140200863A1