Game bounding box processing method, device and electronic equipment
By responding to the interactive behavior of virtual characters and virtual objects in the game, segmenting and processing geometric surfaces to generate new bounding boxes, the problem that bounding boxes cannot be modified in real time in the existing technology is solved, and the realism of the game and the accuracy of physical collision detection is improved. sex.
Patent Information
- Application Number
- CN202110008868.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-05
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2041-01-05
AI Technical Summary
The enclosure box of objects in existing games cannot be modified in real time according to changes in the game scene, resulting in the physical collision detection results that are inconsistent with the player's subconscious visual effects, affecting the realism of the game and the player's experience.
By responding to the interactive behavior of virtual characters and virtual objects in the game scene, the target geometric surface and other geometric surfaces are determined, and a new bounding box is generated for physical collision detection to ensure that the detection results meet the player's visual expectations.
It realizes real-time modification of the bounding box according to dynamic changes in the game scene, improving the realism of the game and the player's gaming experience, and enhancing the authenticity of physical collision detection.
Smart Images

Figure CN112619152B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of game technology, and in particular to a method, device and electronic device for processing a game bounding box. Background Art
[0002] All objects in the game (characters, buildings, terrain, etc.) usually have a bounding box. The bounding box of an object is a closed space that completely contains the combination of objects. By encapsulating complex objects in a simple bounding box, the efficiency of geometric operations can be improved. The existing physical collision detection calculation process between objects is based on the bounding box of the object, which can make the game more realistic. For example: in the game, when a character encounters a wall and finds that he cannot move forward, the result is obtained after performing a collision detection calculation between the bounding box of the character and the bounding box of the wall.
[0003] In existing games, when encountering a game scene where the bounding box of an object needs to be changed, two methods are usually used to achieve it. One is to replace the current bounding box with a pre-made bounding box. This method cannot arbitrarily change the bounding box according to the current object shape change requirements. It can only be used in specific situations, which will limit the player's operational interaction in the game; the other is not to change the bounding box, which will make the game feel unreal and affect the user's immersive gaming experience. Summary of the invention
[0004] The purpose of the present application is to provide a method, device and electronic device for processing a game bounding box, which can modify the bounding box of a virtual object in real time according to the interaction of a virtual character with a virtual object in a game scene, so that the physical collision detection result is consistent with the player's subconscious visual effect, thereby improving the realism of the game and the player's gaming experience.
[0005] In a first aspect, an embodiment of the present application provides a method for processing a game bounding box, the method comprising: responding to an interactive behavior of a virtual character with a virtual object in a game scene, determining at least one target geometric surface, an interactive area on the target geometric surface, and at least one other geometric surface according to the interactive behavior and the current bounding box of the virtual object, wherein the at least one target geometric surface and the at least one other geometric surface correspond to the geometric surfaces constituting the current bounding box; segmenting the target geometric surface to obtain at least one segmented surface corresponding to the target geometric surface, wherein the segmented surface is a portion of the target geometric surface without the interactive area; generating a new bounding box of the virtual object based on the segmented surface and the other geometric surfaces, and the new bounding box is used for physical collision detection of the virtual object.
[0006] Furthermore, the above-mentioned step of determining at least one target geometric surface and at least one other geometric surface based on the interactive behavior and the current bounding box of the virtual object includes: obtaining the current bounding box of the virtual object; determining, based on the interactive behavior, that there is at least one interactive geometric surface for interactive operation among multiple geometric surfaces corresponding to the current bounding box of the virtual object; generating at least one target geometric surface based on the at least one interactive geometric surface; generating at least one other geometric surface based on the multiple geometric surfaces corresponding to the current bounding box, excluding the interactive geometric surface.
[0007] Furthermore, the above-mentioned step of determining the interaction area on the target geometric surface based on the interaction behavior and the current bounding box of the virtual object includes: detecting the initial interaction area of the interaction behavior on the target geometric surface; and taking the initial interaction area or the circumscribed polygon area corresponding to the initial interaction area as the interaction area on the target geometric surface.
[0008] Furthermore, the above-mentioned interaction area is a rectangular area; the step of segmenting the target geometric surface to obtain at least one segmentation surface corresponding to the target geometric surface includes: segmenting the target geometric surface using a straight line where a set of parallel edges of the interaction area and another set of parallel edges are located as segmentation lines to obtain multiple quadrilateral areas; and using the multiple quadrilateral areas without the interaction area as multiple segmentation surfaces corresponding to the target geometric surface.
[0009] Furthermore, the above step of generating a new bounding box of the virtual object based on the segmentation surface and other geometric surfaces includes: constructing a filling surface according to the segmentation surface and other geometric surfaces; generating a new bounding box of the virtual object according to the segmentation surface, the filling surface and other geometric surfaces.
[0010] Furthermore, the above-mentioned step of constructing a filling surface based on the dividing surfaces and other geometric surfaces includes: determining target vertices corresponding to multiple dividing surfaces; the target vertices are vertices among the vertices of the multiple dividing surfaces that do not overlap with vertices of other geometric surfaces; and constructing a filling surface based on the target vertices corresponding to the multiple dividing surfaces.
[0011] Furthermore, the above-mentioned step of generating a new bounding box of the virtual object based on the segmentation surface, the filling surface and other geometric surfaces includes: taking each of the segmentation surface, the filling surface and other geometric surfaces as the current surface, expanding a preset distance in a direction perpendicular to the current surface, and generating a small bounding box corresponding to the current surface; combining the small bounding boxes corresponding to multiple current surfaces to obtain a new bounding box of the virtual object.
[0012] Furthermore, each of the above-mentioned current faces records corresponding vertex data; the step of combining the small bounding boxes corresponding to multiple current faces to obtain a new bounding box of the virtual object includes: based on the vertex data corresponding to multiple current faces, combining the small bounding boxes corresponding to multiple current faces to obtain a new bounding box of the virtual object.
[0013] Furthermore, the step of obtaining the current bounding box of the virtual object includes: obtaining an initial bounding box of the virtual object; if the initial bounding box is a bounding sphere, using a circumscribed cube of the bounding sphere as the current bounding box of the virtual object.
[0014] In a second aspect, an embodiment of the present application also provides a device for processing a game bounding box, the device comprising: a surface determination module, for responding to the interactive behavior of a virtual character with a virtual object in a game scene, and determining at least one target geometric surface, an interactive area on the target geometric surface, and at least one other geometric surface according to the interactive behavior and the current bounding box of the virtual object, wherein the at least one target geometric surface and the at least one other geometric surface correspond to the geometric surfaces constituting the current bounding box; a surface segmentation module, for performing segmentation processing on the target geometric surface to obtain at least one segmentation surface corresponding to the target geometric surface, wherein the segmentation surface is the portion of the target geometric surface without the interactive area; a bounding box generation module, for generating a new bounding box of the virtual object based on the segmentation surface and the other geometric surfaces, and the new bounding box is used for performing physical collision detection on the virtual object.
[0015] In a third aspect, an embodiment of the present application further provides an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method described in the first aspect above.
[0016] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method described in the first aspect above.
[0017] In a method, device and electronic device for processing a game bounding box provided by an embodiment of the present application, first respond to the interactive behavior of a virtual character with a virtual object in a game scene, determine at least one target geometric surface, an interactive area on the target geometric surface and at least one other geometric surface according to the interactive behavior and the current bounding box of the virtual object, wherein at least one target geometric surface and at least one other geometric surface correspond to the geometric surface constituting the current bounding box; segment the target geometric surface to obtain at least one segmentation surface corresponding to the target geometric surface, wherein the segmentation surface is the portion of the target geometric surface without the interactive area; generate a new bounding box of the virtual object based on the segmentation surface and the other geometric surfaces, and the new bounding box is used to perform physical collision detection of the virtual object. The embodiment of the present application can generate a new bounding box that conforms to the current shape of the virtual object in real time according to the interactive behavior of the virtual character with the virtual object in the game scene, and use the new bounding box to perform physical collision detection of the object, so that the physical collision detection result can be consistent with the player's subconscious visual effect, thereby improving the realism of the game and the player's gaming experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 Schematic diagram of various bounding boxes in the prior art;
[0020] Figure 2 A schematic diagram of a building and its bounding box in a game provided by an embodiment of the present application;
[0021] Figure 3 A schematic diagram of a building being perforated by laser in a game provided by an embodiment of the present application;
[0022] Figure 4 A schematic diagram of a bounding box of a building in a game after being perforated by laser in the prior art;
[0023] Figure 5 A flowchart of a method for processing a bounding box provided in an embodiment of the present application;
[0024] Figure 6 A schematic diagram of a bounding box of a building after being perforated by laser in a game provided by an embodiment of the present application;
[0025] Figure 7 A schematic diagram of a bounding box surface decomposition provided in an embodiment of the present application;
[0026] Figure 8 A schematic diagram of a projection area on a target surface provided in an embodiment of the present application;
[0027] Fig. 9 A schematic diagram of laser projection on a target surface provided in an embodiment of the present application;
[0028] Fig.10 A schematic diagram of target surface segmentation provided in an embodiment of the present application;
[0029] Fig.11 A schematic diagram of each segmented surface after segmenting a target surface provided in an embodiment of the present application;
[0030] Fig.12 A schematic diagram of marking vertices corresponding to a split surface provided in an embodiment of the present application;
[0031] Fig.13 Schematic diagrams of several special segmentation surfaces provided in the embodiments of the present application;
[0032] Fig.14 A schematic diagram of a filling surface at the periphery of a damaged area provided in an embodiment of the present application;
[0033] Fig.15 A structural block diagram of a bounding box processing device provided in an embodiment of the present application;
[0034] Fig.16 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] The technical solution of the present application will be described clearly and completely below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0036] All objects in the game (characters, buildings, terrain, etc.) usually have a bounding box. The bounding box of an object is a closed space that completely contains the combination of objects. By encapsulating complex objects in a simple bounding box, the efficiency of geometric operations can be improved. The existing physical collision detection calculation process between objects is based on the bounding box of the object, which can make the game more realistic. For example: in the game, when a character encounters a wall and finds that he cannot move forward, the result is obtained after performing a collision detection calculation between the bounding box of the character and the bounding box of the wall.
[0037] See also Figure 1 As shown in the figure, the most common bounding box algorithms are AABB bounding box (Axis-aligned bounding box), Sphere, Oriented bounding box OBB (Oriented bounding box) and Fixed directions hull FDH (Fixed directions hulls or k-DOP, not shown in the figure). The most commonly used bounding box in games is the AABB bounding box (Axis-aligned bounding box), which is defined as the smallest hexahedron that contains the object and has sides parallel to the coordinate axes.
[0038] The above bounding boxes are all convex polygons. Only convex polygons can be used for physical collision calculations. A convex polygon means that if any of the edges of a polygon is infinitely extended to both sides to form a straight line, the other edges are on the same side of this straight line, and its internal angles should not be reflex angles. The line segment between any two vertices is located inside or on the edge of the polygon. Physical collision: This refers specifically to physical collision in games, and the calculation of detecting the intersection of two or more objects.
[0039] A common requirement in games is to dynamically modify the bounding box of an object in order to better show the shape changes of the object and its interaction with the surrounding environment and the character. For example, in a game scene, there is a building. Figure 2 As shown in (a) in , the corresponding bounding box is Figure 2 As shown in (b) in the figure, when the player uses the laser to shoot at the building, a huge hole will appear at the part of the building that is hit. Figure 3 As shown, in addition to visually seeing a huge hole, the player's subconscious mind will naturally think that some objects can pass through this hole. Because the building uses an AABB bounding box, if you want the object to pass through the hole, you need to modify the AABB bounding box of the building.
[0040] In the prior art, the processing of bounding boxes usually adopts the following two methods: one is to replace the current bounding box with a pre-made bounding box. This method cannot arbitrarily change the bounding box according to the current object shape change requirements, and can only be used in specific situations, which will limit the player's operation interaction in the game; the other is not to change the bounding box, which will cause the game to produce an unrealistic feeling and affect the player's gaming experience, such as Figure 4 As shown in (a) and (b), when a hole appears on the building, its bounding box is still not changed, and the following effect will occur: although it looks like there is a hole in the building, objects cannot pass through this hole; and if the bounding box of the building is completely cancelled, another phenomenon will occur, and objects can pass through the parts of the building where there are no holes. This is also an unrealistic feeling, which affects the user's gaming experience.
[0041] Based on this, the embodiments of the present application provide a method, device and electronic device for processing a game bounding box, which can modify the virtual object bounding box in real time according to the interaction of the virtual character with the virtual object in the game scene, so that the physical collision detection result is consistent with the player's subconscious visual effect, thereby improving the realism of the game and the player's gaming experience.
[0042] To facilitate understanding of this embodiment, a method for processing a game bounding box disclosed in an embodiment of the present application is first introduced in detail.
[0043] Figure 5 A flowchart of a method for processing a game bounding box provided in an embodiment of the present application, the method can modify the current bounding box of the virtual object in real time according to the interaction of the virtual character with the virtual object in the game scene, and replace the original bounding box with the new bounding box for physical collision detection calculation, so that the physical collision detection result can be consistent with the player's subconscious visual effect, thereby improving the realism of the game and the player's gaming experience. The method specifically includes the following steps:
[0044] Step S502, in response to the interaction behavior of the virtual character with the virtual object in the game scene, determining at least one target geometric surface, an interaction area on the target geometric surface, and at least one other geometric surface according to the interaction behavior and the current bounding box of the virtual object, wherein the at least one target geometric surface and the at least one other geometric surface correspond to the geometric surfaces constituting the current bounding box;
[0045] The above-mentioned virtual character is a player-controlled character or other non-player-controlled character in the game, and the virtual object can be a fixed object in the game scene, such as a building, a table, etc.; the interactive behavior of the virtual character on the virtual object in the game scene can include multiple implementation forms, such as the virtual character using a certain skill (such as firing a certain laser, or performing a certain magic) to create a hole in the middle of the virtual object (building), or the virtual character using a certain weapon (such as a machete) to destroy the virtual object (such as a box), resulting in missing blocks on the shape of the virtual object, etc.
[0046] When a virtual character in a game scene interacts with a virtual object, at least one target geometric surface, an interactive area on the target geometric surface, and at least one other geometric surface are first determined based on the interactive behavior and the current bounding box of the virtual object. The at least one target geometric surface and the at least one other geometric surface correspond to the geometric surfaces constituting the current bounding box; that is, the target geometric surface and the other geometric surfaces are generated based on the geometric surfaces of the current bounding box of the virtual object.
[0047] For example, if the current bounding box of the virtual object includes 6 square geometric faces, then the generated target geometric faces and other geometric faces are also 6 square geometric faces. The target geometric faces are generated based on the geometric faces that have interactive operations among the multiple geometric faces of the current bounding box, and the other geometric faces are generated based on the geometric faces that do not have interactive operations among the multiple geometric faces of the current bounding box.
[0048] In the target geometric surface generated above, an interactive area in the target geometric surface can be further determined according to the interactive behavior. The interactive area is the area where the interactive behavior has an impact on the target geometric surface.
[0049] In this embodiment, the current bounding box of the virtual object is generally a cubic bounding box. If the acquired bounding box is a bounding sphere, the circumscribed cube of the bounding sphere can be used as the current bounding box of the virtual object.
[0050] Step S504, segmenting the target geometric surface to obtain at least one segmentation surface corresponding to the target geometric surface, wherein the segmentation surface is a portion of the target geometric surface without the interaction area;
[0051] The shapes of the interaction area can include various shapes, such as circle, ellipse, rectangle, etc. In order to facilitate segmentation, the interaction area is processed into a rectangle. The target geometric surface is segmented based on the interaction area to obtain at least one segmentation surface that does not include the interaction area. There are various specific segmentation methods, and different segmentation methods can be adopted according to different shapes of the interaction area.
[0052] Step S506: Generate a new bounding box of the virtual object based on the segmentation surface and other geometric surfaces. The new bounding box is used for physical collision detection of the virtual object.
[0053] In order to achieve a more realistic visual effect after physical collision detection based on the finally generated new bounding box, a filling surface can be constructed based on the split surface and other geometric surfaces. The filling surface is used to generate a small bounding box at the periphery of the interactive area. Then, based on the above filling surface, split surface and other geometric surfaces, a new bounding box of the virtual object is generated. The new bounding box is used to perform physical collision detection on the virtual object. The physical collision detection result obtained by performing physical collision detection with the new bounding box can meet the player's subconscious visual effect, improve the realism of the game and the player's gaming experience.
[0054] In a method for processing a game bounding box provided in an embodiment of the present application, first responding to the interactive behavior of a virtual character with a virtual object in a game scene, at least one target geometric surface, an interactive area on the target geometric surface, and at least one other geometric surface are determined according to the interactive behavior and the current bounding box of the virtual object, wherein at least one target geometric surface and at least one other geometric surface correspond to the geometric surfaces constituting the current bounding box; segmenting the target geometric surface to obtain at least one segmentation surface corresponding to the target geometric surface, wherein the segmentation surface is the portion of the target geometric surface without the interactive area; generating a new bounding box of the virtual object based on the segmentation surface and the other geometric surfaces, and the new bounding box is used to perform physical collision detection of the virtual object. The embodiment of the present application can generate a new bounding box that conforms to the current shape of the virtual object in real time according to the interactive behavior of the virtual character with the virtual object in the game scene, and use the new bounding box to perform physical collision detection of the object, so that the physical collision detection result can be consistent with the player's subconscious visual effect, thereby improving the realism of the game and the player's gaming experience.
[0055] In order to clearly illustrate the steps of the bounding box processing method provided in the embodiment of the present application, the following is a detailed description of the above-mentioned virtual character shooting a laser through a virtual object building, where the current bounding box of the building is an AABB bounding box as an example:
[0056] like Figure 6As shown in the figure, after the building is perforated by laser, if the corresponding AABB bounding box needs to be consistent with the visual performance, a perforation operation needs to be performed on the AABB bounding box. In this way, the AABB bounding box needs to be modified. However, because the bounding box must be a convex hull, it is not possible to directly dig a hole on the AABB. Instead, the following steps need to be used:
[0057] (1) In response to the interaction of the virtual character with the virtual object in the game scene, the current bounding box of the virtual object is obtained. Figure 7 As shown, the current bounding box of the virtual object includes six geometric faces: front, back, left, right, top and bottom.
[0058] (2) Determine at least one target geometric surface and at least one other geometric surface based on the interactive behavior and the current bounding box of the virtual object.
[0059] Specifically, according to the interactive behavior, it is determined that among the multiple geometric surfaces corresponding to the current bounding box of the virtual object, there is at least one interactive geometric surface for interactive operation; based on the at least one interactive geometric surface, at least one target geometric surface is generated; and based on the multiple geometric surfaces corresponding to the current bounding box, except for the interactive geometric surface, at least one other geometric surface is generated.
[0060] like Figure 8 As shown, when the laser penetrates the building, there are interactive geometric surfaces, that is, the geometric surfaces intersecting with the laser include the "front" and "back" geometric surfaces. The "front" and "back" are determined as interactive geometric surfaces in the AABB bounding box, and then two target geometric surfaces are generated based on these two interactive geometric surfaces. Furthermore, four other geometric surfaces are generated based on other geometric surfaces except the two interactive geometric surfaces: "above", "below", "left" and "right".
[0061] (3) Determine the interaction area on the target geometric surface.
[0062] The specific implementation method may include: detecting the initial interaction area of the interactive behavior on the target geometric surface; using the initial interaction area or the circumscribed polygon area corresponding to the initial interaction area as the interaction area on the target geometric surface. For example, the above interactive behavior is that the virtual character shoots a laser at the building; Fig. 9 As shown in the figure, the projection area of the incident surface formed by the detection laser on the target geometric surface is the initial interaction area. Figure 8 In order to facilitate the segmentation calculation, the circumscribed polygon of the circular area is used as the interaction area on the target geometric surface, as shown in Fig.10 shown.
[0063] In actual games, no matter what skills, lasers, bullets, fists, etc., after the shape of the virtual object is changed, the projection on the target geometric surface of its bounding box is approximately a circle. This will have errors, but it does not affect the visual experience. In order to facilitate segmentation calculations, the circumscribed quadrilateral of the circle is used for segmentation in the embodiment of the present application.
[0064] (4) Segment the target geometric surface to obtain at least one segmentation surface corresponding to the target geometric surface.
[0065] Taking the interaction area as a rectangle as an example, the specific segmentation method is: use the straight line where a set of parallel sides of the interaction area and another set of parallel sides are located as the dividing lines, divide the target geometric surface, and obtain multiple quadrilateral areas; remove the multiple quadrilateral areas without the interaction area as the multiple segmentation surfaces corresponding to the target geometric surface.
[0066] Taking the above example as an example, the two target geometric surfaces corresponding to the “front” and “back” are segmented into four segmentation surfaces respectively. Fig.10 As shown in the figure, the target geometric surface corresponding to the “front” includes four quadrilaterals R1, R2, R3, and R4 after segmentation. Fig.11 As shown, each quadrilateral is composed of four points. For example, quadrilateral R1 is composed of point set (V1, V2, V8, V5), and quadrilateral R3 is composed of point set (V7, V8, V12, V11). Fig.12 shown.
[0067] In special cases, the area of the quadrilateral may be 0, as follows Fig.13 For the convenience of calculation, they are divided into four quadrilaterals, but the area of some quadrilaterals is 0.
[0068] (5) Construct a filling surface based on the segmentation surface and other geometric surfaces.
[0069] The specific construction method is: determine the target vertices corresponding to the multiple segmentation surfaces; wherein the target vertices are vertices among the vertices of the multiple segmentation surfaces that do not overlap with vertices of other geometric surfaces; and construct a filling surface according to the target vertices corresponding to the multiple segmentation surfaces.
[0070] As in the above example, the target geometric surface segmentation surface corresponding to the "front" includes four quadrilaterals R1, R2, R3, and R4. Among the multiple vertices corresponding to the four segmentation surfaces, the vertices that do not overlap with the vertices of other geometric surfaces include: V6, V7, V11, and V10. Similarly, the four target vertices of the segmentation surface of the target geometric surface corresponding to the "back" can be determined, and the eight target vertices can be connected to form four quadrilaterals, and four filling surfaces can be constructed with four quadrilaterals. Fig.14 As shown, a filling surface is constructed on the top, bottom, left and right sides of the hole respectively.
[0071] In another possible implementation, the target geometric surface may be one; for example, the laser did not penetrate the building, but only a large hole appeared. In this case, the target vertices corresponding to the multiple segmentation surfaces in the target geometric surface can be first determined, V6, V7, V11, and V10, and then the four vertices are extended to a certain depth distance in the interactive depth direction toward the inside of the building; a corresponding filling surface is constructed based on the extended vertices. In this case, in addition to the four filling surfaces similar to those in the previous example, there will be one more filling surface perpendicular to the depth direction, that is, a filling surface is constructed at the bottom of the hole.
[0072] (6) Generate a new bounding box of the virtual object based on the segmented surface, filled surface and other geometric surfaces.
[0073] Specifically, each of the above-mentioned split surfaces, filling surfaces and other geometric surfaces is taken as the current surface, and a preset distance is expanded in a direction perpendicular to the current surface to generate a small bounding box corresponding to the current surface; each of the above-mentioned current surfaces records corresponding vertex data; based on the vertex data corresponding to multiple current surfaces, the small bounding boxes corresponding to the multiple current surfaces are combined to obtain a new bounding box of the virtual object.
[0074] The above preset distance can be a pixel unit. As long as there is a certain distance, a bounding box can be formed for physical collision calculation. In the above example, there are four planes other than the target geometric surface, which can form four small bounding boxes. There are eight split surfaces on the two target geometric surfaces, which can form eight small bounding boxes. There are four filling surfaces in the interactive depth direction, which can form four small bounding boxes. Therefore, the new bounding box is actually a three-dimensional structure composed of sixteen small bounding boxes. Its shape is similar to Fig.14 As shown, each face is considered as a small bounding box.
[0075] By using the above-mentioned bounding box processing method of the present application, in the game, the player uses the laser skill to punch a big hole in a building. At this time, visually, there is already a big hole in the building, and the things behind the building can be seen through the big hole. At this time, by modifying the bounding box of the building, the player can actually pass through the big hole in the building, which gives the player a very realistic experience, and some sneak attack gameplay can also be implemented based on this function.
[0076] The bounding box processing method provided in the embodiment of the present application effectively solves the limitation that the bounding box of an object in a traditional game cannot be modified in real time at runtime. By modifying the bounding box in real time, it can ensure that the visual performance of the object and the physical collision of the object are consistent, thereby enhancing the realism of the game and further improving the player experience.
[0077] Based on the above method embodiment, the present application embodiment also provides a game bounding box processing device, see Fig.15 As shown, the device comprises:
[0078] The surface determination module 151 is used to respond to the interactive behavior of the virtual character to the virtual object in the game scene, and determine at least one target geometric surface, the interactive area on the target geometric surface, and at least one other geometric surface according to the interactive behavior and the current bounding box of the virtual object, wherein the at least one target geometric surface and the at least one other geometric surface correspond to the geometric surfaces constituting the current bounding box; the surface segmentation module 152 is used to segment the target geometric surface to obtain at least one segmentation surface corresponding to the target geometric surface, wherein the segmentation surface is the portion of the target geometric surface without the interactive area; the bounding box generation module 153 is used to generate a new bounding box of the virtual object based on the segmentation surface and the other geometric surfaces, and the new bounding box is used for physical collision detection of the virtual object.
[0079] Furthermore, the above-mentioned surface determination module 151 is also used to: obtain the current bounding box of the virtual object; determine, based on the interactive behavior, that there is at least one interactive geometric surface for interactive operation among the multiple geometric surfaces corresponding to the current bounding box of the virtual object; generate at least one target geometric surface based on the at least one interactive geometric surface; and generate at least one other geometric surface except the interactive geometric surface among the multiple geometric surfaces corresponding to the current bounding box.
[0080] Furthermore, the surface determination module 151 is also used to: detect an initial interaction area of the interaction behavior on the target geometric surface; and use the initial interaction area or a circumscribed polygon area corresponding to the initial interaction area as the interaction area on the target geometric surface.
[0081] Furthermore, the above-mentioned interaction area is a rectangular area; the above-mentioned surface segmentation module 152 is also used to: use the straight line where a set of parallel edges of the interaction area and another set of parallel edges are located as dividing lines, to segment the target geometric surface to obtain multiple quadrilateral areas; and use the multiple quadrilateral areas without the interaction area as multiple segmentation surfaces corresponding to the target geometric surface.
[0082] Furthermore, the above-mentioned bounding box generation module 153 is also used to: construct a filling surface according to the segmentation surface and other geometric surfaces; and generate a new bounding box of the virtual object according to the segmentation surface, the filling surface and other geometric surfaces.
[0083] Furthermore, the bounding box generation module 153 is also used to: determine target vertices corresponding to multiple segmentation surfaces; the target vertices are vertices among the vertices of the multiple segmentation surfaces that do not overlap with vertices of other geometric surfaces; and construct a filling surface based on the target vertices corresponding to the multiple segmentation surfaces.
[0084] Furthermore, the above-mentioned bounding box generation module 153 is also used to: take each of the splitting surfaces, filling surfaces and other geometric surfaces as the current surface, expand a preset distance in a direction perpendicular to the current surface, and generate a small bounding box corresponding to the current surface; combine the small bounding boxes corresponding to multiple current surfaces to obtain a new bounding box of the virtual object.
[0085] Furthermore, each of the above-mentioned current faces records corresponding vertex data; the above-mentioned bounding box generation module 153 is also used to: based on the vertex data corresponding to multiple current faces, respectively, combine the small bounding boxes corresponding to multiple current faces to obtain a new bounding box of the virtual object.
[0086] Furthermore, the face determination module 151 is further configured to: obtain an initial bounding box of the virtual object; if the initial bounding box is a bounding sphere, use a circumscribed cube of the bounding sphere as a current bounding box of the virtual object.
[0087] The game bounding box processing device provided in the embodiment of the present application has the same implementation principle and technical effects as those of the aforementioned game bounding box processing method embodiment. For the sake of brief description, for parts not mentioned in the embodiment of the game bounding box processing device, reference may be made to the corresponding contents in the aforementioned game bounding box processing method embodiment.
[0088] The present application also provides an electronic device, such as Fig.16 As shown, it is a schematic diagram of the structure of the electronic device, wherein the electronic device includes a processor 161 and a memory 160, the memory 160 stores computer executable instructions that can be executed by the processor 161, and the processor 161 executes the computer executable instructions to implement the above method.
[0089] exist Fig.16 In the illustrated embodiment, the electronic device further includes a bus 162 and a communication interface 163 , wherein the processor 161 , the communication interface 163 and the memory 160 are connected via the bus 162 .
[0090] Among them, the memory 160 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 163 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 162 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 162 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.16 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0091] The processor 161 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 161. The above processor 161 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor 161 reads the information in the memory and completes the steps of the method of the above embodiment in combination with its hardware.
[0092] An embodiment of the present application also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above method. The specific implementation can be found in the aforementioned method embodiment, which will not be repeated here.
[0093] The game bounding box processing method, device and computer program product of the electronic device provided in the embodiments of the present application include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0094] Unless otherwise specifically stated, the relative steps, numerical expressions and values of the components and steps set forth in these embodiments do not limit the scope of the present application.
[0095] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0096] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present application. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0097] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for processing a game bounding box, characterized in that: The method comprises: In response to the interaction behavior of the virtual character with the virtual object in the game scene, determine at least one target geometric surface, an interaction area on the target geometric surface, and at least one other geometric surface according to the interaction behavior and the current bounding box of the virtual object, wherein the at least one target geometric surface and the at least one other geometric surface correspond to the geometric surfaces constituting the current bounding box; Performing segmentation processing on the target geometric surface to obtain at least one segmentation surface corresponding to the target geometric surface, wherein the segmentation surface is a portion of the target geometric surface from which the interaction area is removed; Determine target vertices corresponding to the plurality of split surfaces; the target vertex is a vertex among the vertices of the plurality of split surfaces that does not overlap with the vertices of the other geometric surfaces; construct a filling surface according to the target vertices corresponding to the plurality of split surfaces; take the split surface, the filling surface and each of the other geometric surfaces as a current surface, expand a preset distance in a direction perpendicular to the current surface, and generate a small bounding box corresponding to the current surface; combine the small bounding boxes corresponding to the plurality of current surfaces to obtain a new bounding box of the virtual object, and the new bounding box is used to perform physical collision detection on the virtual object.
2. The method according to claim 1, characterized in that The step of determining at least one target geometric surface and at least one other geometric surface according to the interactive behavior and the current bounding box of the virtual object comprises: Obtaining a current bounding box of the virtual object; According to the interactive behavior, determining that among the multiple geometric surfaces corresponding to the current bounding box of the virtual object, there is at least one interactive geometric surface for interactive operation; Generating at least one target geometric surface according to the at least one interactive geometric surface; At least one other geometric surface is generated according to the geometric surface of the plurality of geometric surfaces corresponding to the current bounding box, excluding the geometric surface of the interactive geometric surface.
3. The method according to claim 2, characterized in that The step of determining the interaction area on the target geometric surface according to the interaction behavior and the current bounding box of the virtual object comprises: Detecting an initial interaction area of the interaction behavior on the target geometric surface; The initial interaction area or a circumscribed polygonal area corresponding to the initial interaction area is used as the interaction area on the target geometric surface.
4. The method according to claim 1, characterized in that The interaction area is a rectangular area; The step of segmenting the target geometric surface to obtain at least one segmented surface corresponding to the target geometric surface comprises: The target geometric surface is segmented by taking a straight line where a set of parallel sides of the interaction area are located and another set of parallel sides as segmentation lines to obtain a plurality of quadrilateral areas; The multiple quadrilateral areas without the interaction area are used as multiple segmentation surfaces corresponding to the target geometric surface.
5. The method according to claim 1, characterized in that Each current face has corresponding vertex data recorded; The step of combining a plurality of small bounding boxes corresponding to the current faces to obtain a new bounding box of the virtual object comprises: Based on the vertex data respectively corresponding to the multiple current faces, the small bounding boxes respectively corresponding to the multiple current faces are combined to obtain a new bounding box of the virtual object.
6. The method according to claim 2, characterized in that The step of obtaining the current bounding box of the virtual object comprises: Obtaining an initial bounding box of the virtual object; If the initial bounding box is a bounding sphere, the circumscribed cube of the bounding sphere is used as the current bounding box of the virtual object.
7. A device for processing a game bounding box, characterized in that: The device comprises: A surface determination module, for responding to the interaction behavior of the virtual character with the virtual object in the game scene, and determining at least one target geometric surface, an interaction area on the target geometric surface, and at least one other geometric surface according to the interaction behavior and the current bounding box of the virtual object, wherein the at least one target geometric surface and the at least one other geometric surface correspond to the geometric surfaces constituting the current bounding box; A surface segmentation module, configured to segment the target geometric surface to obtain at least one segmentation surface corresponding to the target geometric surface, wherein the segmentation surface is a portion of the target geometric surface from which the interaction area is removed; A bounding box generation module is used to determine target vertices corresponding to the multiple segmentation surfaces; the target vertices are vertices among the multiple segmentation surfaces that do not overlap with vertices of the other geometric surfaces; a filling surface is constructed according to the target vertices corresponding to the multiple segmentation surfaces; each of the segmentation surfaces, the filling surface and the other geometric surfaces is used as a current surface, and a preset distance is extended in a direction perpendicular to the current surface to generate a small bounding box corresponding to the current surface; the small bounding boxes corresponding to the multiple current surfaces are combined to obtain a new bounding box of the virtual object, and the new bounding box is used to perform physical collision detection on the virtual object.
8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method according to any one of claims 1 to 6.
