Collision detection method, device and readable storage medium
By setting up a preset bounding box library in VR equipment in advance and obtaining standard collision detection results, the problem of low accuracy of bounding box detection in VR equipment is solved, the accuracy and efficiency of collision detection are improved, and the high-precision immersion type is met Interactive experience requirements.
Patent Information
- Application Number
- CN202411004676.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-07-25
AI Technical Summary
Due to the computational complexity and computing power limitations, the collision detection method based on the bounding box in existing VR devices has low detection accuracy and cannot meet the needs of high-precision immersive interactive experience.
By setting up a preset bounding box library in advance and obtaining standard collision detection results associated with the target bounding box group matching the original bounding box during detection, the collision detection results are directly obtained to avoid low-precision bounding box intersection detection and improve detection accuracy.
The detection accuracy of the collision detection method based on the bounding box is improved, the detection delay and detection cost are reduced, and the computing efficiency and user experience of VR equipment are enhanced.
Smart Images

Figure CN118608730B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of virtual interaction technology, and in particular to a collision detection method, device and readable storage medium. Background Art
[0002] VR (Virtual Reality) is a technology that uses computer technology to generate and present virtual environments and objects, which can provide users with an immersive interactive experience. VR technology has broad application prospects in entertainment, education, medical care, industry and other fields. Collision detection between virtual objects is a key link to ensure the normal operation of VR equipment and provide a real experience.
[0003] By calculating the bounding boxes of the objects, it is determined whether the spaces of the bounding boxes of the two objects intersect, thereby determining whether the two objects collide. However, since the bounding box calculation process is complex and requires a lot of calculations, and the computing power of head-mounted devices such as VR glasses and VR helmets is usually low, the bounding boxes calculated by the head-mounted devices are usually low in accuracy, which in turn leads to low detection accuracy of the collision detection method based on the bounding box.
[0004] Therefore, how to improve the detection accuracy of the collision detection method based on the bounding box is a technical problem that needs to be solved urgently in the field of this technology. Summary of the invention
[0005] The main purpose of the present application is to provide a collision detection method, device and readable storage medium, aiming to solve the technical problem of how to improve the detection accuracy of a collision detection method based on a bounding box.
[0006] To achieve the above object, the present application provides a collision detection method, which is applied to a head mounted device. The collision detection method comprises the following steps:
[0007] Acquire an original bounding box group to be detected for collision, wherein the original bounding box group includes a first bounding box representing an active virtual object and a second bounding box representing a passive virtual object;
[0008] Detecting whether there is a target bounding box group that is consistent with the original bounding box group in the preset bounding box library;
[0009] If the target bounding box group exists, obtaining the target collision detection result associated with the target bounding box group, wherein each preset bounding box group in the preset bounding box library is pre-associated with a standard collision detection result;
[0010] If the target collision detection result indicates that there is a collision record, it is determined that there is a collision between the active virtual object and the passive virtual object.
[0011] In one embodiment, the step of detecting whether there is a target bounding box group consistent with the original bounding box group in the preset bounding box library includes:
[0012] Obtaining the first vertex coordinate information of the original bounding box group, and traversing each preset bounding box group in the preset bounding box library;
[0013] If the second vertex coordinate information of any of the preset bounding box groups is consistent with the first vertex coordinate information, it is determined that there is a target bounding box group consistent with the original bounding box group in the preset bounding box library, and the preset bounding box group with consistent vertex coordinate information is determined as the target bounding box group;
[0014] If the second vertex coordinate information of all the preset bounding box groups is inconsistent with the first vertex coordinate information, it is determined that there is no target bounding box group consistent with the original bounding box group in the preset bounding box library.
[0015] In one embodiment, after the step of detecting whether there is a target bounding box group consistent with the original bounding box group in the preset bounding box library, the method further includes:
[0016] If the target bounding box group does not exist, detecting whether the first bounding box intersects with the second bounding box;
[0017] If they intersect, it is determined that there is a collision between the active virtual object and the passive virtual object;
[0018] If they do not intersect, it is determined that there is no collision between the active virtual object and the passive virtual object.
[0019] In one embodiment, the step of obtaining the original bounding box group to be detected for collision includes:
[0020] Acquire the virtual scene currently displayed by the head mounted device, and construct a hierarchical bounding box of the virtual scene;
[0021] Obtain a first bounding box of the active virtual object, obtain a root node bounding box in the hierarchical bounding box, and use the root node bounding box as a second bounding box;
[0022] The first bounding box and the second bounding box are combined to obtain an original bounding box group to be detected for collision.
[0023] In one embodiment, after the step of determining whether there is a collision between the active virtual object and the passive virtual object, the method further includes:
[0024] If the second bounding box is not a leaf node bounding box in the hierarchical bounding box, determine the child node bounding box of the second bounding box in the hierarchical bounding box, use the child node bounding box as a new second bounding box, combine the first bounding box with the new second bounding box to obtain a new original bounding box group to be collided with, and perform the next collision detection based on the new original bounding box group to be collided with;
[0025] If the second bounding box is a leaf node bounding box in the hierarchical bounding box, the collision detection is terminated.
[0026] In one embodiment, after the step of obtaining the virtual scene currently displayed by the head mounted device, the method further includes:
[0027] Dividing the virtual scene into a plurality of sub-virtual scenes, and determining a target sub-virtual scene where the active virtual object is located;
[0028] The step of constructing a hierarchical bounding box of the virtual scene is performed in the target sub-virtual scene.
[0029] In one embodiment, after the step of determining whether there is a collision between the active virtual object and the passive virtual object, the method further includes at least one of the following:
[0030] Output prompt information;
[0031] or determining a collision area between the active virtual object and the passive virtual object, and updating a display color of the collision area;
[0032] or updating the display color, position, shape and / or size of the active virtual object until there is no collision between the active virtual object and the passive virtual object;
[0033] Or update the display color, position, shape and / or size of the passive virtual object until there is no collision between the active virtual object and the passive virtual object.
[0034] In one embodiment, the active virtual object includes a virtual object in motion, a virtual character of a target user in a virtual scene, and / or a virtual object interacting with the virtual character in the virtual scene, wherein the target user is a user wearing the head mounted device.
[0035] In addition, to achieve the above-mentioned purpose, the present application also provides a head-mounted device, which includes a memory, a processor, and a collision detection program stored in the memory and executable on the processor, and the collision detection program implements the steps of the above-mentioned collision detection method when executed by the processor.
[0036] In addition, to achieve the above-mentioned purpose, the present application also provides a readable storage medium, which is a computer-readable storage medium, and a program for implementing the collision detection method is stored on the computer-readable storage medium. The program for implementing the collision detection method is executed by a processor to implement the steps of the collision detection method as described above.
[0037] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned collision detection method when executed by a processor.
[0038] In the present application, the head mounted device obtains an original bounding box group to be detected for collision, wherein the original bounding box group includes a first bounding box representing an active virtual object and a second bounding box representing a passive virtual object; detects whether there is a target bounding box consistent with the original bounding box group in the preset bounding box library; if the target bounding box group exists, obtains a target collision detection result associated with the target bounding box group, and each preset bounding box group in the preset bounding box library is pre-associated with a standard collision detection result; if the target collision detection result indicates that there is a collision record, it is determined that there is a collision between the active virtual object and the passive virtual object. In this way, in the embodiment of the present application, a preset bounding box library is set in advance, and the standard collision detection result of each bounding box group in the preset bounding box library is pre-associated, so that when the original bounding box group to be detected for collision is actually obtained, if there is a target bounding box matching this original bounding box group in the preset bounding box library, the standard collision detection result associated with the target bounding box group can be obtained, without the need to perform collision detection based on whether the bounding boxes with lower accuracy intersect, thereby improving the detection accuracy of the collision detection method based on the bounding box. In addition, the collision detection method of searching the preset bounding box library has small computational complexity and can further reduce the detection delay and detection cost of collision detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0041] Figure 1 This is a schematic diagram of the flow of the first embodiment of the collision detection method of the present application;
[0042] Figure 2 This is a schematic diagram of a scene setting involving a bounding box library according to an embodiment of the present application;
[0043] Figure 3 A schematic diagram of an original bounding box group involved in an embodiment of the present application;
[0044] Figure 4 This is a brief flow chart of a collision detection method according to an embodiment of the present application;
[0045] Figure 5 This is a schematic diagram of the structure of the collision detection device of the present application.
[0046] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0047] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0048] The main solution of the present application is: obtaining an original bounding box group to be detected for collision, wherein the original bounding box group includes a first bounding box representing an active virtual object and a second bounding box representing a passive virtual object; detecting whether there is a target bounding box consistent with the original bounding box group in a preset bounding box library; if there is a target bounding box group, obtaining a target collision detection result associated with the target bounding box group, each preset bounding box group in the preset bounding box library is pre-associated with a standard collision detection result; if the target collision detection result indicates that there is a collision record, it is determined that there is a collision between the active virtual object and the passive virtual object.
[0049] In this application, by setting up a preset bounding box library in advance and pre-associating the standard collision detection results of each bounding box group in the preset bounding box library, when the original bounding box group to be detected for collision is actually obtained, if there is a target bounding box matching this original bounding box group in the preset bounding box library, the standard collision detection result associated with the target bounding box group can be obtained, without the need to perform collision detection based on whether the bounding boxes with lower accuracy intersect, thereby improving the detection accuracy of the collision detection method based on the bounding box. In addition, the collision detection method for searching the preset bounding box library has a small amount of calculation, which can further reduce the detection delay and detection cost of the collision detection.
[0050] It should be noted that the execution subject of each embodiment of the collision detection method of the present application is a head-mounted device that can realize the above-mentioned functions, such as VR devices such as VR glasses and VR helmets. By way of example, the embodiments of the present application are described with the VR device as the execution subject.
[0051] Based on this, the present application proposes a collision detection method of the first embodiment, please refer to Figure 1 The collision detection method includes steps S10 to S40:
[0052] Step S10, obtaining an original bounding box group to be detected for collision, wherein the original bounding box group includes a first bounding box representing an active virtual object and a second bounding box representing a passive virtual object;
[0053] Before obtaining the original bounding box group, the VR device may construct a bounding box in advance. Specifically, the bounding box may be constructed in a known manner, and the present embodiment will not describe the construction process of the bounding box in detail.
[0054] Usually, VR devices determine whether the bounding boxes of two virtual objects intersect in space, and then determine whether the two virtual objects collide. When detecting whether there is a collision between two virtual objects based on this, this embodiment first obtains the original bounding box group composed of the bounding boxes of the two objects, so as to perform subsequent collision detection based on the original bounding box group.
[0055] The active virtual object is a virtual object whose collision detection parameters change in the virtual scene displayed by the VR device, and the passive virtual object represents a virtual object in the virtual scene that may collide with the active virtual object due to the change of the collision detection parameters of the active virtual object, and specifically may be other virtual objects in the virtual scene except the active virtual object. Among them, the collision detection parameters are parameters set in advance, including but not limited to the shape, size, position and motion state of the virtual object, etc.
[0056] It should be noted that, for each active virtual object, it may be necessary to detect whether the active virtual object collides with any virtual object other than itself in the virtual scene. The bounding box of each passive virtual object can be obtained in turn to detect whether the active virtual object collides with the passive virtual object in turn.
[0057] Step S20, detecting whether there is a target bounding box consistent with the original bounding box group in the preset bounding box library;
[0058] Detect whether there is a target bounding box group that is consistent with the original bounding box group in the preset bounding box library. Specifically, for the bounding box groups in the preset bounding box library (hereinafter referred to as preset bounding box groups), it can be detected whether the bounding boxes contained in each preset bounding box group overlap with the bounding boxes contained in the original bounding box group. If a preset bounding box group completely overlaps with the original bounding box group or the area volume of the overlapping area is greater than a preset threshold, then the preset bounding group is determined to be the target bounding box group in the preset bounding box library that is consistent with the original bounding box group. Or for the bounding boxes of a polyhedron, it can also be detected whether the vertex coordinates of the bounding boxes are consistent. If the vertex coordinates of the bounding boxes in a preset bounding box group are consistent with the vertex coordinates of the bounding boxes in the original bounding box group, then the preset bounding group is determined to be the target bounding box group in the preset bounding box library that is consistent with the original bounding box group.
[0059] Step S30, if there is a target bounding box group, obtaining a target collision detection result associated with the target bounding box group, wherein each bounding box group in the preset bounding box library is pre-associated with a standard collision detection result;
[0060] Considering that the bounding box calculated by a computing device with higher computing power will also have higher accuracy, and thus the detection result will have higher accuracy, based on this, the standard collision detection result pre-associated with the bounding box group in the preset bounding box library can specifically be the detection result of collision detection performed by the computing device with higher computing power based on the bounding box group. Alternatively, the standard collision detection result pre-associated with the bounding box group can also be a manually marked detection result.
[0061] For a specific setting method of the preset bounding box library, as one of the implementation methods, refer to Figure 2 As shown, a computing device 200 with higher computing power and a VR device 100 can be used to perform collision detection on the same two virtual objects in a virtual scene to obtain collision detection results for the two respectively. If the collision detection results for the two are inconsistent, the bounding box group composed of the bounding boxes of the two virtual objects constructed by the VR device 100 is stored in a preset bounding box library. At this time, the computing device 200 with higher computing power can send its collision detection result to the VR device 100, and the VR device 100 will associate the collision detection result received from the computing device 200 with higher computing power as the standard collision detection result of the bounding box group.
[0062] As another implementation, a VR device may also perform collision detection on two virtual objects in a virtual scene, and manually mark whether there is a collision between the two virtual objects. If the collision detection result of the VR device is inconsistent with the manual marking, the bounding box group composed of the bounding boxes of the two virtual objects constructed by the VR device is stored in a preset bounding box library. At this time, the manually marked detection result can be associated with the standard collision detection result of the bounding box group.
[0063] It should be noted that the above are only two specific implementation methods of the preset bounding box library setting method provided in this embodiment, and this embodiment does not specifically limit the setting method of the preset bounding box library.
[0064] Furthermore, the preset bounding box library can be set in advance in the VR device by relevant personnel before the VR device leaves the factory. During the use of the VR device, if misdetection occurs, the user can also provide feedback to update the preset bounding box library based on the misdetected bounding box group.
[0065] In addition, in the process of using VR devices, it is found that the bounding box constructed by VR devices mainly for convex polyhedrons has low accuracy, and thus the detection accuracy of collision detection of convex polyhedrons is low. Based on this, when setting the bounding box library, the VR device can be used to perform collision detection on convex polyhedrons (active virtual objects and / or passive virtual objects are convex polyhedrons), and the bounding box library is set according to the collision detection results. After the VR device actually uses the collision detection to obtain the original bounding box group, if the active virtual object and / or the passive virtual object is a convex polyhedron, it is detected whether there is a target bounding box group consistent with the original bounding box group in the preset bounding box library. If both the active virtual object and the passive virtual object are not convex polyhedrons, collision detection is performed based on whether the first bounding box and the second bounding box intersect. In this way, the accuracy of the collision detection results can be taken into account while reducing the number of bounding box groups in the preset bounding box library, thereby saving storage resources.
[0066] Furthermore, if there is no target bounding box group consistent with the original bounding box group in the preset bounding box library, further detection is performed to determine whether the active virtual object and the passive virtual object collide. The further detection method may be to detect whether the first bounding box and the second bounding box intersect, if so, it is determined that there is a collision between the active virtual object and the passive virtual object, if not, it is determined that there is no collision between the active virtual object and the passive virtual object; it may also be to construct a three-dimensional model of the active virtual object and the passive virtual object, and detect whether there is a coordinate overlap area between the three-dimensional models of the two, if so, it is determined that there is a collision between the active virtual object and the passive virtual object, if not, it is determined that there is no collision between the active virtual object and the passive virtual object, and this embodiment does not specifically limit the method of further detection.
[0067] Step S40: If the target collision detection result indicates that there is a collision record, it is determined that there is a collision between the active virtual object and the passive virtual object.
[0068] It should be noted that after determining that the active virtual object and the passive virtual object collide, prompt information may be output, such as outputting a collision prompt sound, to improve the user experience.
[0069] Furthermore, after determining that there is a collision between the active virtual object and the passive virtual object, the collision information may be updated and / or stored. The collision information includes but is not limited to the collision time, collision position, virtual objects that collided, and may also include the original bounding box group of the collision, etc. This embodiment does not impose specific restrictions on this, and relevant personnel may set in advance whether to update and / or store the collision information, and what specific collision information needs to be updated and / or stored according to actual needs.
[0070] In this embodiment, the head mounted device obtains an original bounding box group to be detected for collision, wherein the original bounding box group includes a first bounding box representing an active virtual object and a second bounding box representing a passive virtual object; detects whether there is a target bounding box consistent with the original bounding box group in the preset bounding box library; if there is a target bounding box group, obtains a target collision detection result associated with the target bounding box group, and each preset bounding box group in the preset bounding box library is pre-associated with a standard collision detection result; if the target collision detection result indicates that there is a collision record, it is determined that there is a collision between the active virtual object and the passive virtual object. In this way, in this embodiment, a preset bounding box library is set in advance, and the standard collision detection result of each bounding box group in the preset bounding box library is pre-associated, so that when the original bounding box group to be detected for collision is actually obtained, if there is a target bounding box matching this original bounding box group in the preset bounding box library, the standard collision detection result associated with the target bounding box group can be obtained, without the need to perform collision detection based on whether the bounding boxes with lower accuracy intersect, thereby improving the detection accuracy of the collision detection method based on the bounding box. In addition, the collision detection method of searching the preset bounding box library has small computational complexity and can further reduce the detection delay and detection cost of collision detection.
[0071] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above description, and will not be repeated in the following. On this basis, after the step of obtaining the bounding box group of the virtual object to be collided, the method further includes:
[0072] Step A10, obtaining the first vertex coordinate information of the original bounding box group, and traversing each preset bounding box group in the preset bounding box library;
[0073] For the bounding boxes of polyhedrons, whether the bounding boxes overlap can be characterized by whether the vertex coordinates of the polyhedrons are consistent, thereby determining whether the preset bounding box group is consistent with the original bounding box group. Based on this, in this embodiment, when the bounding boxes are all polyhedrons, vertex coordinate information is obtained.
[0074] Step A20, if the second vertex coordinate information of any preset bounding box group is consistent with the first vertex coordinate information, it is determined that there is a target bounding box group consistent with the original bounding box group in the preset bounding box library, and the preset bounding box group with consistent vertex coordinate information is determined as the target bounding box group;
[0075] The vertex coordinate information (including the first vertex coordinate information and the second vertex coordinate information) may be the vertex coordinates of the bounding box. As one implementation, the vertex coordinate information may be the vertex coordinates of all vertices of the bounding box. Exemplarily, the first vertex coordinate information is the vertex coordinates of all vertices of the first bounding box and the vertex coordinates of all vertices of the second bounding box. Similarly, the second vertex coordinate information is the vertex coordinates of all vertices of the two bounding boxes in the preset bounding box group.
[0076] As another implementation, considering the collision of virtual objects, usually the vertices with close distances in the bounding boxes intersect. As long as the positional relationship between the vertices with close distances intersects, the virtual objects may collide. Based on this, the vertex coordinate information can also be the vertex coordinates of the vertices in the two bounding boxes of the bounding box group whose distance is less than the preset distance threshold. Figure 3 As shown, assuming that the first bounding box and the second bounding box in the original bounding group are both cubes, the 8 vertices of the first bounding box are [vertex 1_1, vertex 1_2, vertex 1_3, vertex 1_4, vertex 1_5, vertex 1_6, vertex 1_7, vertex 1_8], and the 8 vertices of the second bounding box are [vertex 2_1, vertex 2_2, vertex 2_3, vertex 2_4, vertex 2_5, vertex 2_6, vertex 2_7, vertex 2_8], wherein the distance between vertex 1_1 and vertex 2_1, vertex 1_2 and vertex 2_2, vertex 1_3 and vertex 2_3, vertex 1_4 and vertex 2_4 is less than the preset distance, then it can be determined that the first vertex coordinate information is the vertex coordinates of vertex 1_1, vertex 1_2, vertex 1_3, vertex 1_4, vertex 2_1, vertex 2_2, vertex 2_3, and vertex 2_4. Similarly, the second vertex coordinate information can be obtained in this way.
[0077] As another implementation, the first vertex coordinate information may be the vertex coordinates of the vertices in the two bounding boxes of the bounding box group whose distance is less than a preset distance threshold, and the second vertex coordinate information may be the vertex coordinates of all vertices in the two bounding boxes in the preset bounding box group. In this way, the distance between the vertices may no longer be calculated for the second vertex coordinate information to reduce the amount of calculation, and the collision between virtual objects may be determined by matching whether the first vertex coordinate information is consistent with the second vertex information, that is, after the vertices in the two bounding boxes whose distance is less than the preset distance threshold match the vertices of the preset bounding box group, and the vertices whose distance is greater than or equal to the preset distance threshold may be at any position, and do not necessarily need to match the vertices of the preset bounding box group. In this way, the collision detection method can adaptively detect whether some bounding box groups that are not in the preset bounding box library collide, thereby improving the universality of the collision detection method.
[0078] For each vertex coordinate in the first vertex coordinate information, if there is a target vertex coordinate matching the vertex coordinate in the second vertex information, the second vertex coordinate information is determined to be consistent with the first vertex coordinate information. It should be noted that if the vertex coordinate in the first vertex coordinate information is multiplied by the preset coefficient, all vertex coordinates in the first vertex coordinate information are multiplied by the same preset coefficient.
[0079] Regarding whether the coordinates of two vertices match, it can be that the coordinates of the two vertices are completely consistent, in which case the two vertices coordinates match; considering that even for the same two virtual objects, the bounding boxes constructed by the VR device at different times may have slight differences, whether the coordinates of the two vertices match can also be that the coordinate distance between the two vertices coordinates is less than a preset error threshold, in which case the two vertices coordinates match, to avoid the phenomenon of mismatch.
[0080] When the first vertex coordinate information and the second vertex coordinate information both record the vertex coordinates of the same number of vertices, in order to improve the matching speed of the vertex coordinate information, the vertex coordinates can be recorded in sequence according to the preset bounding box order and the preset vertex order to obtain the vertex coordinate information, that is, the vertex coordinate information includes a plurality of vertex coordinates arranged in sequence according to the preset bounding box order and the preset vertex order, so as to facilitate the detection of whether the vertex coordinate information is consistent. Among them, the preset bounding box order is used to indicate the priority order of two bounding boxes in the bounding box group, and the preset vertex order is used to indicate the priority order of different vertices of the same bounding box.
[0081] Exemplarily, assuming that the first bounding box and the second bounding box are both cubes, and the vertex coordinate information includes the vertex coordinates of the eight vertices of each of the two bounding boxes, then the preset order of the bounding boxes may be, if the bounding boxes have a relative position relationship of up and down, then the vertex coordinates of the bounding box at the upper relative position may be stored first; if the bounding boxes have a relative position relationship of left and right, then the vertex coordinates of the bounding box at the left relative position may be stored first; if the bounding boxes have a relative position relationship of front and back, then the vertex coordinates of the bounding box at the front relative position may be stored first, wherein the relative position priority order is respectively The relative position relationship of up and down > the relative position relationship of left and right > the relative position relationship of front and back. The relative position relationship of the bounding box can be specifically the relative position relationship of the center of mass of the bounding box. For the 8 vertices of the same bounding box, the preset vertex coordinate order can be [left front upper vertex, right front upper vertex, right front lower vertex, left front lower vertex, left rear lower vertex, right rear lower vertex, right rear upper vertex, left rear upper vertex]. In this way, the i-th vertex coordinate in the first vertex coordinate information can be matched with the i-th vertex coordinate in the second vertex coordinate information, where the value range of i is 1 to the total number of elements in the vertex coordinate information.
[0082] Step A30: If the second vertex coordinate information of all preset bounding box groups is inconsistent with the first vertex coordinate information, it is determined that there is no target bounding box group consistent with the original bounding box group in the preset bounding box library.
[0083] If the vertex coordinates of the bounding boxes in all the bounding box groups in the preset bounding box library are inconsistent with the vertex coordinates of the bounding boxes in the original bounding box group, it is determined that there is no target bounding box group consistent with the original bounding box group in the preset bounding box library. This can further detect whether there is a collision between the active virtual object and the passive virtual object.
[0084] In this embodiment, the first vertex information of the original bounding box group and the second vertex coordinate information of the bounding box group in the preset bounding box library are obtained respectively. In this way, by matching the vertex information, whether the bounding box groups are consistent is detected, thereby achieving effective detection of whether the bounding box groups are consistent.
[0085] Based on the first embodiment and / or the second embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those of the first and second embodiments can be referred to the above description and will not be described in detail later. On this basis, the step of obtaining the original bounding box group to be detected by collision includes:
[0086] Step B10, obtaining the virtual scene currently displayed by the head mounted device, and constructing a hierarchical bounding box of the virtual scene;
[0087] Hierarchical bounding volumes is a technique used in computer graphics to accelerate collision detection and ray tracing of three-dimensional graphics. It constructs a tree structure to approximately enclose objects in the scene. Each node in the tree structure contains a bounding box, which can be of any shape, such as a sphere, a cuboid, or other convex polyhedron. In a hierarchical bounding box, each object or set of objects in the scene is surrounded by a bounding box, and a larger bounding box usually contains a smaller bounding box.
[0088] Step B20, obtaining a first bounding box of the active virtual object, obtaining a root node bounding box in the hierarchical bounding box, and using the root node bounding box as a second bounding box;
[0089] It should be noted that, when the second bounding box is not a leaf node bounding box, the passive virtual objects are all virtual objects enclosed by the second bounding box.
[0090] Step B30: Combine the first bounding box and the second bounding box to obtain an original bounding box group to be collided with.
[0091] In a possible implementation manner, after the step of determining whether there is a collision between the active virtual object and the passive virtual object, the method further includes:
[0092] Step B40, if the second bounding box is not a leaf node bounding box in the hierarchical bounding box, determine the child node bounding box of the second bounding box in the hierarchical bounding box, use the child node bounding box as a new second bounding box, combine the first bounding box and the new second bounding box to obtain a new original bounding box group to be collided, and perform the next collision detection based on the new original bounding box group to be collided;
[0093] Step B50: if the second bounding box is a leaf node bounding box in the hierarchical bounding box, then the collision detection is terminated.
[0094] Furthermore, if it is determined that the active virtual object does not collide with the passive virtual object, the collision detection process may also be ended.
[0095] In this embodiment, by constructing a hierarchical bounding box, when performing collision detection, the hierarchical bounding box is traversed starting from the root node. If the first bounding box does not intersect with the second bounding box, then there is no need to consider all virtual objects inside the bounding box, thereby reducing a lot of unnecessary calculations.
[0096] In a possible implementation, after the step of acquiring the virtual scene currently displayed by the head mounted device, the method further includes:
[0097] Step C10, dividing the virtual scene into a plurality of sub-virtual scenes, and determining a target sub-virtual scene where the active virtual object is located;
[0098] Specifically, the virtual scene may be divided into a plurality of sub-virtual scenes by using an octree, a quadtree, or the like, and this embodiment does not impose any specific limitation on this.
[0099] Step C20, executing the step of constructing a hierarchical bounding box of the virtual scene in the target sub-virtual scene.
[0100] The step of constructing a hierarchical bounding box of the virtual scene is executed in the target sub-virtual scene, that is, a hierarchical bounding box is constructed in the target sub-virtual scene, and based on the hierarchical bounding box in the target sub-virtual scene, it is detected whether the passive virtual object in the target sub-virtual scene collides with the active virtual object. In this way, collision detection is performed based on the target sub-virtual scene where the active virtual object is located, and collision detection is no longer performed on other sub-virtual scenes, thereby further reducing the amount of virtual objects that require collision detection, thereby improving the detection efficiency of collision detection.
[0101] Based on the first embodiment, the second embodiment and / or the third embodiment of the present application, in the fourth embodiment of the present application, the same or similar contents as those in the first embodiment, the second embodiment and the third embodiment can refer to the above introduction, and will not be repeated later. On this basis, after the step of determining whether there is a collision between the active virtual object and the passive virtual object, the method further includes at least one of the following:
[0102] Step D10, outputting prompt information;
[0103] The prompt information may be one or more of a voice prompt, a vibration prompt, and an indicator light prompt, and this embodiment does not impose any specific restrictions on this. Feedback of the collision to the user in the form of prompt information improves the user's viewing experience.
[0104] Step D20, determining the collision area between the active virtual object and the passive virtual object, and updating the display color of the collision area;
[0105] The collision area is specifically the intersection area between the active virtual object and the passive virtual object. The intersection area between the two can be determined by known methods such as ray casting, sweeping algorithm, finite element analysis, etc., and this embodiment does not make any specific restrictions on this.
[0106] The display color of the collision area is updated. Specifically, the display color of the collision area after the update is inconsistent with the display color of the collision area before the update, so that the user can intuitively perceive the collision area between the virtual objects.
[0107] Step D30, updating the display color, position, shape and / or size of the active virtual object until there is no collision between the active virtual object and the passive virtual object;
[0108] Step D40 , updating the display color, position, shape and / or size of the passive virtual object until there is no collision between the active virtual object and the passive virtual object.
[0109] It should be noted that if a hierarchical bounding box is used to determine whether the active virtual object collides with the passive virtual object, when it is determined that there is a collision between the active virtual object and the passive virtual object and the second bounding box of the passive virtual object is a leaf node bounding box, prompt information is output, the collision area between the active virtual object and the passive virtual object is determined, the display color of the collision area is updated, the display color, position, shape and / or size of the passive virtual object is updated until there is no collision between the active virtual object and the passive virtual object, and / or the display color, position, shape and / or size of the active virtual object is updated until there is no collision between the active virtual object and the passive virtual object.
[0110] In a possible implementation, the active virtual object includes a virtual object in motion, a virtual character of a target user in a virtual scene, and / or a virtual object interacting with the virtual character in a virtual scene, wherein the target user is a user wearing a head mounted device.
[0111] The motion state is used to indicate that the virtual object is not stationary. When a virtual object moves, it may cause the virtual object to collide with other virtual objects. Based on this, in this embodiment, the virtual object in motion is regarded as an active virtual object.
[0112] Furthermore, the virtual character of the target user in the virtual scene usually moves with the target user's movements, and the character's appearance or position may change with some operations of the target user, and these changes may cause the virtual character to collide with other virtual objects. Based on this, in this embodiment, the virtual character of the target user in the virtual scene is regarded as an active virtual object.
[0113] In addition, if the target user does not have a virtual character visible to the user in the virtual scene, the inertial data of the target user can also be obtained, and the virtual position area of the user in the virtual scene is located based on the inertial data, and the virtual position area is used as the virtual character of the target user in the virtual scene. Among them, the inertial data can be data such as angular velocity and acceleration collected by the inertial sensor in the VR device. Specifically, if the VR device includes inertial sensors located at multiple different positions, different parts of the user's body can be located based on the inertial sensors at different positions, such as locating the user's head position by the inertial sensor located on the head when worn, and locating the user's hand position by the inertial sensor located on the hand when worn, so as to improve the positioning accuracy.
[0114] Furthermore, the virtual object that interacts with the virtual character may change its appearance, position or size due to some operations of the target user, and these changes may cause the virtual object to collide with other virtual objects. Based on this, in this embodiment, the virtual object that interacts with the virtual character in the virtual scene is regarded as an active virtual object.
[0115] For example, in order to help understand the technical concept or technical principle of collision detection after the present embodiment is combined with the above-mentioned embodiment 1, embodiment 2 and embodiment 3, a specific embodiment is listed. In this specific embodiment, refer to Figure 4 As shown, the collision detection process is:
[0116] Step 1: Use 3D modeling software to build a virtual environment (also known as a virtual scene) and import it into the VR device.
[0117] Step 2: Set collision detection parameters for each virtual object, including shape (such as cube, sphere, grid, etc.), size, position, and motion state (such as stationary, uniform motion, variable speed motion, etc.).
[0118] Step 3: The virtual object whose collision detection parameter changes in the virtual environment is regarded as the active virtual object, and other virtual objects except the active virtual object are passive virtual objects. The first bounding box of the active virtual object and the second bounding box of the passive virtual object are obtained to obtain the original bounding box group.
[0119] Step 4: If there is a target bounding box group matching the current bounding box group in the preset bounding box library, the target collision detection result associated with the target bounding box group is used as the collision detection result between the active virtual object and the passive virtual object.
[0120] Step 5: If there is no target bounding box group matching the current bounding box group in the preset bounding box library ( Figure 4Only the case where there is no target bounding box group is shown in FIG), the collision detection algorithm is optimized. Specifically, the virtual scene is spatially segmented using an octree to obtain multiple sub-virtual scenes; then, a hierarchical bounding box is established in each sub-virtual scene; finally, by traversing the hierarchical bounding boxes in the target sub-virtual scene where the active virtual object is located and checking the collision between virtual objects, the areas where collision is impossible are quickly sorted to achieve efficient collision detection.
[0121] Step 6: Update the collision information. Specifically, the collision information includes the time and location of the collision, and the virtual object that collided ( Figure 4 The virtual objects involved shown in ) and so on.
[0122] Step 7: If it is determined that the active virtual object and the passive virtual object collide according to the collision detection result, a prompt message is output to provide the user with real-time collision feedback, and after modifying the virtual environment, the process returns to step 3 for the next collision detection. Specifically, modifying the virtual environment includes changing the display color, shape, position, size, etc. of the active virtual object and / or the passive virtual object.
[0123] It should be noted that the above specific embodiments are only used to understand the present application and do not constitute a limitation on the collision detection process of the present application. More simple transformations based on this technical concept are all within the protection scope of the present application.
[0124] In addition, the present application also provides a collision detection device, referring to Figure 5 , the collision detection device comprises:
[0125] An acquisition module 10 is used to acquire an original bounding box group to be detected for collision, wherein the original bounding box group includes a first bounding box representing an active virtual object and a second bounding box representing a passive virtual object;
[0126] A detection module 20 is used to detect whether there is a target bounding box group consistent with the original bounding box group in the preset bounding box library, and if there is a target bounding box group, obtain a target collision detection result associated with the target bounding box group, and each preset bounding box group in the preset bounding box library is pre-associated with a standard collision detection result;
[0127] The determination module 30 is configured to determine whether a collision exists between the active virtual object and the passive virtual object if the target collision detection result indicates that a collision record exists.
[0128] In one embodiment, the detection module 20 is further configured to:
[0129] Obtain the first vertex coordinate information of the original bounding box group, and traverse each preset bounding box group in the preset bounding box library;
[0130] If the second vertex coordinate information of any preset bounding box group is consistent with the first vertex coordinate information, it is determined that there is a target bounding box group consistent with the original bounding box group in the preset bounding box library, and the preset bounding box group with consistent vertex coordinate information is determined as the target bounding box group;
[0131] If the second vertex coordinate information of all preset bounding box groups is inconsistent with the first vertex coordinate information, it is determined that there is no target bounding box group consistent with the original bounding box group in the preset bounding box library.
[0132] In one embodiment, the detection module 20 is further configured to:
[0133] If there is no target bounding box group, then check whether the first bounding box intersects with the second bounding box;
[0134] If they intersect, it is determined that there is a collision between the active virtual object and the passive virtual object;
[0135] If they do not intersect, it is determined that there is no collision between the active virtual object and the passive virtual object.
[0136] In one embodiment, the acquisition module 10 is further used for:
[0137] Get the virtual scene currently displayed by the head mounted device and construct a hierarchical bounding box of the virtual scene;
[0138] Obtain a first bounding box of the active virtual object, obtain a root node bounding box in the hierarchical bounding box, and use the root node bounding box as a second bounding box;
[0139] The first bounding box and the second bounding box are combined to obtain an original bounding box group to be collided.
[0140] In one embodiment, the collision detection device further includes a traversal module, which is used to:
[0141] If the second bounding box is not a leaf node bounding box in the hierarchical bounding box, determine the child node bounding box of the second bounding box in the hierarchical bounding box, take the child node bounding box as the new second bounding box, combine the first bounding box and the new second bounding box to obtain a new original bounding box group to be collided, and perform the next collision detection based on the new original bounding box group to be collided;
[0142] If the second bounding box is a leaf node bounding box in the hierarchical bounding box, the collision detection is terminated.
[0143] In one embodiment, the acquisition module 10 is further used for:
[0144] Dividing the virtual scene into a plurality of sub-virtual scenes, and determining a target sub-virtual scene where the active virtual object is located;
[0145] The step of constructing a hierarchical bounding box of the virtual scene is executed in the target sub-virtual scene.
[0146] In one embodiment, the collision detection device further includes a prompt module, and the prompt module is used to:
[0147] Output prompt information;
[0148] or determining a collision area between an active virtual object and a passive virtual object, and updating a display color of the collision area;
[0149] or updating the display color, position, shape and / or size of the active virtual object until there is no collision between the active virtual object and the passive virtual object;
[0150] Or update the display color, position, shape and / or size of the passive virtual object until there is no collision between the active virtual object and the passive virtual object.
[0151] In one embodiment, the active virtual object includes a virtual object in motion, a virtual character of a target user in a virtual scene, and / or a virtual object interacting with a virtual character in a virtual scene, wherein the target user is a user wearing a head mounted device.
[0152] In addition, an embodiment of the present application also proposes a head-mounted device, which includes a memory, a processor, and a collision detection program stored in the memory and executable on the processor. When the collision detection program is executed by the processor, the steps of the collision detection method as described above are implemented.
[0153] The head-mounted device may also include a processing device (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage device into a random access memory (RAM). In the RAM, various programs and data required for the operation of the head-mounted device are also stored. The processing device, ROM, and RAM are connected to each other through a bus. The input / output (I / O) interface is also connected to the bus. Generally, the following systems can be connected to the I / O interface: input devices such as touch screens, touch pads, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices such as liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices such as tapes, hard disks, etc.; and communication devices. The communication device can allow the head-mounted device to communicate with other devices wirelessly or wired to exchange data. Although the figure shows a head-mounted device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0154] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0155] The head-mounted device provided in the embodiment of the present application adopts the collision detection method in the above embodiment to solve the technical problem of collision detection. Compared with the prior art, the beneficial effects of the head-mounted device provided in the present application are the same as the beneficial effects of the collision detection method provided in the above embodiment, and the other technical features in the head-mounted device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0156] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0157] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0158] In addition, to achieve the above-mentioned purpose, an embodiment of the present application also provides a readable storage medium having computer-readable program instructions (ie, computer program) stored thereon, and the computer-readable program instructions are used to execute the collision detection method in the above-mentioned embodiment.
[0159] The computer-readable storage medium provided in the embodiment of the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0160] The computer-readable storage medium may be included in the head-mounted device; or may exist independently without being assembled into the head-mounted device.
[0161] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the head-mounted device, the head-mounted device: obtains an original bounding box group to be detected for collision, wherein the original bounding box group includes a first bounding box representing an active virtual object and a second bounding box representing a passive virtual object; detects whether there is a target bounding box group consistent with the original bounding box group in a preset bounding box library; if there is a target bounding box group consistent with the original bounding box group in the preset bounding box library, obtains a target collision detection result associated with the target bounding box group, and each preset bounding box group in the preset bounding box library is pre-associated with a standard collision detection result; if the target collision detection result indicates that there is a collision record, it is determined that there is a collision between the active virtual object and the passive virtual object.
[0162] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0163] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0164] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0165] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned collision detection method, and can solve the technical problem of collision detection. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the collision detection method provided in the above-mentioned embodiment, and will not be elaborated here.
[0166] In addition, an embodiment of the present application further proposes a computer program product, including a collision detection program, which implements the steps of the above collision detection method when executed by a processor.
[0167] The specific implementation of the computer program product of the present application is basically the same as the above-mentioned embodiments of the collision detection method, and will not be repeated here.
[0168] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0169] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0170] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software sensor, which is stored in a storage medium (such as ROM / RAM, disk, CD) as above, including a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods of each embodiment of the present application.
[0171] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A collision detection method, characterized in that: Applied to a head mounted device, the collision detection method comprises the following steps: Acquire an original bounding box group to be detected for collision, wherein the original bounding box group includes a first bounding box representing an active virtual object and a second bounding box representing a passive virtual object; Detecting whether there is a target bounding box group that is consistent with the original bounding box group in the preset bounding box library; If the target bounding box group exists, obtaining the target collision detection result associated with the target bounding box group, wherein the preset bounding box library is used to store preset bounding box groups and each preset bounding box group in the preset bounding box library is pre-associated with a standard collision detection result; If the target collision detection result indicates that there is a collision record, determining that there is a collision between the active virtual object and the passive virtual object; The step of detecting whether there is a target bounding box group consistent with the original bounding box group in the preset bounding box library includes: Obtaining the first vertex coordinate information of the original bounding box group, and traversing each preset bounding box group in the preset bounding box library; If the second vertex coordinate information of any of the preset bounding box groups is consistent with the first vertex coordinate information, it is determined that there is a target bounding box group consistent with the original bounding box group in the preset bounding box library, and the preset bounding box group with consistent vertex coordinate information is determined as the target bounding box group; If the second vertex coordinate information of all the preset bounding box groups is inconsistent with the first vertex coordinate information, determining that there is no target bounding box group consistent with the original bounding box group in the preset bounding box library; The active virtual object includes a virtual object in motion, a virtual character of a target user in a virtual scene, and / or a virtual object interacting with the virtual character in the virtual scene, wherein the target user is a user wearing the head mounted device; The passive virtual objects are other virtual objects in the virtual scene displayed by the head mounted device except the active virtual objects.
2. The method according to claim 1, characterized in that After the step of detecting whether there is a target bounding box group consistent with the original bounding box group in the preset bounding box library, the method further includes: If the target bounding box group does not exist, detecting whether the first bounding box intersects with the second bounding box; If they intersect, it is determined that there is a collision between the active virtual object and the passive virtual object; If they do not intersect, it is determined that there is no collision between the active virtual object and the passive virtual object.
3. The method according to claim 1, characterized in that The step of obtaining the original bounding box group to be detected for collision includes: Acquire the virtual scene currently displayed by the head mounted device, and construct a hierarchical bounding box of the virtual scene; Obtain a first bounding box of the active virtual object, obtain a root node bounding box in the hierarchical bounding box, and use the root node bounding box as a second bounding box; The first bounding box and the second bounding box are combined to obtain an original bounding box group to be detected for collision.
4. The method according to claim 3, characterized in that After the step of determining whether there is a collision between the active virtual object and the passive virtual object, the method further includes: If the second bounding box is not a leaf node bounding box in the hierarchical bounding box, determine the child node bounding box of the second bounding box in the hierarchical bounding box, use the child node bounding box as a new second bounding box, combine the first bounding box with the new second bounding box to obtain a new original bounding box group to be collided with, and perform the next collision detection based on the new original bounding box group to be collided with; If the second bounding box is a leaf node bounding box in the hierarchical bounding box, the collision detection is terminated.
5. The method according to claim 3, characterized in that After the step of obtaining the virtual scene currently displayed by the head mounted device, the method further includes: Dividing the virtual scene into a plurality of sub-virtual scenes, and determining a target sub-virtual scene where the active virtual object is located; The step of constructing a hierarchical bounding box of the virtual scene is performed in the target sub-virtual scene.
6. The method according to any one of claims 1 to 5, characterized in that: After the step of determining whether there is a collision between the active virtual object and the passive virtual object, the method further includes at least one of the following: Output prompt information; or determining a collision area between the active virtual object and the passive virtual object, and updating a display color of the collision area; or updating the display color, position, shape and / or size of the active virtual object until there is no collision between the active virtual object and the passive virtual object; Or update the display color, position, shape and / or size of the passive virtual object until there is no collision between the active virtual object and the passive virtual object.
7. A head mounted device, characterized in that: The head mounted device comprises: a memory, a processor and a collision detection program stored in the memory and executable on the processor, wherein the collision detection program implements the steps of the collision detection method according to any one of claims 1 to 6 when executed by the processor.
8. A readable storage medium, characterized in that: The readable storage medium is a computer-readable storage medium, on which is stored a program for implementing the collision detection method, and the program for implementing the collision detection method is executed by a processor to implement the steps of the collision detection method as claimed in any one of claims 1 to 6.
