Collision detection method, device, computer equipment, and computer-readable storage medium

By obtaining the collision type and channel of objects in the virtual scene, determining the collision response and outputting abnormal indications, the problem of low object collision detection efficiency in the virtual scene is solved, and efficient and accurate collision detection is achieved.

CN113633988BActive Publication Date: 2025-09-05TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010345354.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-27
Publication Date
2025-09-05
Estimated Expiration
2040-04-27

AI Technical Summary

Technical Problem

In the prior art, object collision detection efficiency in virtual scenes is low, and it is impossible to effectively confirm the compliance of object collision results with design requirements.

Method used

By obtaining the objects and their collision types in the virtual scene, determining the corresponding collision channel, and outputting collision abnormality indications when the collision response does not comply with the preset rules, improving detection efficiency.

Benefits of technology

It improves the efficiency and accuracy of object collision detection, and can quickly identify and identify collision abnormal objects, making it easier to modify subsequently.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113633988B_ABST
    Figure CN113633988B_ABST
Patent Text Reader

Abstract

The present application relates to a collision detection method, apparatus, computer device, and computer-readable storage medium. The method comprises: obtaining a first object contained in a virtual scene and a corresponding collision type; when the collision type matches a preset collision type, obtaining a collision channel contained in the collision type; wherein the collision channel is used to store collision information between the first object and the object with collision; determining the collision response corresponding to the first object in different collision channels; and when there is a collision response that does not match the collision rule corresponding to the collision type, outputting a collision anomaly indication of the first object. This method can improve the efficiency of collision detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a collision detection method, apparatus, computer device, and computer-readable storage medium. Background Art

[0002] With the advancement of computer technology, virtual scenes are increasingly being used in games, virtual reality environments, and other scenarios, such as environment simulation and costume changes. Traditionally, to confirm that the collision results of objects in the virtual scene meet the design requirements, scene developers must, after completing scene development, test the collision between a human model or other object model and the virtual scene objects to observe whether collisions occur. However, current collision detection methods suffer from low detection efficiency. Summary of the Invention

[0003] Based on this, it is necessary to provide a collision detection method, apparatus, computer device and computer-readable storage medium that can improve the efficiency of collision detection in order to address the above technical problems.

[0004] A collision detection method, comprising:

[0005] Obtaining the first object contained in the virtual scene and the corresponding collision type;

[0006] When the collision type meets the preset collision type, a collision channel included in the collision type is obtained; wherein the collision channel is used to store collision information between the first object and the collision object;

[0007] determining collision responses corresponding to the first object in different collision channels;

[0008] When there is a collision response that does not match the collision rule corresponding to the collision type, a collision abnormality indication of the first object is output.

[0009] A collision detection device, comprising:

[0010] A type acquisition module, used to acquire a first object contained in the virtual scene and a corresponding collision type;

[0011] a channel acquisition module, configured to acquire a collision channel included in the collision type when the collision type meets a preset collision type; wherein the collision channel is configured to store collision information between the first object and the collision object;

[0012] a response determination module, configured to determine collision responses corresponding to the first object in different collision channels;

[0013] The abnormality output module is configured to output a collision abnormality indication of the first object when there is a collision response that does not match the collision rule corresponding to the collision type.

[0014] A computer device includes a memory and a processor, wherein the memory stores a computer program, and wherein the processor performs the following steps when executing the computer program:

[0015] Obtaining the first object contained in the virtual scene and the corresponding collision type;

[0016] When the collision type meets the preset collision type, a collision channel included in the collision type is obtained; wherein the collision channel is used to store collision information between the first object and the collision object;

[0017] determining collision responses corresponding to the first object in different collision channels;

[0018] When there is a collision response that does not match the collision rule corresponding to the collision type, a collision abnormality indication of the first object is output.

[0019] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0020] Obtaining the first object contained in the virtual scene and the corresponding collision type;

[0021] When the collision type meets the preset collision type, a collision channel included in the collision type is obtained; wherein the collision channel is used to store collision information between the first object and the collision object;

[0022] determining collision responses corresponding to the first object in different collision channels;

[0023] When there is a collision response that does not match the collision rule corresponding to the collision type, a collision abnormality indication of the first object is output.

[0024] The above-mentioned collision detection method, device, computer equipment and computer-readable storage medium can obtain the corresponding collision channel according to the collision type of the object to determine the collision response of the object corresponding to different collision channels, and output an abnormal indication when the collision response does not comply with the corresponding collision rule, which can improve the efficiency of object collision detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 is a diagram of the internal structure of a computer device in one embodiment;

[0026] Figure 2 1 is a flow chart of a collision detection method according to an embodiment;

[0027] Figure 3 A schematic diagram of the relationship between collision attributes and corresponding collision responses according to an embodiment;

[0028] Figure 4 1 is a flow chart of a collision detection method according to an embodiment;

[0029] Figure 5 is a schematic diagram of a virtual scene in one embodiment;

[0030] Figure 6 is a schematic diagram of position information of a first object with an abnormality in one embodiment;

[0031] Figure 7 A schematic diagram of displaying a collision anomaly indicator in a virtual scene in one embodiment;

[0032] Figure 8 A schematic diagram of an interface for selecting an object through a scene editor in one embodiment;

