Method and apparatus for detecting a floating object
By determining the maximum height of the target object and the distance between its vertex and the collider in a virtual scene, floating objects can be automatically detected, solving the problems of low efficiency and poor accuracy of human eye detection and achieving efficient and accurate detection of floating objects.
Patent Information
- Application Number
- CN202010167421.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-11
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2040-03-11
AI Technical Summary
In existing technologies, detecting floating objects in virtual scenes by human observation is inefficient and prone to missed or false detections, affecting the development efficiency and effectiveness of virtual scenes.
By determining the maximum vertical height of the target object and the vertical distances between the M vertices of its upper surface and the first collider, a distance set is formed, and the number of distances in the distance set that meet the preset conditions is determined, thus automatically detecting floating objects.
It improves the accuracy of detecting floating objects in virtual scenes, reduces missed detections and false detections, and improves detection efficiency and accuracy.
Smart Images

Figure CN111402370B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information processing, and in particular to a method and apparatus for detecting buoyant objects. Background Technology
[0002] Currently, during game or animation development, developers can create virtual scenes using a scene editor and edit and place objects within them. However, due to developer errors or scene adjustments, objects placed in the virtual scene may drift away from colliders, resulting in abnormal floating states. Therefore, it is necessary to perform floating object detection on the virtual scene. Colliders are typically the ground or accumulated objects.
[0003] In related technologies, after the virtual scene is edited, developers can visually detect the presence of floating objects in the virtual scene. For example, they can observe whether the bottom of each object in the virtual scene is in contact with the ground. If the bottom of an object is not in contact with the ground, it is determined to be a floating object. Then, the position of the detected floating objects is adjusted so that they come into contact with colliders, ensuring that the placement of objects in the virtual scene conforms to the rules of the real world.
[0004] However, the above-mentioned method of detecting floating objects by human observation has low detection efficiency and is prone to missed detections and false detections, which will affect the development efficiency and effect of virtual scenes. Summary of the Invention
[0005] This application provides a method, apparatus, device, and storage medium for detecting floating objects, which can solve the problems of low detection efficiency and frequent missed and false detections of floating objects in related technologies. The technical solution is as follows:
[0006] On the one hand, a method for detecting floating objects is provided, the method comprising:
[0007] Determine the maximum height of the target object in the vertical direction, where the target object is the object to be detected in the virtual scene;
[0008] Determine the vertical distances between the M first vertices of the upper surface of the target object and the first collider to obtain a first distance set. The first collider is the collider that is closest to the target object in the vertically downward direction. M is an integer greater than or equal to 4.
[0009] If the number of first distances in the first distance set that satisfy the first preset condition is greater than N, then the target object is determined to be a floating object. The first preset condition is that the difference between the target object and the maximum height is greater than the floating threshold, and N is an integer greater than 3 and less than M.
[0010] On the one hand, a floating object detection device is provided, the device comprising:
[0011] The first determining module is used to determine the maximum height of the target object in the vertical direction, wherein the target object is a three-dimensional object to be detected in the virtual scene;
[0012] The second determining module is used to determine the vertical distance between the M first vertices of the upper surface of the target object and the first collider, to obtain a first distance set, wherein the first collider is the collider that is closest to the target object in the vertically downward direction, and M is an integer greater than or equal to 4;
[0013] The third determining module is used to determine that the target object is a floating object if the number of first distances in the first distance set that satisfy the first preset condition is greater than N. The first preset condition is that the difference between the first distance and the maximum height is greater than the floating threshold, and N is an integer greater than 3 and less than M.
[0014] On one hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the instruction, the program, the code set or instruction set being loaded and executed by the processor to implement the above-described floating object detection method.
[0015] On one hand, a computer-readable storage medium is provided, characterized in that the storage medium stores at least one instruction, at least one program, code set, or instruction set, wherein the instruction, program, code set, or instruction set is loaded and executed by a processor to implement the above-mentioned floating object detection method.
[0016] On the other hand, a computer program product is also provided, which, when executed, is used to implement the above-mentioned method for detecting floating objects.
[0017] The beneficial effects of the technical solutions provided in this application are:
[0018] In this embodiment, for a target object to be detected in a virtual scene, the maximum height of the target object in the vertical direction can be determined, as well as the vertical distances between the M vertices of the target object's upper surface and the first collider. If the number of first distances in the first distance set that satisfy the condition that the difference between the target object and the maximum height is greater than the floating threshold is greater than N, then the target object can be determined to be a floating object. That is, the above method can be used to automatically detect floating objects in a virtual scene with high accuracy and low likelihood of missed or false detections, thereby improving detection efficiency and accuracy. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart of a floating object detection method provided in an embodiment of this application;
[0021] Figure 2 This is a schematic diagram of a floating object detection provided in an embodiment of this application;
[0022] Figure 3 This is a schematic diagram of a settings interface 300 provided in an embodiment of this application;
[0023] Figure 4 This is another schematic diagram of floating object detection provided in an embodiment of this application;
[0024] Figure 5 This is another schematic diagram of floating object detection provided in the embodiments of this application;
[0025] Figure 6 This is another schematic diagram of floating object detection provided in the embodiments of this application;
[0026] Figure 7 This is a schematic diagram of a virtual scene display interface 700 provided in an embodiment of this application;
[0027] Figure 8 This is a flowchart of another method for detecting floating objects provided in an embodiment of this application;
[0028] Figure 9 This is a schematic diagram of a floating object detection provided in an embodiment of this application;
[0029] Figure 10 This is a flowchart of another floating object detection method provided in the embodiments of this application;
[0030] Figure 11 This is a block diagram of a floating object detection device provided in an embodiment of this application;
[0031] Figure 12 This is a structural block diagram of a computer device provided in an embodiment of this application. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0033] Before providing a detailed explanation of the embodiments of this application, the application scenarios of these embodiments will be described first.
[0034] Currently, more and more games are using open-world gameplay, resulting in increasingly larger virtual scenes and a corresponding exponential increase in the number of objects within them. During the continuous iteration of virtual scenes, adjustments to terrain or repositioning of objects are inevitable. These operations may cause some objects to have poor compatibility with colliders, leading to these objects appearing to float after the virtual scene is generated.
[0035] With virtual scenes becoming increasingly large, relying solely on manual observation and detection leads to problems such as long processing times, inconsistent results, lengthy troubleshooting processes, and high costs. To address these issues, this application provides a method for rapidly detecting floating objects, as detailed below. Figure 1 Example.
[0036] Figure 1 This is a flowchart illustrating a method for detecting floating objects according to an embodiment of this application. This method is applied in a computer device, which may be a terminal or a server, etc. See also... Figure 1 The method includes:
[0037] Step 101: Determine the maximum height of the target object in the vertical direction. The target object is the object to be detected in the virtual scene.
[0038] The target object is a virtual object, such as a vehicle or a box. For example, the virtual scene is a 3D virtual scene, and the target object is a 3D object within that scene.
[0039] The maximum height of a target object in the vertical direction refers to the height between its highest and lowest points in that direction. For example, if the virtual scene is a three-dimensional virtual scene located in a three-dimensional coordinate system: XYZ-O coordinate system, assuming the Y-axis represents the height direction, then the difference between the maximum and minimum coordinate values of the target object in the Y-axis direction can be taken as the maximum height of the target object.
[0040] As an example, the virtual scene can be a virtual scene edited through a scene editor. The scene editor of this virtual scene is configured with a floating detection plugin, which is used to detect floating objects in the virtual scene. In this embodiment, the floating detection plugin can be used to detect floating objects in the virtual scene according to the method provided in this embodiment.
[0041] The scene editor is a tool used to create virtual scenes and objects within those scenes, and can be a game editor, etc. For example, this scene editor could be a Unity Editor (unified editor) floating object detection plugin with the function of detecting floating objects according to the method provided in this application's embodiments. As an example, the function entry for this floating object detection plugin can be added to the scene editor's edit menu for users to find and call. The name of this function entry can be set as needed; for example, the name of this function entry could be "Floating Checking" option.
[0042] As an example, when a floating object detection command is detected based on the scene editor, a floating object detection plugin can be used to detect floating objects in the virtual scene according to the method provided in the embodiments of this application. For example, when a floating object detection command is detected based on the scene editor, the floating object detection plugin can be used to determine the maximum height of the target object in the vertical direction and then perform subsequent steps.
[0043] The floating detection command can be triggered through the function entry of the floating detection plugin, or through voice or gesture operations. For example, when developers are creating a virtual scene and want to detect floating objects in the virtual scene, they can first open the edit menu of the scene editor, and then click the FloatingChecking option in the edit menu to trigger the floating detection command. Once the computer device receives the floating detection command, it can use the floating detection plugin to sequentially detect the objects in the virtual scene according to the floating object detection method provided in this application embodiment.
[0044] Please refer to Figure 2 , Figure 2 This is a schematic diagram of a floating object detection provided in an embodiment of this application, such as... Figure 2 As shown, the height between the highest and lowest points of the object in the Y-axis direction can be determined, and the maximum height h1 can be obtained.
[0045] As an example, upon receiving a buoyancy detection command, the computer device can also display a buoyancy detection settings interface. This interface is used to set relevant parameters for buoyancy detection, including the buoyancy threshold, the display time of the buoyancy marker line, the display width of the buoyancy marker line, and whether the target object to be detected includes at least one of the following special objects: The special object can include the ground, a container, or a pile of objects. The container can be a shipping container, cargo container, waste bin, or garbage bin, etc.
[0046] As an example, the settings interface can also display a list of floating objects, which records the identifiers of floating objects detected from the virtual scene. Once a floating object is detected from the virtual scene, its identifier can be added to this list.
[0047] It should be noted that this settings interface can also be accessed through other preset operations. These preset operations can be actions that trigger settings options, voice operations, or gesture operations, etc., and this application embodiment does not limit the preset operations.
[0048] Please see Figure 3 , Figure 3 This is a schematic diagram of a settings interface 300 provided in an embodiment of this application, as shown below. Figure 3 As shown, this settings interface allows users to configure the floating threshold, the display time of the floating marker line, the display width of the floating marker line, whether the target object to be detected includes the ground, and whether the target object to be detected includes ground boxes. Furthermore, the settings interface displays a list of floating objects, which shows two floating objects detected from the virtual scene: Object 1 and Object 2.
[0049] Step 102: Determine the vertical distances between the M first vertices of the upper surface of the target object and the first collider, and obtain the first distance set. The first collider is the collider that is closest to the target object in the vertical downward direction, and M is an integer greater than or equal to 4.
[0050] The collider described in this application refers to a reference object in a virtual scene used to support other objects, which can be the ground, a box, a wall, or a pile of objects, etc. A pile of objects can be sandbags, etc.
[0051] It should be noted that M can be 4 or greater than 4, such as 5 or 6. Furthermore, a larger M results in higher accuracy in detecting floating objects, but also increases the computational load. Therefore, the value of M should be determined by balancing detection accuracy and computational load.
[0052] The M first vertices can be determined by a preset strategy. For example, the M first vertices can be M vertices randomly selected from all vertices on the upper surface; or, the M first vertices can be the M vertices that are sorted from the top to the bottom from all vertices on the upper surface; or, the M first vertices can be vertices determined based on the coordinates of the upper surface on the X and Z axes.
[0053] As an example, assuming M is 4, the vertices corresponding to the maximum and minimum coordinates of the upper surface on the X-axis, and the vertices corresponding to the maximum and minimum coordinates of the upper surface on the Z-axis, can be taken as the M first vertices. Here, the X-axis and Z-axis are coordinate axes perpendicular to the Z-axis, which is the coordinate axis used to indicate the height direction in a three-dimensional coordinate system.
[0054] In this process, the vertical distance between each of the M first vertices and the first collider can be determined, resulting in M first distances, which together form the first distance set.
[0055] Please refer to Figure 2 We can determine the four vertices of the upper surface of the object: A1, B1, C1 and D1, and then determine the distances between these four vertices and the ground to obtain four h values.
[0056] Additionally, when developers place objects, they may rotate the target object before placing it, causing the top surface of the target object to tilt. In order to more accurately determine the vertical distance between the M first vertices and the first collider in this case, the rotation angle of the target object relative to the vertical direction can be determined first to obtain the first rotation angle, and the distance between the M first vertices and the first collider can be determined. Then, based on the distance between the M first vertices and the first collider, and the first rotation angle, the vertical distance between the M first vertices and the first collider can be determined.
[0057] For example, the distances between the M first vertices and the first collider can be rotated in the opposite direction according to the first rotation angle to obtain the perpendicular distances between the M first vertices and the first collider. Alternatively, the distances between the M first vertices and the first collider can be multiplied by the sine or cosine of the first rotation angle to obtain the perpendicular distances between the M first vertices and the first collider.
[0058] It should be noted that the vertical distance between the first vertex and the first collider can be positive, 0, or negative. The vertical distance between the first vertex and the first collider refers to the distance between the first vertex and the first collider in the vertically downward direction. If the first vertex is above the upper surface of the first collider, the distance between the first vertex and the first collider is positive; if the first vertex is below the upper surface of the first collider, the distance between the first vertex and the first collider is negative.
[0059] The upper surface of the first collider can be located either below or above the target object. When the upper surface of the first collider is above the target object, it means that the target object is submerged in the first collider. In this case, the distances between the M first vertices and the first collider are all negative.
[0060] In the case where the target object is submerged in the first collider, the target object cannot be displayed normally. Therefore, in this embodiment, the object submerged in the first collider can also be detected as a floating object so that the developers can adjust the position of such an object.
[0061] As an example, after determining the vertical distances between the M first vertices of the target object's upper surface and the first collider, and obtaining the first distance set, it is possible to check whether all the first distances in the first distance set are negative. If all the first distances in the first distance set are negative, then the target object is determined to be a floating object. If not all the first distances in the first distance set are negative, i.e., there are 0 or positive values, then the step of judging whether the number of first distances in the first distance set that satisfy the first preset condition is greater than N is executed, and step 103 or 104 is executed according to the judgment result.
[0062] Please refer to Figure 4 , Figure 4 This is another schematic diagram of floating object detection provided in an embodiment of this application. For example... Figure 4 As shown, we can first determine the four vertices of the object: points A1, B1, C1, and D1, and then determine the vertical distance between these four vertices and the ground. Since the four vertices A1, B1, C1, and D1 of the object are all below the ground, the height h2 between these four vertices and the ground is negative. In this case, the object can be determined as a floating object.
[0063] Step 103: If the number of first distances in the first distance set that satisfy the first preset condition is less than or equal to N, then the target object is determined to be a non-floating object. The first preset condition is that the difference between the target object and the maximum height is greater than the floating threshold, and N is an integer greater than 3 and less than M.
[0064] Please refer to Figure 5 and Figure 6 , Figure 5 This is another schematic diagram of floating object detection provided in the embodiments of this application. Figure 6 This is another schematic diagram of floating object detection provided in the embodiments of this application, such as... Figure 5 and Figure 6 As shown, we can first determine the maximum height h1 of the object, and the vertical distances between the four vertices A1, B1, C1, and D1 of the object and the ground, thus obtaining four h2 values. Since some of these four h2 values are less than h1, that is, the number of the four h2 values whose difference from h1 is greater than the levitation threshold is no more than four, we can determine that the object is a non-levitation object.
[0065] Step 104: If the number of first distances in the first distance set that satisfy the first preset condition is greater than N, then the target object is determined to be a floating object.
[0066] The floating threshold can be preset, set by the system default, or customized by the developer. For example, the developer can set the floating threshold through the floating detection settings interface.
[0067] When it is determined that the number of first distances in the first distance set that satisfy the first preset condition is greater than N, it means that at least N+1 of the M first distances corresponding to the M first vertices are greater than the maximum height of the target object, which exceeds the floating threshold. In this case, the target object can be determined to be a floating object.
[0068] For example, assuming M is 4 and N is 3, please refer to... Figure 2 Since the differences between all four h2 and h1 are greater than the floating threshold, that is, the number of four h2 with differences greater than the floating threshold is 4, which is greater than 3, the object can be determined to be a floating object.
[0069] As an example, before determining whether a target object is a floating object, a whitelist of floating objects can be searched based on the target object. If the target object is not found in the whitelist, it is determined to be a floating object. Conversely, if the target object is found in the whitelist, it is determined to be a non-floating object.
[0070] This whitelist is used to store non-floating objects. For example, the whitelist can store at least one of the following non-floating objects: attached objects, suspended objects, and objects intended to float.
[0071] Among them, "external objects" refer to objects suspended horizontally, such as air conditioner outdoor units or murals. "Suspended objects" refer to objects suspended vertically upwards, such as ceiling lights. "Expected levitation objects" refer to objects that can maintain a levitation state within the displayed world rules, such as flying objects, balloons, or fountain water balloons.
[0072] In this embodiment, by determining the maximum height and a first distance set, and then judging whether the number of first distances satisfying a first preset condition in the first distance set is greater than N, it can be determined whether the target object is suspended downwards. However, when the target object is suspended downwards, it may also be a non-floating object, such as an externally attached object, a suspended object, or an expected floating object. In this embodiment, after determining that the target object is suspended downwards, further querying whether the target object is in the whitelist of floating objects can further filter out externally attached objects, suspended objects, or expected floating objects, thereby further improving the accuracy of floating object detection.
[0073] In another embodiment, after determining that the number of first distances satisfying the first preset condition in the first distance set is greater than N, the vertical distances between the M third vertices of the lower surface of the target object and the third collider can be determined first to obtain a third distance set. If the number of third distances satisfying the third preset condition in the third distance set is greater than N, then the step of determining that the target object is a floating object, or the step of querying the whitelist of floating objects based on the target object, is executed. If the number of third distances satisfying the third preset condition in the third distance set is less than or equal to N, then the target object is determined to be a non-floating object.
[0074] The third collider is the collider closest to the target object in the vertical upward direction. The M second vertices can be determined by a preset strategy. For example, the M second vertices can be M vertices randomly selected from all vertices on the lower surface; or, the M second vertices can be the M vertices on the lower surface ordered from lowest to highest; or, the M second vertices can be vertices determined based on the coordinates of the lower surface on the X and Z axes.
[0075] As an example, assuming M is 4, the vertices corresponding to the maximum and minimum coordinates of the lower surface on the X-axis, and the vertices corresponding to the maximum and minimum coordinates of the lower surface on the Z-axis, can be used as the M first vertices.
[0076] As an example, after determining that the target object is a floating object, its identifier can be added to a floating object list, which records the identifiers of floating objects detected in the virtual scene. Furthermore, when a trigger operation is detected on the target object identifier in the floating object list, the system can jump to the target object in the virtual scene to adjust its position.
[0077] As an example, after determining that the target object is a floating object, a floating marker line can be added to it. This marker line indicates that the target object is floating, making it clear to developers that the object is floating. The floating marker line can extend upwards or downwards from the floating object.
[0078] As an example, the floating marker line can be drawn on the target object using a specified function of the scene editor. For example, if the scene editor is Unity Editor, the specified function can be Debug.DrawLine(startPostionVector3,RayEnd,LineColor,DrawLineTime).
[0079] Please refer to Figure 7 , Figure 7This is a schematic diagram of a virtual scene display interface 700 provided in an embodiment of this application. As shown in the figure, if a virtual scene display interface 700 is detected... Figure 7 If the vehicle in the image is a floating object, then a floating marker line can be added to the floating object, which extends upward from the vehicle.
[0080] Additionally, after adding a floating marker line to the target object, if the display time of the floating marker line exceeds the preset display time, the floating marker line can be canceled.
[0081] In this embodiment, for a target object to be detected in a virtual scene, the maximum height of the target object in the vertical direction can be determined, as well as the vertical distances between the M vertices of the target object's upper surface and the first collider. If the number of first distances in the first distance set whose differences from the maximum height are greater than the floating threshold is greater than N, then the target object can be determined to be a floating object. That is, the above method can be used to automatically detect floating objects in a virtual scene with high accuracy, reducing the likelihood of missed or false detections, thereby improving detection efficiency and accuracy.
[0082] Figure 8 This is a flowchart of another method for detecting floating objects provided in an embodiment of this application. This method is applied in a computer device, which can be a terminal or a server, etc. See also... Figure 8 The method includes:
[0083] Step 801: Determine the maximum height of the target object in the vertical direction. The target object is the object to be detected in the virtual scene.
[0084] Step 802: Determine the vertical distances between the M first vertices of the upper surface of the target object and the first collider, and obtain the first distance set.
[0085] Step 803: If the number of first distances in the first distance set that satisfy the first preset condition is less than or equal to N, then the target object is determined to be a non-floating object.
[0086] It should be noted that the implementation process of steps 801-803 is the same as described above. Figure 1 Steps 101-103 in the embodiment are similar, and the specific implementation process can be described in the relevant description of steps 101-103 above. The embodiments of this application will not be repeated here.
[0087] Step 804: If the number of first distances in the first distance set that satisfy the first preset condition is greater than N, then determine the maximum width of the target object in the horizontal direction.
[0088] In this embodiment of the application, if the number of first distances in the first distance set that satisfy the first preset condition is greater than N, it can be determined that the target object is suspended in the air. After determining that the target object is suspended in the air, the maximum width of the target object in the horizontal direction can be further determined.
[0089] The maximum width of the target object in the horizontal direction refers to the distance between two boundary points of the target object in the horizontal direction. For example, it can be the difference between the maximum and minimum coordinate values of the target object on the X-axis, or the difference between the maximum and minimum coordinate values of the target object on the Z-axis, or the difference between the maximum and minimum coordinate values of the target object in the direction toward the second collider.
[0090] Step 805: Determine the horizontal distances between the M second vertices of the target object and the second colliders in the horizontal direction to obtain the second distance set. The second collider is the collider that is closest to the target object in the horizontal direction.
[0091] The M second vertices can be the M vertices of the side surface of the target object. This side surface can be the reference side surface of the target object, or the side surface facing the second collider.
[0092] Among them, the M second vertices can be determined according to a preset strategy. For example, the M second vertices can be M vertices randomly selected from all vertices on the side surface; or, the M first vertices can be the M vertices that are sorted from the top to the bottom from all vertices on the side surface; or, the M first vertices can be vertices determined according to the coordinates of the side surface on the X-axis and Z-axis.
[0093] Additionally, when developers place objects, they may rotate the target object before placing it, causing the target object to deflect in the horizontal direction. In order to more accurately determine the horizontal distance between the M second vertices and the second collider in this case, the distance between the M second vertices and the second collider can be determined, and the rotation angle of the target object relative to the horizontal direction can be determined to obtain the second rotation angle. Then, based on the distance between the M second vertices and the second collider, and the second rotation angle, the horizontal distance between the M second vertices and the second collider can be determined.
[0094] Step 806: If the number of second distances in the second distance set that satisfy the second preset condition is less than or equal to N, then the target object is determined to be a non-floating object. The second preset condition is that the difference between the target object and the maximum width is less than the floating threshold.
[0095] Step 807: If the number of second distances in the second distance set that satisfy the second preset condition is greater than N, then the target object is determined to be a floating object.
[0096] Please refer to Figure 9 , Figure 9 This is another schematic diagram of floating object detection provided in the embodiments of this application, such as... Figure 9 As shown, if the number of first distances in the first distance set that satisfy the first preset condition is greater than N, then the maximum width h1' of the object in the horizontal direction can be determined, and the horizontal distances between the four vertices A, D, A1 and D1 of the object and the left wall can be determined respectively, resulting in four h2's. Since some h2's are less than h1's, it can be determined that the number of the four h2's with a difference greater than h1's that is greater than the floating threshold is less than 4. At this time, it can be determined that the target object is suspended in the horizontal direction and the target object is a non-floating object.
[0097] In this embodiment, by determining the maximum height and a first distance set, and then determining whether the number of first distances satisfying a first preset condition in the first distance set is greater than N, it can be determined whether the target object is suspended downwards. When it is determined that the target object is suspended downwards, by further determining the maximum width and a second distance set, and determining whether the number of second distances satisfying a second preset condition in the second distance set is greater than N, it can be determined whether the target object remains suspended in the horizontal direction, that is, whether the target object is an externally attached object. If the target object is not an externally attached object, it is then determined that the target object is a floating object. In this way, suspended objects can be filtered out, false detections can be reduced, and the accuracy of floating object detection can be improved.
[0098] As an example, before determining whether a target object is a floating object, a whitelist of floating objects can be searched based on the target object. If the target object is not found in the whitelist, it is determined to be a floating object. Conversely, if the target object is found in the whitelist, it is determined to be a non-floating object.
[0099] This whitelist is used to store non-floating objects. For example, the whitelist can store at least one of the following non-floating objects: suspended objects and objects intended to float.
[0100] As an example, in step 804, before determining the maximum width of the target object in the horizontal direction, the vertical distances between the M third vertices of the target object's lower surface and the third collider can be determined first, resulting in a third distance set. If the number of third distances in the third distance set that satisfy the third preset condition is greater than N, then the step of determining the maximum width of the target object in the horizontal direction is executed. Alternatively, if the number of third distances in the third distance set that satisfy the third preset condition is less than or equal to N, the target object can be determined to be a non-floating object.
[0101] Please refer to Figure 10 , Figure 10This is a flowchart of another floating object detection method provided in the embodiments of this application, which can be followed... Figure 10 The illustrated process performs floating object detection in a virtual scene. For example... Figure 10 As shown, the method includes the following steps:
[0102] Step 1001: Identify the object to be detected from the virtual scene.
[0103] Step 1002: Determine if the object is active.
[0104] Step 1003: If the object is not activated, return to step 1001 to identify other objects to be detected in the virtual scene.
[0105] Step 1004: If the object is active, determine the four first vertices of the object.
[0106] Step 1005: Determine the vertical distances between the four first vertices and the first collider to obtain four h2 values.
[0107] Step 1006: Determine the maximum height h1 of the object.
[0108] Step 1007: Determine the number s of the four h2s whose distance from h1 is greater than the floating threshold.
[0109] Step 1008: Determine if s is greater than 3.
[0110] Step 1009: If s is not greater than 3, then the object is determined to be a non-floating object.
[0111] Step 1010: If s is greater than 3, then determine the number of times the distance between the object's four h2' and the object's maximum width h1' is greater than the floating threshold, where the four h2' refer to the distance between the object's four second vertices and the second collider.
[0112] Step 1011: Determine if t is greater than 3.
[0113] Step 1012: If t is greater than 3, then the object is determined to be a floating object.
[0114] Step 1013: Save the test results.
[0115] Step 1014: Continue detecting the next object in the virtual scene.
[0116] In this embodiment, for a target object to be detected in a virtual scene, the maximum height of the target object in the vertical direction and the vertical distances between the M vertices of the target object's upper surface and the first collider can be determined to obtain a first distance set. If the number of first distances in the first distance set whose difference from the maximum height is greater than the floating threshold is greater than N, the target object is determined to be floating downwards. Furthermore, the maximum width of the target object and a second distance set are determined. By judging whether the number of second distances in the second distance set that satisfy a second preset condition is greater than N, it is determined whether the target object remains suspended in the horizontal direction. If it does not remain suspended in the horizontal direction, the target object is determined to be a floating object. In this way, not only can floating object detection be automatically performed in the virtual scene, improving detection efficiency, but also missed detections and false detections can be reduced, improving detection accuracy.
[0117] Figure 11 This is a block diagram of a floating object detection device provided in an embodiment of this application, such as... Figure 11 As shown, the device includes a first determining module 1101, a second determining module 1102, and a third determining module 1103.
[0118] The first determining module 1101 is used to determine the maximum height of the target object in the vertical direction, wherein the target object is an object to be detected in the virtual scene;
[0119] The second determining module 1102 is used to determine the vertical distance between the M first vertices of the upper surface of the target object and the first collider, and to obtain a first distance set. The first collider is the collider that is closest to the target object in the vertical downward direction, and M is an integer greater than or equal to 4.
[0120] The third determining module 1103 is used to determine that the target object is a floating object if the number of first distances in the first distance set that satisfy the first preset condition is greater than N. The first preset condition is that the difference between the first distance and the maximum height is greater than the floating threshold, and N is an integer greater than 3 and less than M.
[0121] Optionally, the scene editor of the virtual scene is configured with a floating detection plugin, which is used to detect floating objects in the virtual scene;
[0122] The first determining module 1101 is used for:
[0123] When the scene editor receives a floating object detection command, it uses the floating detection plugin to determine the maximum vertical height of the target object.
[0124] Optionally, the device further includes:
[0125] The fourth determining module is used to determine the maximum width of the target object in the horizontal direction;
[0126] The fifth determining module is used to determine the horizontal distances between the M second vertices of the target object and the second colliders in the horizontal direction, and to obtain the second distance set. The second collider is the collider that is closest to the target object in the horizontal direction.
[0127] The first triggering module is used to trigger the third determining module 1103 to determine that the target object is a floating object if the number of second distances in the second distance set that meet the second preset condition is greater than N. The second preset condition is that the difference between the second distance and the maximum width is less than the floating threshold.
[0128] Optionally, the fifth determining module is used for:
[0129] Determine the distances between the M second vertices and the second collider;
[0130] Determine the rotation angle of the target object relative to the horizontal direction;
[0131] The horizontal distance between the M second vertices and the second collider is determined based on the distance between the M second vertices and the second collider, and the rotation angle.
[0132] Optionally, the device further includes:
[0133] The sixth determining module is used to determine the vertical distance between the M third vertices of the lower surface of the target object and the third collider, and to obtain the third distance set. The third collider is the collider that is closest to the target object in the vertical upward direction.
[0134] The seventh determining module is used to trigger the fourth determining module to determine the maximum width of the target object in the horizontal direction if the number of third distances in the third distance set that meet the third preset condition is greater than N. The third preset condition is that the difference between the width and the maximum height is greater than the floating threshold.
[0135] Optionally, the device further includes:
[0136] The query module is used to query the whitelist of floating objects based on the target object. This whitelist is used to store non-floating objects.
[0137] The second triggering module is used to trigger the third determining module 1103 to determine that the target object is a floating object if the target object is not found in the whitelist.
[0138] Optionally, the device further includes:
[0139] The marking module is used to add floating marker lines to the target object. The floating marker lines are used to indicate that the target object is a floating object, and the floating marker lines extend upward or downward from the floating object.
[0140] In this embodiment, for a target object to be detected in a virtual scene, the maximum height of the target object in the vertical direction can be determined, as well as the vertical distances between the M vertices of the target object's upper surface and the first collider. If the number of first distances in the first distance set whose differences from the maximum height are greater than the floating threshold is greater than N, then the target object can be determined to be a floating object. That is, the above method can be used to automatically detect floating objects in a virtual scene with high accuracy, reducing the likelihood of missed or false detections, thereby improving detection efficiency and accuracy.
[0141] It should be noted that the above-described embodiments of the floating object detection device are only illustrative examples of the functional modules described above. In practical applications, the functions described above can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the floating object detection device and the floating object detection method embodiments described above belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.
[0142] Figure 12 This is a structural block diagram of a computer device 1200 provided in an embodiment of this application. The computer device 1200 can be a mobile phone, tablet computer, smart TV, multimedia playback device, wearable device, desktop computer, server, or other computer equipment. The computer device 1200 can be used to implement the floating object detection method provided in the above embodiments.
[0143] Typically, computer device 1200 includes a processor 1201 and a memory 1202.
[0144] Processor 1201 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1201 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). Processor 1201 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1201 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 1201 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0145] The memory 1202 may include one or more computer-readable storage media, which may be non-transitory. The memory 1202 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1202 are used to store at least one instruction, which is executed by the processor 1201 to implement the floating object detection method provided in the method embodiments of this application.
[0146] In some embodiments, the computer device 1200 may also optionally include a peripheral device interface 1203 and at least one peripheral device. The processor 1201, memory 1202, and peripheral device interface 1203 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 1203 via a bus, signal line, or circuit board. Specifically, the peripheral device may include at least one of a display screen 1204, audio circuitry 1205, communication interface 1206, and power supply 1207.
[0147] Those skilled in the art will understand that Figure 12 The structure shown does not constitute a limitation on the computer device 1200 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0148] In an exemplary embodiment, a computer-readable storage medium is also provided, on which instructions are stored, which, when executed by a processor, implement the above-described floating object detection method.
[0149] In an exemplary embodiment, a computer program product is also provided, which, when executed, is used to implement the above-described floating object detection method.
[0150] It should be understood that "multiple" as used in this article refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0151] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0152] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method of detecting a floating object, characterized by, The method comprises: querying a whitelist of floating objects based on a target object, the whitelist being used to store non-floating objects, the non-floating objects including at least one of an externally hung object, a suspended object, and an expected floating object, the externally hung object being an object hung in a horizontal direction, the suspended object being an object hung in a vertical upward direction, and the expected floating object being an object capable of maintaining a floating state in a display world rule; if the target object is not found in the whitelist, determining a maximum height of the target object in a vertical direction, the target object being an object to be detected in a virtual scene, and the virtual scene being a scene edited by a Unity editor; determining distances between M first vertices of an upper surface of the target object and a first collision body, the first collision body being a collision body closest to the target object in a vertical downward direction, and the M being an integer greater than or equal to 4; wherein the M first vertices are at least one of M vertices randomly selected from all vertices of the upper surface, M vertices sorted in a high-to-low order from all vertices of the upper surface, and vertices determined according to coordinates of the upper surface in an X axis and a Z axis; determining a rotation angle of the target object relative to the vertical direction to obtain a first rotation angle; determining vertical distances between the M first vertices and the first collision body according to the distances between the M first vertices and the first collision body and the first rotation angle to obtain a first distance set; when it is detected that all first distances in the first distance set are negative values, determining that the target object is a floating object; when it is detected that the first distances in the first distance set are not all negative values, if a number of first distances in the first distance set satisfying a first preset condition is greater than N, determining a maximum width of the target object in a horizontal direction, the first preset condition being that a difference between the maximum height and the maximum width is greater than a floating threshold, the N being an integer greater than 3 and smaller than the M, and the floating threshold being obtained by self-defined setting; determining distances between M second vertices of a side surface of the target object and a second collision body, the second collision body being a collision body closest to the target object in the horizontal direction; determining a second rotation angle of the target object relative to the horizontal direction; determining horizontal distances between the M second vertices and the second collision body according to the distances between the M second vertices and the second collision body and the second rotation angle to obtain a second distance set; if a number of second distances in the second distance set satisfying a second preset condition is greater than N, determining that the target object is a floating object, the second preset condition being that a difference between the maximum width and the maximum height is smaller than the floating threshold; adding an identifier of the floating object to a floating object list, and displaying the floating object list.
2. The method of claim 1, wherein, The virtual scene is configured with a floating detection plug-in, and the floating detection plug-in is used to detect floating objects in the virtual scene. The determining the maximum height of the target object in the vertical direction comprises: When the floating object detection instruction is received based on the scene editor, the maximum height of the target object in the vertical direction is determined by the floating detection plug-in.
3. The method of claim 1, wherein, Before the determining the maximum width of the target object in the horizontal direction, the method further comprises: A vertical distance between M third vertices of a lower surface of the target object and third collision bodies is determined, to obtain a third distance set, the third collision bodies being collision bodies closest to the target object in the vertical upward direction; If a number of third distances in the third distance set satisfying a third preset condition is greater than N, the step of determining the maximum width of the target object on the side surface is executed, the third preset condition being that a difference between the maximum height and the third distance is greater than the floating threshold.
4. The method according to any of claims 1 to 3, characterized in that After the determining the target object as the floating object, the method further comprises: A floating marking line is added to the target object, the floating marking line being used to indicate that the target object is the floating object, and the floating marking line extending upward or downward from the floating object.
5. A device for detecting a floating object, characterized in that The device comprises: The query module is configured to query a white list of floating objects based on a target object, the white list being used to store non-floating objects, the non-floating objects comprising at least one of a hung object, a suspended object, and an expected floating object, the hung object being an object hung in a horizontal direction, the suspended object being an object suspended in a vertical upward direction, and the expected floating object being an object capable of keeping a floating state in a display world rule; The first determination module is configured to determine a maximum height of the target object in a vertical direction if the target object is not found in the white list, the target object being a three-dimensional object to be detected in a virtual scene, and the virtual scene being a scene edited by a Unity editor; The second determination module is configured to determine distances between M first vertices of an upper surface of the target object and first collision bodies, the first collision bodies being collision bodies closest to the target object in a vertical downward direction, and the M being an integer greater than or equal to 4; wherein the M first vertices are at least one of M vertices randomly selected from all vertices of the upper surface, M vertices sorted in a high-to-low order from all vertices of the upper surface, and vertices determined according to coordinates of the upper surface in an X axis and a Z axis; a rotation angle of the target object relative to the vertical direction is determined to obtain a first rotation angle; vertical distances between the M first vertices and the first collision bodies are determined according to the distances between the M first vertices and the first collision bodies and the first rotation angle, to obtain a first distance set; The third determination module is configured to determine the target object as a floating object when it is detected that all first distances in the first distance set are negative values. The fourth determining module is configured to, when it is detected that the first distance in the first distance set is negative, determine the maximum width of the target object in the horizontal direction if the number of first distances in the first distance set that meet a first preset condition is greater than N, the first preset condition being that the difference between the maximum height and the maximum width is greater than a floating threshold, N being an integer greater than 3 and less than M, and the floating threshold being obtained from a self-defined setting. The fifth determining module is configured to determine distances between M second top points on a side surface of the target object and a second collision body, the second collision body being a collision body closest to the target object in the horizontal direction; determine a second rotation angle of the target object relative to the horizontal direction; and determine horizontal distances between the M second top points and the second collision body according to the distances between the M second top points and the second collision body and the second rotation angle, to obtain a second distance set. The third determining module is further configured to, if the number of second distances in the second distance set that meet a second preset condition is greater than N, determine that the target object is a floating object, the second preset condition being that the difference between the maximum width and the maximum height is less than the floating threshold; add an identifier of the floating object to the floating object list; and display the floating object list.
6. A computer device, comprising: The computer device includes a processor and a memory, and the memory stores at least one instruction, at least one program, a code set, or an instruction set, which are loaded and executed by the processor to implement the floating object detection method according to any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, at least one program, a code set, or an instruction set, which are loaded and executed by the processor to implement the floating object detection method according to any one of claims 1-4.
8. A computer program product, characterised in that, The computer program product, when executed, is used to implement the floating object detection method according to any one of claims 1-4.
Citation Information
Patent Citations
Object detection method and related device
CN110160579A