[0033] Figure 9 1 is a flow chart of a collision detection method according to an embodiment;

[0034] Figure 10 is a structural block diagram of a collision detection device in one embodiment;

[0035] Figure 11 FIG. 4 is a structural block diagram of a collision detection device in another embodiment. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0037] Figure 1 FIG. 1 is an application environment diagram of a collision detection method in an embodiment. Figure 1 As shown, the collision detection method is applied to a computer device. The computer device includes a processor, a memory, and a network interface connected via a system bus. The memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program. When the computer program is executed by the processor, the processor may execute the collision detection method provided in the present application. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor may execute the collision detection method provided in the present application. In some embodiments, the computer device may also include a display screen, an input device, etc.

[0038] The computer device may be a terminal or a server. The terminal may be a desktop terminal or a mobile terminal, and the mobile terminal may be at least one of a mobile phone, a tablet computer, a laptop computer, etc. The server may be an independent server or a server cluster composed of multiple servers.

[0039] In one embodiment, Figure 2 As shown, a collision detection method is provided, which is applied to Figure 1 The computer device in the example is used to illustrate the process, including the following steps:

[0040] Step 202: Obtain a first object contained in the virtual scene and a corresponding collision type.

[0041] A virtual scene refers to a virtual scene displayed or provided on a computer device. A virtual scene can be a simulation of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. A virtual scene can include environmental elements such as the sky, ocean, desert, and city, and can also include objects such as people, animals, walls, and vehicles. The first object is an object with a determined position contained in the virtual scene. The first object can be equivalent to a static object, or an object that moves within a specified range, and can generate movement when collided with other objects. For example, the first object can be an object such as a wall, household appliances and furniture, doors and windows, road obstacles, etc. in a virtual scene.

[0042] Collision types are categorized based on information such as how an object responds to collisions. In the scene editor corresponding to a virtual scene, a variety of different collision types can be provided. For example, collision types can include one or more of No Collision, Query Only, Collision Enabled, and Physics Only. When creating a virtual scene, scene developers can use the scene editor to set objects and their corresponding collision types, and the computer device can then obtain the collision type corresponding to the first object.

[0043] The computer device obtains a first object contained in the virtual scene and a corresponding collision type. Specifically, the computer device may obtain a collision detection indication for the virtual scene, and obtain all first objects contained in the virtual scene and their corresponding collision types based on the collision detection indication. Optionally, the computer device may also obtain a collision detection indication for any first object in the virtual scene, and obtain the targeted first object and its corresponding collision type based on the collision detection indication.

[0044] Step 204 : When the collision type meets the preset collision type, a collision channel included in the collision type is obtained; wherein the collision channel is used to store collision information between the first object and the collision object.

[0045] Preset collision types are pre-set by the computer device and require exception detection based on the collision response. Specifically, preset collision types can include one or more of collision query (Query Only), collision enabled (CollisionEnabled), and physics enabled (Physics Only). A collision type can include one or more collision channels.

[0046] The collision channel is used to store the collision information between the first object and the object with collision. Specifically, each collision channel corresponds to a collision object, and the collision channel can correspond to virtual objects, vehicles, virtual weapons, cameras and other collision objects controlled by the user. The collision channel can include the collision relationship of the first object with respect to the object with collision. For example, when the collision relationship stored in the collision channel of the virtual object is rigid, it means that the first object behaves rigidly when collided with the virtual object; when the collision relationship stored in the collision channel corresponding to the camera is ignored, it means that the first object behaves ignored when collided with the camera, etc.

[0047] The scene data corresponding to the virtual scene stores collision channels corresponding to different collision types, wherein the scene data corresponding to the virtual scene is saved after being set using a scene editor. Upon determining that the collision type meets a preset collision type, the computer device may obtain the collision channel included in the collision type from the data corresponding to the virtual scene. Optionally, in some embodiments, the scene editor may preset collision channels corresponding to different first objects, and upon determining that the collision type meets the preset collision type, the computer device may also obtain the collision channel corresponding to the first object.

[0048] In some embodiments, the computer device may also determine a collision type that does not require abnormality judgment based on the collision response as a preset collision type, and then obtain the collision channel included in the collision type when the collision type does not meet the preset collision type.

[0049] Step 206 : Determine the collision responses of the first object corresponding to different collision channels.

[0050] The collision response represents the result of a collision between two or more objects. Specifically, collision responses can include Ignore, Overlap, and Rigid. Ignore indicates that the objects are penetrated after the collision and no event notification is given; Overlap indicates that the objects are penetrated after the collision and an event notification is given; and Rigid indicates that the objects are not penetrated after the collision and an event notification is given.

[0051] The computer device determines collision responses corresponding to the first object in different collision channels. Specifically, the computer device may determine the collision response corresponding to the first object in the collision channel based on collision information stored in the collision channel. The collision channel may include a collision relationship between the first object and the collision object. Based on the collision relationship between the first object and the collision object, as well as the collision relationship between the collision object and other objects, the collision response corresponding to the first object in the collision channel may be obtained.

[0052] Step 208: When there is a collision response that does not match the collision rule corresponding to the collision type, a collision anomaly indication of the first object is output.

[0053] The computer device pre-stores collision rules corresponding to different collision types, so that after determining the collision responses corresponding to different collision channels, it can be judged whether the collision responses corresponding to the different collision channels match the collision rules corresponding to the collision types. When it is determined that there is a collision response that does not match the collision rules corresponding to the collision type, it is determined that the first object has a collision abnormality, and a collision abnormality indication of the first object can be output.

[0054] The computer device outputs a collision anomaly indication for the first object. Specifically, the computer device generates a collision anomaly identifier corresponding to the first object on an interface displaying a virtual scene, and displays the collision anomaly identifier for the first object simultaneously with the display of the virtual scene. Optionally, the computer device may further obtain a number of collision responses that do not match the collision rule, and output the first object with a collision anomaly based on the number of collision responses, from highest to lowest, or use different collision anomaly identifiers based on the number of collision responses.

[0055] In one embodiment, a computer device may generate a list of objects with collision anomalies in a virtual scene; thereby displaying information of a first object with collision anomalies in the object list, and when a trigger operation on the information of the first object is received, the first object may be identified in the virtual scene.

[0056] In one embodiment, the computer device may also record the first objects with collision anomalies in the form of a log. After completing the collision detection of all first objects, the computer device obtains and processes the information contained in the log to generate a csv (Comma-Separated Values) file; the first objects with collision anomalies can be viewed through the csv file.

[0057] In the embodiment provided by the present application, by obtaining a first object and a corresponding collision type contained in a virtual scene, when the collision type meets a preset collision type, a collision channel included in the collision type is obtained. The collision channel is used to store collision information between the first object and the object with collision, thereby determining the collision response corresponding to the first object in different collision channels. When there is a collision rule that does not match the collision rule corresponding to the collision type, a collision anomaly indication of the first object is output. Since the corresponding collision channel is obtained according to the collision type corresponding to the object to determine the collision response corresponding to the object in the collision channel, and an anomaly indication is output when the collision response does not meet the corresponding collision rule, the efficiency of object collision detection can be improved.

[0058] In one embodiment, in a collision detection method, the preset collision type does not include a no-collision type. The method may further include: when the collision type corresponding to the first object does not conform to the preset collision type, outputting a collision abnormality indication of the first object.

[0059] A no-collision type means that no collision events will be generated when an object is collided with. Specifically, the collision response corresponding to the no-collision type is usually ignored by default; that is, objects configured as no-collision types cannot have a collision channel configured, or even if a corresponding collision channel is configured, no event notification will be generated when they are collided with any collision-capable object.

[0060] It is generally believed that a virtual scene will not have objects of a non-collision type; if the collision type of the first object is a non-collision type, that is, it does not meet the preset collision type, the computer device can determine that there is a collision anomaly in the first object and output a collision anomaly indication of the first object, which can improve the accuracy of object collision detection.

[0061] In one embodiment, the provided collision detection method also includes: when the collision type is a collision query or a start-up collision, if the collision responses are all rigid, determining that there is no collision response that does not match the collision rule corresponding to the collision type; if the collision response includes at least one of ignore and overlap, determining that there is a collision response that does not match the collision rule corresponding to the collision type.

[0062] A collision query is a type of collision used for spatial queries. When the first object in a collision query is collided with a collision-related object, it can be used to determine whether to trigger the corresponding event for the collision-related object. For example, if the collision-related object is a gun, colliding with the first object in the collision query can determine whether a gun-firing event can be executed.

[0063] Initiating a collision refers to a type of collision that can be used for both spatial query and physical simulation. When the first object belonging to the initiating collision is collided with the object causing the collision, it can be used to determine whether to execute the trigger event corresponding to the object causing the collision and the physical response operation caused by the triggering collision. Among them, the physical response operation caused by the collision can be for at least one of the first object and the object causing the collision, and the physical response operation can be an operation such as object compression, object rebound, and object rolling. For example, if the object causing the collision is a vehicle and the first object is a road obstacle, then when the vehicle collides with the road obstacle, it can trigger the vehicle to rebound and retreat, and determine whether the road surface corresponding to the road obstacle is moving.

[0064] When the collision type is collision query or collision start, if the collision response is rigid, it means that there is an event notification of the collision between the object corresponding to the collision channel and the first object, and the corresponding trigger event can be executed; the computer device can determine that there is no collision response that does not match the collision rule corresponding to the collision type when the collision responses corresponding to the first object in different collision channels are all rigid.

[0065] If the collision responses corresponding to the first object in different collision channels include at least one of ignore and overlap, it means that there is penetration or the event notification cannot be triggered, and the trigger event corresponding to the collision cannot be executed. The computer device can then determine that there is a collision response that does not match the collision rule corresponding to the collision type.

[0066] In one embodiment, the provided collision detection method also includes: when the collision type is to activate physics, if the collision responses are all rigid and the first object has activated the physical collision characteristics, then it is determined that there is no collision response that does not match the collision rules corresponding to the collision type; if the collision response includes rigidity and the first object has not activated the physical collision characteristics, or the collision response includes at least one of ignore and overlap, then it is determined that there is a collision response that does not match the collision rules corresponding to the collision type.

[0067] Enabling physics refers to the type of collision used for physics simulation. When the first object, which is assigned to the physics enabler, collides with a collision-enabled object, it can be used to trigger a physical response to the collision. For example, if the first object is a sphere, a collision with the collision-enabled object can cause the sphere to roll.

[0068] The physical collision characteristic refers to the rigidity of the collided object. The collision rule corresponding to activating physics is that the object has the physical collision feature activated and the collision response is rigid. If the physical collision feature is activated and the collision response is rigid, the collision is normal. If the physical collision feature is not activated and the collision response is still rigid, the collision is abnormal.

[0069] When the collision type is to activate physics, if the collision responses are all rigid and the first object has activated the physical collision characteristics, the computer device can determine that there is no collision response that does not match the collision rules corresponding to the collision type; if there is a collision response that includes rigidity and the first object has not activated the physical collision characteristics, or the collision response includes at least one of ignore and overlap, it can be determined that there is a collision response that does not match the collision rules corresponding to the collision type.

[0070] By distinguishing different collision types, when the collision type is collision query and collision start, the collision response is used to directly determine whether the corresponding collision rules are met. When the collision type is physical start, the start of the physical collision characteristics of the object and the collision response are combined to determine whether the corresponding collision rules are met, which can improve the accuracy of collision detection.

[0071] In one embodiment, a collision detection method is provided for determining the collision response corresponding to the first object in different collision channels, including: obtaining a first collision attribute of the first object and a second collision attribute of the second object corresponding to the collision channel; when at least one of the first collision attribute and the second collision attribute includes an ignore attribute, determining that the collision response of the first object in the collision channel is ignore; when at least one of the first collision attribute and the second collision attribute includes an overlap attribute, and neither includes an ignore attribute, determining that the collision response of the first object in the collision channel is overlap; when the first collision attribute and the second collision attribute are both rigid attributes, determining that the collision response of the first object in the collision channel is rigid.

[0072] The second object is the object with collision corresponding to the collision channel. The second object can be a virtual object, vehicle, virtual weapon, camera or other object with collision controlled by the user. The collision attribute is configured by the scene developer through the editor to characterize the reaction of the object when it is collided. The collision attribute can include ignore attribute, overlap attribute, rigid attribute, etc. The collision channel can save the second object and the second collision attribute corresponding to the second object; the computer device can obtain the first collision attribute of the first object, and obtain the second object and the corresponding second collision attribute from the collision channel to determine the collision response of the first object in the collision channel.

[0073] In some embodiments, the computer device may further obtain a first collision attribute corresponding to the first object in the first channel and a second collision attribute corresponding to the second object in the collision channel, and determine a collision response of the first object in the collision channel based on the first and second collision attributes. That is, the first collision attributes corresponding to the first object in different collision channels may be different.

[0074] Figure 3 FIG. 1 is a schematic diagram showing the relationship between collision attributes and corresponding collision responses according to an embodiment. Figure 3As shown in the figure, the horizontal direction represents the first object and its corresponding first collision attribute; the vertical direction represents the second object and its corresponding second collision attribute; and the middle portion represents the collision response determined by the first and second collision attributes. Specifically, when at least one of the first and second collision attributes includes an ignore attribute, the collision response is ignore; when at least one of the first and second collision attributes includes an overlap attribute, and neither includes an ignore attribute, the collision response is overlap; and when both the first and second collision attributes are rigid attributes, the collision response is determined to be rigid.

[0075] For example, if the first object is a wall and the second objects are a human, a virtual weapon, and a vehicle, respectively, then if the first collision attributes for the wall in the human, virtual weapon, and vehicle channels are rigid, overlap, and overlap, respectively, and the second collision attributes for the human, virtual weapon, and vehicle channels are rigid, rigid, and ignore, respectively, then the wall's collision response in the human channel is rigid, in the virtual weapon channel is overlap, and in the vehicle channel is ignore. Furthermore, if the wall's collision response includes overlap and ignore, it can be determined that there is a collision response that does not match the collision rules for the wall's collision type.

[0076] By obtaining the first collision attribute of the first object and the second collision attribute of the second object corresponding to the collision channel, the collision response of the first object in the collision channel is determined according to the first collision attribute and the second collision attribute, so as to determine whether the collision of the first object is abnormal based on the collision response, the efficiency of collision detection can be improved.

[0077] Figure 4 FIG. 1 is a flow chart of a collision detection method in one embodiment. Figure 4 As shown, in one embodiment, a collision detection method is provided, including:

[0078] Step 402: Obtain objects contained in the virtual scene and corresponding object attributes.

[0079] Object properties can be used to characterize the functional characteristics of an object in a virtual scene. In this embodiment, the virtual scene can be displayed during scene editing and scene application. Taking the game virtual scene as an example, the objects contained in the virtual scene displayed by the game developer when editing the scene may be different from those in the virtual scene displayed when the game is running. Simulation properties are used to represent object properties that are only displayed during scene editing and not displayed during scene application. In addition, object properties can also include object properties that can be displayed both during scene editing and scene application, object properties that are not displayed during scene editing and only displayed during scene application, etc., and no restrictions are imposed on other object properties other than simulation properties.

[0080] Step 404 : Filter out objects in the virtual scene whose object attributes are simulation attributes, and obtain the first object contained in the virtual scene.

[0081] The computer device can filter out objects in the virtual scene whose object attributes are simulation attributes, and obtain the first object contained in the virtual scene. Specifically, when the computer device performs collision detection on the entire virtual scene, the computer device obtains all objects contained in the virtual scene and filters out objects whose object attributes are simulation attributes, that is, the first object other than objects with simulation attributes in the virtual scene can be obtained to perform collision detection on the first object contained in the virtual scene. In some embodiments, when the computer device performs collision detection on any object in the virtual scene, the computer device can determine whether the object attribute of the object is a simulation attribute. If not, the object is determined to be the first object for collision detection.

[0082] In some embodiments, the computer device may also obtain an object whitelist and retrieve a first object from the objects contained in the virtual scene that is not on the object whitelist. The object whitelist is used to store objects with simulated attributes. The computer device may pre-establish an object whitelist based on the object attributes, i.e., store objects with simulated attributes in the object whitelist. Thus, when performing collision detection on the virtual scene, the computer device retrieves the first object from the objects contained in the virtual scene that is not on the object whitelist for collision detection.

[0083] Step 406: Obtain a first object contained in the virtual scene and a corresponding collision type.

[0084] Step 408: When the collision type meets the preset collision type, a collision channel included in the collision type is obtained; wherein the collision channel is used to store the collision information between the first object and the collision object.

[0085] Step 410: Determine the collision responses of the first object corresponding to different collision channels.

[0086] Step 412: When there is a collision response that does not match the collision rule corresponding to the collision type, output a collision anomaly indication of the first object.

[0087] By filtering objects with simulated attributes in the virtual scene and obtaining the first object contained in the virtual scene for collision detection, it is possible to avoid collision detection on objects with model attributes and increase the time for invalid collision detection. Only collision detection is performed on objects with non-simulated attributes, which can improve the efficiency and accuracy of collision detection.

[0088] In one embodiment, a collision detection method is provided in which a collision anomaly indication of a first object is output, including: obtaining a coordinate position of a direction bounding box corresponding to the first object; and displaying the first object and a corresponding collision anomaly indicator at the coordinate position.

[0089] Bounding boxes are algorithms that replace complex geometric objects with slightly larger geometric objects. An oriented bounding box is a minimum rectangular parallelepiped that encloses the object and has any orientation relative to the coordinates. The oriented bounding box corresponding to the first object is the minimum rectangular parallelepiped that encloses the first object along the directions of its principal components.

[0090] The virtual scene is constructed with coordinate axes, and the position of an object in the virtual scene can be determined by the coordinate position. In an embodiment of the present application, the computer device can obtain the coordinate position of the directional bounding box corresponding to the first object and display the first object and the corresponding collision anomaly indicator at this coordinate position. Optionally, in some embodiments, the computer device can also use other bounding box algorithms to obtain the coordinate position corresponding to the first object to display the first object.

[0091] The collision anomaly indicator is used to indicate an object anomaly. Specifically, the collision anomaly indicator can include one or more of the following identification methods: object highlighting, floating point identification, text identification, and pattern identification. When the collision anomaly indicator is one or more of these, the computer device can determine the location of the collision anomaly indicator based on the coordinate position corresponding to the first object to display the collision anomaly indicator.

[0092] In one embodiment, the coordinate positions of the directional bounding box corresponding to the first object obtained by the computer may be the coordinate positions of the vertices of the directional bounding box corresponding to the first object, thereby displaying collision anomaly indicators at the vertices of the directional bounding box corresponding to the first object based on the coordinate positions of the vertices. For example, the computer device may obtain the coordinate positions of the four vertices of the directional bounding box of the first object, thereby generating rays at the four vertices to represent the collision anomaly of the first object.

[0093] By obtaining the coordinate position of the direction bounding box corresponding to the first object and displaying the first object and the corresponding collision anomaly mark at the coordinate position, the object with the collision anomaly can be displayed intuitively, which facilitates the modification of the collision information of the object and improves the efficiency of collision anomaly processing.

[0094] like Figure 5 FIG. 1 is a schematic diagram of a virtual scene without collision detection in one embodiment. In this diagram, the virtual scene may include multiple first objects. Figure 6 FIG. 1 is a schematic diagram of position information of an abnormal first object in one embodiment. Figure 6 for Figure 5After collision detection is performed on the displayed virtual scene, the computer device outputs the coordinate position of the first object with an abnormality. Specifically, the coordinate position is the coordinate position of the four vertices of the direction bounding box corresponding to the first object.

[0095] Figure 7 A schematic diagram of displaying a collision anomaly indicator in a virtual scene in an embodiment. Figure 7 Based on Figure 6 The schematic diagram of outputting the coordinate position of the abnormal first object for collision abnormality indication. Figure 7 As shown, the computer device can generate rays at the four vertices of the direction bounding box of the first object as a collision anomaly identifier of the first object.

[0096] Figure 8 FIG. 1 is a schematic diagram of an interface for selecting an object through a scene editor in one embodiment. Figure 8 As shown, the scene editor interface includes a scene display interface 802 and a scene editing interface 804. The computer device can receive a trigger operation on an object displayed in the scene display interface 802 and display collision information of the object in the scene editing interface 804 based on the trigger operation. The computer device can also receive a trigger operation on an object identifier displayed in the scene editing interface 804 and identify the object corresponding to the object identifier in the scene display interface 802 based on the trigger operation. The object identifier is a unique identifier of the object in the virtual scene.

[0097] In one embodiment, the provided collision detection method displays the first object and the corresponding collision anomaly identifier at the coordinate position, and also includes: obtaining an abnormal collision channel, which is a collision channel corresponding to a collision response that does not match the collision rule corresponding to the collision type; displaying the first object at the coordinate position, and displaying the collision anomaly identifier corresponding to the first object according to the identification attribute corresponding to the abnormal collision channel.

[0098] An abnormal collision channel is a collision channel corresponding to a collision response that doesn't match the collision rule corresponding to the collision type. Specifically, if the collision response of the first object in a collision channel is Ignore or Overlap, the collision channel is considered abnormal. If the collision response of the first object in a collision channel is Rigid, and the collision type of the first object is Physics Enabled but the physical collision feature is not enabled, the collision channel is considered abnormal.

[0099] The computer device displays the collision abnormality identification corresponding to the first object according to the identification attributes corresponding to the abnormal collision channel. Specifically, the identification attributes may include the size, color, shape, etc. of the identification. The computer device may display the collision abnormality identification of the first object according to the corresponding identification attributes based on the pre-stored identification attributes corresponding to different collision channels when determining the abnormal collision channel. For example, the computer device may pre-store the correspondence between collision channels and identification colors as human body: yellow, vehicle: green, virtual weapon: blue, other destructive objects: black, camera: red, etc.; if it is determined that the collision abnormality channel corresponding to the first object is a camera and a virtual weapon, the collision abnormality identification of the first object may be displayed according to red and blue.

[0100] By obtaining the abnormal collision channel corresponding to the collision response that does not match the collision rule corresponding to the collision type, and displaying the collision abnormality identification corresponding to the first object at the coordinate position of the direction bounding box corresponding to the first object according to the identification attribute corresponding to the abnormal collision channel, the channel where the collision abnormality exists can be directly displayed, thereby improving the accuracy of the collision abnormality identification.

[0101] Figure 9 FIG. 1 is a flow chart of a collision detection method in one embodiment. Figure 9 As shown, in one embodiment, a collision detection method is provided, including:

[0102] Step 902: Obtain objects contained in the virtual scene and corresponding object attributes.

[0103] Step 904 : Filter out objects in the virtual scene whose object attributes are simulation attributes, and obtain the first object contained in the virtual scene.

[0104] Step 906 , determining whether the collision type meets the preset collision type. If yes, proceed to step 908 ; if no, proceed to step 914 .

[0105] Step 908: Acquire the collision channel included in the collision type; wherein the collision channel is used to store the collision information between the first object and the collision-related object.

[0106] Step 910: Determine the collision responses of the first object corresponding to different collision channels.

[0107] Step 912 , determining whether there is a collision response that does not match the collision rule corresponding to the collision type. If so, proceed to step 914 ; if not, proceed to step 916 .

[0108] Step 914: Output a collision anomaly indication of the first object.

[0109] Step 916: Determine whether the first object collision is normal.

[0110] The present application also provides a game scene that uses the above-mentioned collision detection method for collision detection. Specifically, the game scene can be developed using Unreal Engine, and game developers can use Unreal Engine to place game object actors in the game scene. When the game scene is running, it contains static mesh objects (Static Mesh Actors) pre-set in the game scene, virtual objects controlled by the user, virtual weapons and equipment carried by the virtual objects, and other objects. The above-mentioned collision detection method can be used to perform collision detection on the static mesh objects contained in the game scene to determine whether the static mesh objects meet the collision requirements of the game developer, thereby improving the accuracy of collision detection.

[0111] It should be understood that although Figure 2-9 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 2-9 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The order of execution of these steps or stages is not necessarily one by one, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0112] In one embodiment, Figure 10 As shown, a collision detection device 1000 is provided. The device can be a software module or a hardware module, or a combination of the two to form a part of a computer device. The device specifically includes: a type acquisition module 1002, a channel acquisition module 1004, a response determination module 1006 and an abnormality output module 1008, wherein:

[0113] A type acquisition module 1002 is used to acquire a first object contained in the virtual scene and a corresponding collision type;

[0114] The channel acquisition module 1004 is configured to acquire a collision channel included in the collision type when the collision type meets the preset collision type, wherein the collision channel is used to store collision information between the first object and the collision object;

[0115] a response determination module 1006 , configured to determine collision responses corresponding to the first object in different collision channels;

[0116] The abnormality output module 1008 is configured to output a collision abnormality indication of the first object when there is a collision response that does not match the collision rule corresponding to the collision type.

[0117] The collision detection device provided in the embodiment of the present application can obtain the corresponding collision channel according to the collision type corresponding to the object to determine the collision response corresponding to the object in the collision channel. When the collision response does not comply with the corresponding collision rule, an abnormal indication is output, which can improve the efficiency of object collision detection.

[0118] like Figure 11 As shown, in one embodiment, the provided collision detection device also includes a rule matching module 1010, which is used to determine that there is no collision response that does not match the collision rule corresponding to the collision type if the collision response is rigid when the collision type is a collision query or a start-up collision; if the collision response includes at least one of ignore and overlap, it is determined that there is a collision response that does not match the collision rule corresponding to the collision type.

[0119] In one embodiment, the rule matching module 1010 can also be used to determine that when the collision type is to activate physics, if the collision responses are all rigid and the first object has activated the physical collision characteristics, then there is no collision response that does not match the collision rule corresponding to the collision type; if the collision response includes rigidity and the first object has not activated the physical collision characteristics, or the collision response includes at least one of ignore and overlap, then there is a collision response that does not match the collision rule corresponding to the collision type.

[0120] By distinguishing different collision types, when the collision type is collision query and collision start, the collision response is used to directly determine whether the corresponding collision rules are met. When the collision type is physical start, the start of the physical collision characteristics of the object and the collision response are combined to determine whether the corresponding collision rules are met, which can improve the accuracy of collision detection.

[0121] In one embodiment, the response determination module 1006 can also be used to obtain the first collision attribute of the first object and the second collision attribute of the second object corresponding to the collision channel; when at least one of the first collision attribute and the second collision attribute includes an ignore attribute, the collision response of the first object in the collision channel is determined to be ignore; when at least one of the first collision attribute and the second collision attribute includes an overlap attribute, and neither includes an ignore attribute, the collision response of the first object in the collision channel is determined to be overlap; when the first collision attribute and the second collision attribute are both rigid attributes, the collision response of the first object in the collision channel is determined to be rigid.

[0122] By obtaining the first collision attribute of the first object and the second collision attribute of the second object corresponding to the collision channel, the collision response of the first object in the collision channel is determined according to the first collision attribute and the second collision attribute, so as to determine whether the collision of the first object is abnormal based on the collision response, the efficiency of collision detection can be improved.

[0123] In one embodiment, the provided collision detection device may further include an object acquisition module 1012, which is used to obtain objects contained in the virtual scene and their corresponding object attributes; filter out objects in the virtual scene whose object attributes are simulation attributes, and obtain the first object contained in the virtual scene.

[0124] In one embodiment, the object acquisition module 1012 can also be used to obtain an object whitelist, and obtain a first object that does not belong to the object whitelist from the objects contained in the virtual scene, wherein the object whitelist is used to store objects whose object attributes are simulation attributes.

[0125] By filtering objects with simulated attributes in the virtual scene and obtaining the first object contained in the virtual scene for collision detection, it is possible to avoid collision detection on objects with model attributes and increase the time for invalid collision detection. Only collision detection is performed on objects with non-simulated attributes, which can improve the efficiency and accuracy of collision detection.

[0126] In one embodiment, the preset collision type does not include a no-collision type, and the abnormality output module 1008 may be further configured to output a collision abnormality indication of the first object when the collision type corresponding to the first object does not conform to the preset collision type.

[0127] The collision type of the first object is a no-collision type, that is, it does not meet the preset collision type. By outputting a collision abnormality indication of the first object when the collision type of the first object does not meet the preset collision type, the accuracy of object collision detection can be improved.

[0128] In one embodiment, the abnormality output module 1008 may also be used to obtain the coordinate position of the directional bounding box corresponding to the first object; and display the first object and the corresponding collision abnormality mark at the coordinate position.

[0129] By obtaining the coordinate position of the direction bounding box corresponding to the first object and displaying the first object and the corresponding collision anomaly mark at the coordinate position, the object with the collision anomaly can be displayed intuitively, which facilitates the modification of the collision information of the object and improves the efficiency of collision anomaly processing.

[0130] In one embodiment, the abnormal output module 1008 can also be used to obtain an abnormal collision channel, which is a collision channel corresponding to a collision response that does not match the collision rule corresponding to the collision type; display the first object at the coordinate position, and display the collision abnormality identifier corresponding to the first object according to the identification attribute corresponding to the abnormal collision channel.

[0131] By obtaining the abnormal collision channel corresponding to the collision response that does not match the collision rule corresponding to the collision type, and displaying the collision abnormality identification corresponding to the first object at the coordinate position of the direction bounding box corresponding to the first object according to the identification attribute corresponding to the abnormal collision channel, the channel where the collision abnormality exists can be directly displayed, thereby improving the accuracy of the collision abnormality identification.

[0132] For the specific definition of the collision detection device, please refer to the definition of the collision detection method above and will not be repeated here. Each module in the above-mentioned collision detection device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each of the above modules.

[0133] Those skilled in the art will understand that Figure 1 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0134] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.

[0135] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above-mentioned method embodiments when executed by a processor.

[0136] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0137] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0138] The above embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.

Claims

1. A collision detection method, characterized in that: The method comprises: Obtaining the first object contained in the virtual scene and the corresponding collision type; When the collision type meets the preset collision type, a collision channel included in the collision type is obtained; wherein the collision channel is used to store collision information between the first object and the collision object; determining collision responses corresponding to the first object in different collision channels; When there is a collision response that does not match the collision rule corresponding to the collision type, obtaining the coordinate positions of the vertices of a directional bounding box corresponding to the first object; the directional bounding box is a minimum cuboid along the principal component direction of the first object and enclosing the first object; According to the coordinate position of the vertex, a collision anomaly identifier corresponding to the first object is generated and displayed at the vertex of the direction bounding box; the collision anomaly identifier is used to indicate that the collision information of the first object with the collision anomaly is modified.

2. The method according to claim 1, characterized in that The method further comprises: When the collision type is a collision query or a start collision, if the collision responses are all rigid, determining that there is no collision response that does not match the collision rule corresponding to the collision type; If the collision response includes at least one of ignore and overlap, it is determined that there is a collision response that does not match the collision rule corresponding to the collision type.

3. The method according to claim 1, characterized in that The method further comprises: When the collision type is physics activated, if the collision responses are all rigid and the first object has activated a physical collision characteristic, determining that there is no collision response that does not match the collision rule corresponding to the collision type; If the collision response includes rigidity and the first object does not activate a physical collision characteristic, or the collision response includes at least one of ignore and overlap, it is determined that there is a collision response that does not match the collision rule corresponding to the collision type.

4. The method according to claim 1, wherein Determining the collision responses corresponding to the first object in different collision channels includes: Obtaining a first collision attribute of the first object and a second collision attribute of a second object corresponding to the collision channel; When at least one of the first collision attribute and the second collision attribute includes an ignore attribute, determining that the collision response of the first object in the collision channel is ignore; When at least one of the first collision attribute and the second collision attribute includes an overlap attribute, and neither includes an ignore attribute, determining that the collision response of the first object in the collision channel is an overlap; When both the first collision attribute and the second collision attribute are rigid attributes, it is determined that the collision response of the first object in the collision channel is rigid.

5. The method according to claim 1, wherein Before obtaining the first object contained in the virtual scene and the corresponding collision type, the method further includes: Obtaining objects and corresponding object attributes contained in the virtual scene, filtering out objects in the virtual scene whose object attributes are simulation attributes, and obtaining a first object contained in the virtual scene; or An object whitelist is obtained, and a first object that does not belong to the object whitelist is obtained from objects included in the virtual scene, wherein the object whitelist is used to store objects whose object attributes are simulation attributes.

6. The method according to claim 1, characterized in that The generating and displaying a collision anomaly mark corresponding to the first object at the vertex of the direction bounding box according to the coordinate position of the vertex also includes: Acquire an abnormal collision channel, where the abnormal collision channel is a collision channel corresponding to a collision response that does not match a collision rule corresponding to the collision type; The first object is displayed at the coordinate position, and according to the identification attribute corresponding to the abnormal collision channel, a collision abnormality identification corresponding to the first object is generated and displayed at the vertex of the direction bounding box.

7. A collision detection device, characterized in that: The device comprises: A type acquisition module, used to acquire a first object contained in the virtual scene and a corresponding collision type; a channel acquisition module, configured to acquire a collision channel included in the collision type when the collision type meets a preset collision type, wherein the collision channel is used to store collision information between the first object and the collision object; a response determination module, configured to determine collision responses corresponding to the first object in different collision channels; An exception output module is used to obtain the coordinate positions of the vertices of the directional bounding box corresponding to the first object when there is a collision response that does not match the collision rule corresponding to the collision type; the directional bounding box is the smallest rectangular block along the main component direction of the first object and surrounding the first object; according to the coordinate positions of the vertices, a collision exception identifier corresponding to the first object is generated and displayed at the vertex of the directional bounding box; the collision exception identifier is used to indicate that the collision information of the first object with the collision exception is modified.

8. The device according to claim 7, characterized in that The device further comprises: A rule matching module is configured to, when the collision type is a collision query or a collision start, determine that there is no collision response that does not match the collision rule corresponding to the collision type if the collision responses are all rigid; and to determine that there is a collision response that does not match the collision rule corresponding to the collision type if the collision response includes at least one of ignore and overlap.

9. The device according to claim 7, characterized in that The device further comprises: A rule matching module is used to determine, when the collision type is physics activated, that there is no collision response that does not match the collision rule corresponding to the collision type if the collision responses are all rigid and the first object has activated the physical collision characteristics; if the collision response includes rigidity and the first object has not activated the physical collision characteristics, or the collision response includes at least one of ignore and overlap, then determine that there is a collision response that does not match the collision rule corresponding to the collision type.

10. The device according to claim 7, characterized in that The response determination module is used to obtain the first collision attribute of the first object and the second collision attribute of the second object corresponding to the collision channel; when at least one of the first collision attribute and the second collision attribute includes an ignore attribute, it is determined that the collision response of the first object in the collision channel is ignore; when at least one of the first collision attribute and the second collision attribute includes an overlap attribute, and neither includes an ignore attribute, it is determined that the collision response of the first object in the collision channel is overlap; when the first collision attribute and the second collision attribute are both rigid attributes, it is determined that the collision response of the first object in the collision channel is rigid.

11. The device according to claim 7, characterized in that The device further comprises: An object acquisition module is used to obtain objects contained in the virtual scene and their corresponding object attributes, filter out objects in the virtual scene whose object attributes are simulation attributes, and obtain a first object contained in the virtual scene; or obtain an object whitelist, and obtain a first object that does not belong to the object whitelist from the objects contained in the virtual scene, wherein the object whitelist is used to store objects whose object attributes are simulation attributes.

12. The device according to claim 7, characterized in that The abnormal output module is also used to obtain an abnormal collision channel, which is a collision channel corresponding to a collision response that does not match the collision rule corresponding to the collision type; display the first object at the coordinate position, and generate and display a collision abnormality identifier corresponding to the first object at the vertex of the direction bounding box based on the identification attribute corresponding to the abnormal collision channel.

13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

14. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.