Virtual object processing method, apparatus, device, and storage medium

By determining the relative coordinate axes of the virtual object and the target object in a virtual 3D scene and setting the adsorption conditions, the planar bonding of the virtual object and the target object is automatically achieved, solving the problem of high complexity in the existing technology and realizing a simplified and reliable bonding process.

CN114445604BActive Publication Date: 2026-01-16LENOVO (BEIJING) LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210118233.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-08
Publication Date
2026-01-16
Estimated Expiration
2042-02-08

AI Technical Summary

Technical Problem

When building a virtual 3D scene, adding virtual objects to the virtual space and making them accurately fit onto the plane of other objects is a complex process that requires users to adjust the position from multiple angles, resulting in high operational complexity.

Method used

By determining the relative positional relationship between the virtual object and the target object on each coordinate axis, setting the snapping conditions, and automatically snapping the virtual object along the coordinate axis when the conditions are met, so that it fits the plane of the target object.

Benefits of technology

It simplifies the operation of fitting virtual objects to other objects on a plane, achieves automated and reliable fitting, and reduces the steps required for user adjustments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114445604B_ABST
    Figure CN114445604B_ABST
Patent Text Reader

Abstract

The application discloses a virtual object processing method, device and equipment and a storage medium. The method comprises the following steps: determining at least one second virtual object which needs to be attached to a first virtual object in a virtual space scene; determining the relative position relationship of the first virtual object and the second virtual object on each coordinate axis in the virtual space scene; and if the relative position relationship of the first virtual object and the second virtual object on the coordinate axis meets a set adsorption condition, adsorbing the first virtual object to the second virtual object along the coordinate axis. The scheme can reduce the complexity of adjusting the planar attachment relationship of the virtual object and other virtual objects in the virtual space scene.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and more particularly, to a virtual object processing method and device, equipment and a storage medium. BACKGROUND

[0002] With the development of technology, virtual scene technologies such as virtual reality (VR) and augmented reality (AR) are increasingly widely used.

[0003] In the process of constructing a virtual three-dimensional scene such as VR and AR, it is often necessary to add a virtual object to the virtual three-dimensional scene. In many cases, the virtual object added to the virtual three-dimensional scene needs to be fitted to one or more planes of other objects in the virtual three-dimensional scene. In order to enable the virtual object to be accurately fitted to each plane, after adding the virtual object to the virtual three-dimensional scene, the user may need to view and adjust the position of the virtual object from multiple angles, which is complex. SUMMARY

[0004] The present application provides a virtual object processing method, device, equipment and a storage medium.

[0005] One of the virtual object processing methods comprises:

[0006] determining at least one second virtual object in a virtual space scene that needs to be fitted with a first virtual object;

[0007] For each coordinate axis in the virtual space scene, determining the relative position relationship of the first virtual object and the second virtual object on the coordinate axis;

[0008] If the relative position relationship of the first virtual object and the second virtual object on the coordinate axis meets the set adhesion condition, the first virtual object is adhered to the second virtual object along the coordinate axis.

[0009] In one possible implementation, the determination of the relative position relationship of the first virtual object and the second virtual object on the coordinate axis for each coordinate axis in the virtual space scene comprises:

[0010] determining that there is a position change of the first virtual object in the virtual space scene;

[0011] In response to the position change of the first virtual object, for each coordinate axis in the virtual space scene, the relative position relationship of the first virtual object and the second virtual object on the coordinate axis is determined.

[0012] In a further possible implementation, the determining the relative positional relationship of the first virtual object and the second virtual object on the coordinate axis comprises:

[0013] determining a shortest plane distance of the first virtual object and the second virtual object on the coordinate axis, the shortest plane distance being a distance between two planes of the first virtual object and the second virtual object that are perpendicular to the coordinate axis and closest to each other;

[0014] determining a projection relationship of the first virtual object and the second virtual object on a direction perpendicular to the coordinate axis.

[0015] In a further possible implementation, the adsorption condition comprises:

[0016] the shortest plane distance is less than a set distance, and the projection relationship represents that the first virtual object and the second virtual object have a projection overlap on the direction perpendicular to the coordinate axis.

[0017] In a further possible implementation, the adsorbing the first virtual object to the second virtual object on the coordinate axis comprises:

[0018] moving the first virtual object along the coordinate axis towards the second virtual object, so that the first virtual object and the two planes of the second virtual object closest to each other are attached to each other.

[0019] In a further possible implementation, before the determining the at least one second virtual object that needs to be attached to the first virtual object in the virtual space scene, the method further comprises:

[0020] determining the first virtual object that is added or moved in the virtual space scene.

[0021] According to a first aspect, a virtual object processing apparatus is provided, comprising:

[0022] an adsorption object determining unit configured to determine at least one second virtual object that needs to be attached to a first virtual object in a virtual space scene;

[0023] a positional relationship determining unit configured to determine, for each coordinate axis in the virtual space scene, a relative positional relationship of the first virtual object and the second virtual object on the coordinate axis;

[0024] an adsorption processing unit configured to adsorb the first virtual object to the second virtual object on the coordinate axis if the relative positional relationship of the first virtual object and the second virtual object on the coordinate axis meets a set adsorption condition.

[0025] In yet another possible implementation, the position relationship determining unit comprises:

[0026] a position change determining sub-unit, configured to determine whether there is a position change of the first virtual object in the virtual space scene;

[0027] a position relationship determining sub-unit, configured to, in response to the position change of the first virtual object, determine, for each coordinate axis in the virtual space scene, a relative position relationship between the first virtual object and the second virtual object on the coordinate axis.

[0028] In yet another aspect, the present application further provides a computer readable storage medium, wherein at least one instruction, at least one program, a code set or an instruction set is stored in the computer readable storage medium, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the virtual object processing method according to any one of the above.

[0029] In yet another aspect, the present application further provides an electronic device, comprising at least a memory and a processor;

[0030] The processor is configured to execute the virtual object processing method according to any one of the embodiments of the present application.

[0031] The memory is configured to store programs required by the processor for execution.

[0032] According to the above scheme, after determining at least one second virtual object that needs to be attached to the first virtual object in the virtual space scene, the present application determines, for each coordinate axis in the virtual space scene, a relative position relationship between the first virtual object and the second virtual object on the coordinate axis. On this basis, for each coordinate axis in the virtual space scene, only when the relative position relationship between the first virtual object and the second virtual object on the coordinate axis satisfies the adsorption condition, the first virtual object can be automatically adsorbed to the second virtual object along the coordinate axis, so that the user does not need to check and adjust the position relationship between the virtual object to be processed and other virtual objects on each axis, and the reliable adsorption of the virtual object to be processed and other virtual objects on each axis can also be effectively guaranteed, thereby reducing the complexity of adjusting the planar attachment relationship between the virtual object and other virtual objects in the virtual space scene. BRIEF DESCRIPTION OF DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.

[0034] Figure 1 A flowchart illustrating a virtual object processing method provided in an embodiment of this application;

[0035] Figure 2 This is another flowchart illustrating the virtual object processing method provided in an embodiment of this application.

[0036] Figure 3 This is a schematic diagram of a virtual space scenario to which the embodiments of this application are applicable;

[0037] Figure 4 In order to be in Figure 3 A schematic diagram showing the shortest planar distance between virtual object C and virtual object A on the Y-axis in a virtual space scene;

[0038] Figure 5 In order to be in Figure 3 A schematic diagram showing the projection relationship between virtual object C and virtual object A on the XZ coordinate plane in the virtual space scene shown;

[0039] Figure 6 A flowchart illustrating the virtual object processing method provided in this application embodiment in an application scenario;

[0040] Figure 7 A schematic diagram of the composition structure of a virtual object processing device provided in an embodiment of this application;

[0041] Figure 8 This is a schematic diagram of the component architecture of an electronic device provided in an embodiment of this application.

[0042] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings are used to distinguish similar parts and are not necessarily used to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that illustrated herein. Detailed Implementation

[0043] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0044] like Figure 1 The diagram illustrates a flowchart of a virtual object processing method provided in an embodiment of this application. The method of this embodiment may include:

[0045] S101, determine at least one second virtual object that needs to be fitted with the first virtual object in the virtual space scene.

[0046] The virtual space scene is a constructed virtual space scene, which can be a three-dimensional virtual space scene or a multi-dimensional virtual space scene, etc.

[0047] For example, in actual application, the virtual space scene can be a virtual space scene in a virtual reality (VR) or augmented reality (AR) scene.

[0048] It can be understood that during the process of constructing or adjusting the virtual space scene, virtual objects can be added to the virtual space scene or virtual objects in the virtual space scene can be adjusted as needed. Accordingly, there can be one or more virtual objects in the virtual space scene, and the virtual objects can be virtual objects such as virtual objects, virtual animals, and virtual characters in the virtual space scene, etc., without limitation.

[0049] In this application, in order to facilitate distinction, the virtual object that needs to be adjusted in the virtual space scene is referred to as the first virtual object.

[0050] It can be understood that according to different actual needs, the position of the first virtual object in the virtual space scene can be set. In this application, the main concern is that in the case where the first virtual object needs to be fitted with other virtual objects, the first virtual object can be reliably fitted with the plane of other virtual objects without abnormal situations such as floating or spatial overlap. Accordingly, the virtual object that needs to be fitted with the first virtual object in the virtual space scene is referred to as the second virtual object.

[0051] The second virtual object can be a virtual object selected by a user. For example, before or after adding the first virtual object to the virtual space scene, or when the position of the first virtual object in the virtual space scene needs to be adjusted, at least one second virtual object that needs to be fitted with the first virtual object is selected from the virtual space scene.

[0052] The second virtual object can also be at least one second virtual object that can be fitted with the first virtual object according to the current spatial position of the first virtual object in the virtual space scene. For example, a virtual object with a distance less than a set distance from the spatial position of the first virtual object is determined as the second virtual object.

[0053] S102, for each coordinate axis in the virtual space scene, determine the relative position relationship of the first virtual object and the second virtual object on the coordinate axis.

[0054] In the present application, each coordinate axis is a coordinate axis direction, representing a reference direction in the virtual space scene.

[0055] The number of coordinate axes of the virtual space scene varies according to different virtual space scenes. For example, a three-dimensional virtual space scene has three mutually perpendicular coordinate axes.

[0056] It can be understood that the first virtual object can have multiple planes, and in actual applications, the first virtual object can have one or more planes that need to be fitted with the planes of other different virtual objects. On this basis, in order to ensure that each plane of the first virtual object that needs to be fitted can be reliably fitted onto the corresponding plane of the other virtual object, the position relationship between the first virtual object and each second virtual object in the direction of each coordinate axis needs to be analyzed, so as to subsequently determine whether the first virtual object is suitable for being fitted with the second virtual object in the direction of the coordinate axis.

[0057] In the present application, the relative position relationship between the first virtual object and the second virtual object in the coordinate axis refers to the relative position relationship between the first virtual object and the second virtual object from the standard direction of the coordinate axis.

[0058] For example, the relative position relationship can include one or more of the following position relationships: the relative distance between the first virtual object and the second virtual object in the coordinate axis, and the projection relationship between the first virtual object and the second virtual object in the plane perpendicular to the coordinate axis, without limitation.

[0059] S103, if the relative position relationship between the first virtual object and the second virtual object in the coordinate axis meets the set adsorption condition, adsorbing the first virtual object to the second virtual object along the coordinate axis.

[0060] The adsorption condition is a condition indicating that the first virtual object and the second virtual object are suitable for being adsorbed to each other along the coordinate axis, so that the two planes of the first virtual object and the second virtual object that are perpendicular to the coordinate axis and adjacent to each other are fitted with each other.

[0061] The adsorption condition can be set as needed.

[0062] For each coordinate axis, adsorbing the first virtual object to the second virtual object along the coordinate axis can make the two planes of the first virtual object and the second virtual object that are perpendicular to the coordinate axis and opposite to each other be fitted with each other, thereby avoiding abnormal conditions such as gaps or overlaps between the two planes.

[0063] In one possible implementation, snapping the first virtual object onto the second virtual object along the coordinate axis can be achieved by: adjusting the relative position of the center point of the first virtual object relative to the coordinate axis, based on the relative position of the center point of the second virtual object relative to the coordinate axis, so that the center points of the first and second virtual objects are on a straight line parallel to the coordinate axis. Then, snapping the first virtual object onto the second virtual object along the coordinate axis direction, so that after the first and second virtual objects are snapped together, the first virtual object is located at the center of the plane in the second virtual object where it is snapped together, achieving an automatic centering and snapping effect.

[0064] As can be seen from the above, after determining at least one second virtual object in the virtual space scene that needs to be attached to the first virtual object, this application determines the relative positional relationship between the first virtual object and the second virtual object on each coordinate axis of the virtual space scene. Based on this, for each coordinate axis in the virtual space scene, only when the relative positional relationship between the first virtual object and the second virtual object on that axis satisfies the snapping condition can the first virtual object be automatically snapped to the second virtual object along that axis. This eliminates the need for the user to individually view and adjust the positional relationship between the virtual object to be processed and other virtual objects on each axis, effectively ensuring reliable snapping of the virtual object to be processed with other virtual objects on each axis, and reducing the complexity of adjusting the planar snapping relationship between virtual objects in the virtual space scene and other virtual objects.

[0065] To facilitate understanding of the scheme of this application, the following explanation will take the relative positional relationship between the first virtual object and the second virtual object and a possible case of adsorption conditions as an example.

[0066] like Figure 2 As shown, it illustrates another flowchart of the virtual object processing method provided in this application embodiment. The method of this embodiment may include:

[0067] S201, determine at least one second virtual object in the virtual space scene that needs to be aligned with the first virtual object.

[0068] This step can be referred to in the relevant description of the previous embodiments, and will not be repeated here.

[0069] S202, for each coordinate axis, determine the shortest planar distance between the first virtual object and the second virtual object on that coordinate axis.

[0070] For each coordinate axis, the shortest plane distance is the distance between the first virtual object and the two closest planes of the second virtual object that are perpendicular to the coordinate axis.

[0071] It can be understood that for each virtual object in the virtual space scene, there can be two planes perpendicular to one coordinate axis. In this case, if two virtual objects can be attached to each other along one coordinate axis, then only the opposite two planes perpendicular to the coordinate axis from the two virtual objects can be attached, and the two planes are the two closest planes perpendicular to the coordinate axis in the two virtual objects.

[0072] For ease of understanding, an example is described. As shown in Figure 3 , a schematic diagram of a virtual space scene to which the scheme of the present application is applicable is shown.

[0073] In Figure 3 , the virtual space scene is a three-dimensional virtual space, and correspondingly, the three-dimensional virtual space has three mutually perpendicular coordinate axes, which are respectively Figure 3 the X-axis, Y-axis and Z-axis shown in .

[0074] In the virtual space scene, virtual object A, virtual object B and virtual object C are included.

[0075] Suppose virtual object C is a first virtual object to be adjusted in position, and virtual object A is a second virtual object to which virtual object C needs to be attached.

[0076] Taking the Y-axis as an example, it can be seen from Figure 3 that the planes perpendicular to the Y-axis in virtual object A are the upper surface and the lower surface of virtual object A, and correspondingly, the planes perpendicular to the Y-axis in virtual object C are also the upper surface and the lower surface of virtual object C. However, in the virtual space scene shown in Figure 3 , if virtual object C and virtual object A are attached along the Y-axis, only the lower surface of virtual object C and the upper surface of virtual object A can be attached.

[0077] On this basis, for the Y-axis, the present application needs to obtain the relative distance between the lower surface of virtual object C and the upper surface of virtual object A on the Y-axis. Correspondingly, the shortest plane distance between virtual object C and virtual object A is the distance between the lower surface of virtual object C and the upper surface of virtual object A.

[0078] It can be understood that for each coordinate axis, the shortest plane distance between the first virtual object and the second virtual object on the coordinate axis can be calculated by combining various mathematical algorithms, etc., and the specific method is not limited.

[0079] For example, still taking the scene of Figure 3 as an example. The shortest plane distance L of virtual object C and virtual object A on the Y-axis can be seen from Figure 4 .

[0080] By Figure 4 It can be seen that the calculation formula of the shortest plane distance L can refer to the following formula:

[0081] L = C.y - A.y - (C.size.y + A.size.y) / 2;

[0082] Wherein, C.y is the coordinate position of the center point of the virtual object C on the Y axis, A.y is the coordinate position of the center point of the virtual object A on the Y axis.

[0083] C.size.y is the height of the virtual object C on the Y axis, and A.size.y is the height of the virtual object A on the Y axis.

[0084] By Figure 4 It can be seen that the shortest plane distance L can be calculated by the above formula. Of course, Figure 4 And the above calculation method is only an example, and other calculations of the shortest plane distance L are also applicable.

[0085] S203, for each coordinate axis and each second virtual object, determine the projection relationship between the first virtual object and the second virtual object perpendicular to the coordinate axis.

[0086] The projection relationship represents the relative position relationship between the first virtual object and the plane perpendicular to the coordinate axis in the second virtual object from the direction of the coordinate axis.

[0087] In this application, the projection relationship can reflect whether the first virtual object can coincide with the second virtual object along the coordinate axis. On this basis, the projection relationship can at least reflect whether there is overlap between the first virtual object and the plane perpendicular to the coordinate axis in the second virtual object from the direction of the coordinate axis. That is, whether there is overlap between the projections of the first virtual object and the second virtual object perpendicular to the coordinate axis.

[0088] For example, the projection relationship can be the relationship between the first projection of the first virtual object on the set plane perpendicular to the coordinate axis and the second projection of the second virtual object on the set plane. Wherein, the set plane is the plane composed of two coordinate axes perpendicular to the coordinate axis. Correspondingly, the projection relationship can at least represent whether the first projection and the second projection overlap. Of course, the relationship between the first projection and the second projection can also include one or more of the following information: the area size or area ratio of the overlapping area between the first projection and the second projection, etc.

[0089] For example, still taking Figure 3The virtual space scene shown is used as an example to illustrate that, for the Y axis, the projection relationship between the virtual object C and the virtual object A in a plane perpendicular to the Y axis can be determined as follows: the projection relationship between the virtual object C and the virtual object A in an XZ plane in which the X axis and the Z axis are located and which is perpendicular to the Y axis can be determined as shown in Figure 5

[0090] Figure 5 As can be seen, the projections of the virtual object C and the virtual object A in the XZ plane partially overlap.

[0091] S204, for each coordinate axis, if the shortest plane distance between the first virtual object and the second virtual object on the coordinate axis is less than the set distance, and the projection relationship represents that the projections of the first virtual object and the second virtual object in a plane perpendicular to the coordinate axis exist overlap, the first virtual object is attracted to the second virtual object along the coordinate axis.

[0092] It can be understood that if a user wants to fit a certain plane of a first virtual object to a plane of a second virtual object, the user will necessarily move the plane of the first virtual object to a position close to the corresponding plane of the second virtual object, and will control the projection of the plane of the first virtual object on the corresponding plane of the second virtual object to exist overlap with the corresponding plane of the second virtual object.

[0093] Based on this, in the embodiments of the present application, for each coordinate axis, if it is determined that the shortest plane distance between the first virtual object and a second virtual object on the coordinate axis is less than the set distance, and the projections of the first virtual object and the second virtual object in a plane perpendicular to the coordinate axis exist overlap, it is determined that the condition of attracting the first virtual object to the second virtual object along the coordinate axis is met.

[0094] Of course, in actual applications, in addition to the shortest plane distance being less than the set distance and the projections of the first virtual object and the second virtual object in the plane perpendicular to the coordinate axis existing overlap, the attracting condition can also include that the area of the overlap of the projections of the first virtual object and the second virtual object in the plane perpendicular to the coordinate axis is greater than a set value, and the like, without limitation.

[0095] Wherein, the attracting refers to seamlessly fitting one virtual object to a plane of another virtual object.

[0096] In the embodiments of the present application, attracting the first virtual object to the second virtual object along the coordinate axis will necessarily cause one side of the first virtual object facing the second virtual object to be fitted to the second virtual object, so that two planes of the first virtual object and the second virtual object facing each other and perpendicular to the coordinate axis are relatively fitted.

[0097] ​​In a possible implementation, the first virtual object can be moved along the coordinate axis towards the second virtual object, so that the first virtual object and the two planes in the second virtual object that are closest to the coordinate axis are attached to each other.

[0098] Still in combination with Figure 3 It is explained that, in Figure 3 the virtual object C and the virtual object A satisfy the adsorption condition on the Y coordinate axis, the virtual object C can be moved downwards along the Y coordinate axis, so that Figure 3 the lower surface of the virtual object C and the upper surface of the virtual object A are adsorbed together, so that the upper surface of the virtual object C and the upper surface of the virtual object A are attached, thereby avoiding the existence of a gap between the two planes on the Y coordinate axis or the abnormal situation of object overlap between the two virtual objects on the Y coordinate axis.

[0099] It can be understood that, in addition to moving the first virtual object along the coordinate axis towards the second virtual object and finally adsorbing the first virtual object onto the second virtual object, the attachment area or region of the two planes in the first virtual object and the second virtual object that are attached to each other can also be adjusted as needed, so that the two planes in the first virtual object and the second virtual object that are attached to each other can be more stably attached.

[0100] For example, while moving the first virtual object along the coordinate axis towards the second virtual object, so that the first virtual object and the two planes in the second virtual object that are closest to the coordinate axis are attached to each other, the first virtual object can also be moved relative to the coordinate axis, so that the center point of the first virtual object in the coordinate plane perpendicular to the coordinate axis coincides with the center point of the corresponding plane in the second virtual object on the coordinate plane.

[0101] Of course, in actual applications, the specific way of adsorbing the first virtual object to the second virtual object for a certain coordinate axis can also have other possibilities, which are not limited.

[0102] It can be understood that, in Figure 2 the embodiment, the adsorption condition is that the shortest plane distance between the first virtual object and the second virtual object on the coordinate axis is less than a set distance, and the projection relationship represents that the projection of the first virtual object and the second virtual object perpendicular to the coordinate axis exists overlap is taken as an example.

[0103] In practical applications, the adsorption condition set according to the shortest plane distance and the projection relationship between the first virtual object and the second virtual object can also have other possibilities, such as the adsorption condition can be set as the shortest plane distance being less than a set distance, and the projection relationship representing that the overlapping area of the projections of the first virtual object and the second virtual object on a coordinate axis exceeds a set threshold, and the like. The present application does not limit this.

[0104] It can be understood that, in the present application, in order to be able to timely detect the case that the relative position relationship between the first virtual object and the second virtual object on a certain coordinate axis satisfies the adsorption condition, so as to timely and reliably adsorb the first virtual object and the second virtual object, the present application can, after determining that the first virtual object has a position change in the virtual space scene, determine, in response to the position change of the first virtual object, the relative position relationship between the first virtual object and the second virtual object on each coordinate axis in the virtual space scene.

[0105] Among them, the first virtual object having a position change in the virtual space scene can include two cases. One is that the first virtual object has a position change from non-existence to existence in the virtual space scene due to the addition of the first virtual object to the virtual space scene. The other is that the first virtual object has a position change after the position of the first virtual object is adjusted after the first virtual object is added to the virtual space scene.

[0106] Correspondingly, before determining the second virtual object to which the first virtual object needs to be attached, it can also be necessary to determine the first virtual object added to the virtual space scene or the first virtual object moved in the virtual space scene.

[0107] It can be understood that the scheme of the present application is applicable to application scenarios such as constructing a virtual space scene and adjusting the position of a virtual object in a virtual space scene to be attached to a plane on which another virtual object is located. In order to facilitate understanding of the scheme of the present application, an application scenario will be described below.

[0108] A three-dimensional virtual space scene is taken as an example for description.

[0109] As shown in FIG. 1, Figure 6 the method provided by the embodiment of the present application can include:

[0110] S601, determining a first virtual object added or moved in a three-dimensional virtual space scene.

[0111] For example, the three-dimensional virtual space scene is a VR scene, for example, the three-dimensional virtual space scene is a VR scene constructed for displaying goods or exhibits, and the like.

[0112] For example, in a VR scene for displaying products, it can be required to place a virtual computer on a virtual exhibition stand in the VR scene, and on this basis, it is required to add a three-dimensional image of the virtual computer to the VR scene, and adjust the position of the virtual computer in the VR scene as required, so as to make the virtual computer have the possibility of being attached to the upper surface of the virtual exhibition stand.

[0113] S602, determining at least one second virtual object in the three-dimensional virtual space scene that needs to be attached to the first virtual object.

[0114] The manner of determining the second virtual object in this step can refer to the related description of the foregoing embodiments, and can be set as required.

[0115] For example, in a possible implementation manner, one or more virtual objects that need to be attached to the first virtual object can be set after the first virtual object is added to the three-dimensional virtual space scene. On this basis, the at least one second virtual object that needs to be attached to the first virtual object can be the at least one second virtual object set.

[0116] For example, in a three-dimensional VR space, it is required to place a virtual computer on the horizontal plane of an exhibition stand, and then the exhibition stand is the second virtual object that needs to be attached to the virtual computer. For another example, it is required to place a virtual picture frame in a VR space on an exhibition stand and paste it on a virtual wall, and then the virtual wall and the exhibition stand are the second virtual objects that need to be attached to the virtual picture frame.

[0117] S603, detecting that the first virtual object has a position change in the three-dimensional virtual space scene, and respectively determining, for each coordinate axis in the three-dimensional virtual space scene, a shortest plane distance between the first virtual object and each second virtual object on the coordinate axis, and a projection relationship between the first virtual object and each second virtual object on a coordinate plane perpendicular to the coordinate axis.

[0118] For each coordinate axis and each second virtual object, the shortest plane distance is the distance between two planes that are perpendicular to the coordinate axis and closest to each other in the first virtual object and the second virtual object.

[0119] It can be understood that the three-dimensional virtual space scene includes three mutually perpendicular coordinate axes, for example, which can be X coordinate axis, Y coordinate axis and Z coordinate axis in sequence. Then, after the first virtual object has a position change, the relative position relationship between the first virtual object and each second virtual object on each coordinate axis can be respectively determined from the three coordinate axes.

[0120] For each coordinate axis, the coordinate plane perpendicular to the coordinate axis is the plane formed by the other two coordinate axes outside the coordinate axis. For example, assuming the coordinate axis is the X coordinate axis, then the coordinate plane perpendicular to the coordinate axis is the plane formed by the Y coordinate axis and the Z coordinate axis.

[0121] S604, for each coordinate axis, if the shortest plane distance of the first virtual object and the second virtual object on the coordinate axis is less than a set distance, and the projection relationship represents that the projections of the first virtual object and the second virtual object on the coordinate plane perpendicular to the coordinate axis exist overlap, the first virtual object is moved along the coordinate axis towards the second virtual object, so that the two planes closest to each other of the first virtual object and the second virtual object are mutually attached.

[0122] For example:

[0123] Assuming in the VR space, a virtual computer needs to be placed on the upper surface of an exhibition stand and a side surface of the virtual computer needs to be attached to a vertical side panel of the exhibition stand extending along the Y axis.

[0124] In this case, it is necessary to see from the Y coordinate axis whether the lower surface of the virtual computer and the upper surface of the exhibition stand meet the adsorption condition, and in the case of meeting the adsorption condition, the lower surface of the virtual computer is adsorbed to the upper surface of the exhibition stand.

[0125] At the same time, from the X coordinate axis (or the Z coordinate axis), it is detected whether the positional relationship between the virtual computer and the exhibition stand meets the adsorption condition. For the X coordinate axis, if the shortest plane distance of the virtual computer and the exhibition stand on the X coordinate axis is less than a set threshold, and the virtual computer and the exhibition stand exist projection overlap on the coordinate plane perpendicular to the X coordinate axis, it is indicated that the side surface of the virtual computer and the vertical side panel of the exhibition stand can be adsorbed, and then the virtual computer is moved along the X coordinate axis towards the vertical side panel of the exhibition stand, so that the side surface of the virtual computer and the vertical side panel of the exhibition stand can be reliably attached.

[0126] Corresponding to the virtual object processing method provided by the embodiment of the application, the application further provides a virtual object processing device.

[0127] As shown in Figure 7 , which shows a component structure schematic diagram of the virtual object processing device provided by the embodiment of the application. The device of the embodiment can include:

[0128] The adsorption object determination unit 701 is configured to determine at least one second virtual object which needs to be attached to the first virtual object in the virtual space scene;

[0129] The positional relationship determination unit 702 is configured to determine, for each coordinate axis in the virtual space scene, the relative positional relationship of the first virtual object and the second virtual object on the coordinate axis.

[0130] The adsorption processing unit 703 is configured to adsorb the first virtual object to the second virtual object along the coordinate axis if the relative positional relationship between the first virtual object and the second virtual object on the coordinate axis meets the set adsorption condition.

[0131] In a possible implementation, the positional relationship determining unit comprises:

[0132] The position change determining sub-unit is configured to determine whether there is a position change of the first virtual object in the virtual space scene.

[0133] The positional relationship determining sub-unit is configured to, in response to the position change of the first virtual object, determine, for each coordinate axis in the virtual space scene, the relative positional relationship between the first virtual object and the second virtual object on the coordinate axis.

[0134] In another possible implementation, the positional relationship determining unit comprises:

[0135] The plane distance determining unit is configured to, for each coordinate axis in the virtual space scene, determine a shortest plane distance between the first virtual object and the second virtual object on the coordinate axis, the shortest plane distance being a distance between two planes, which are closest to each other, of the first virtual object and the second virtual object and which are perpendicular to the coordinate axis.

[0136] The projection relationship determining unit is configured to determine a projection relationship between the first virtual object and the second virtual object on a direction perpendicular to the coordinate axis.

[0137] In a possible implementation, the adsorption condition in the adsorption processing unit comprises:

[0138] The shortest plane distance is smaller than a set distance, and the projection relationship indicates that the first virtual object and the second virtual object have a projection overlap on the direction perpendicular to the coordinate axis.

[0139] In another possible implementation, the adsorption processing unit is specifically configured to, if the relative positional relationship between the first virtual object and the second virtual object on the coordinate axis meets the set adsorption condition, move the first virtual object along the coordinate axis towards the second virtual object, so that the two planes, which are closest to each other, of the first virtual object and the second virtual object are attached to each other.

[0140] In another possible implementation, the device further comprises:

[0141] The target object determining unit is configured to determine the first virtual object to be added or moved in the virtual space scene before the adsorption object determining unit determines at least one second virtual object that needs to be attached to the first virtual object in the virtual space scene.

[0142] In yet another aspect, the present application provides an electronic device, such as Figure 8 As shown in FIG. 8, which shows a schematic diagram of a component structure of the electronic device, the electronic device can be any type of electronic device, and the electronic device at least includes a memory 801 and a processor 802.

[0143] The processor 801 is configured to execute the virtual object processing method in any one of the above embodiments.

[0144] The memory 802 is configured to store programs required by the processor to execute operations.

[0145] It can be understood that the electronic device can further include a display unit 803 and an input unit 804.

[0146] Of course, the electronic device can also have more or less components, and there is no limitation in this regard. Figure 8

[0147] In another aspect, the present application also provides a computer readable storage medium, wherein at least one instruction, at least one program, a code set or an instruction set is stored in the computer readable storage medium, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the virtual object processing method in any one of the above embodiments.

[0148] The present application also proposes a computer program, which includes computer instructions stored in a computer readable storage medium. The computer program is used to execute the virtual object processing method in any one of the above embodiments when the computer program runs on the electronic device.

[0149] It should be noted that each embodiment in the present specification adopts a progressive manner for description, and each embodiment focuses on the difference from other embodiments. The same and similar parts of each embodiment can be referred to each other. Meanwhile, the features recorded in each embodiment in the present specification can be replaced or combined, so that the person skilled in the art can realize or use the present application. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiment.

[0150] ​Finally, it should be noted that, in this document, the term "only" is used simply to set off from one element to another, not to necessarily require or imply any such actual relationship or order between the elements. Also, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0151] The above description of disclosed embodiments provides enabling teaching for making or using the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein can be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for processing virtual objects, comprising: determining at least one second virtual object that needs to be attached to a first virtual object in a virtual space scene; determining, for each coordinate axis in the virtual space scene, a relative position relationship between the first virtual object and the second virtual object on the coordinate axis; if the relative position relationship between the first virtual object and the second virtual object on the coordinate axis meets a set adhesion condition, adhering the first virtual object to the second virtual object along the coordinate axis; wherein the determining the relative position relationship between the first virtual object and the second virtual object on the coordinate axis comprises: determining a shortest plane distance between the first virtual object and the second virtual object on the coordinate axis, the shortest plane distance being a distance between two planes in the first virtual object and the second virtual object that are perpendicular to the coordinate axis and closest to each other; and determining a projection relationship between the first virtual object and the second virtual object on a plane perpendicular to the coordinate axis; and wherein the adhesion condition comprises that the shortest plane distance is less than a set distance and the projection relationship indicates that the first virtual object and the second virtual object have a projection overlap on the plane perpendicular to the coordinate axis. 2.The method of claim 1, wherein the determining, for each coordinate axis in the virtual space scene, the relative position relationship between the first virtual object and the second virtual object on the coordinate axis comprises: determining that the first virtual object has a position change in the virtual space scene; and in response to the position change of the first virtual object, determining, for each coordinate axis in the virtual space scene, the relative position relationship between the first virtual object and the second virtual object on the coordinate axis. 3.The method of claim 1, wherein the adhering the first virtual object to the second virtual object along the coordinate axis comprises: moving the first virtual object along the coordinate axis towards the second virtual object, so that the two planes in the first virtual object and the second virtual object that are closest to each other are attached to each other. 4.The method of claim 1 or 2, further comprising, before the determining the at least one second virtual object that needs to be attached to the first virtual object in the virtual space scene: determining the first virtual object that is added or moved in the virtual space scene. 5.An apparatus for processing virtual objects, comprising: an adhesion object determining unit configured to determine at least one second virtual object that needs to be attached to a first virtual object in a virtual space scene; a position relationship determining unit configured to determine, for each coordinate axis in the virtual space scene, a relative position relationship between the first virtual object and the second virtual object on the coordinate axis; and an adhesion processing unit configured to adhere the first virtual object to the second virtual object along the coordinate axis if the relative position relationship between the first virtual object and the second virtual object on the coordinate axis meets a set adhesion condition. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ The position relationship determining unit determines the relative position relationship of the first virtual object and the second virtual object on the coordinate axis, including: determining the shortest plane distance of the first virtual object and the second virtual object on the coordinate axis, the shortest plane distance being the distance between two planes in the first virtual object and the second virtual object which are perpendicular to the coordinate axis and closest to each other; determining the projection relationship of the first virtual object and the second virtual object on the coordinate axis which is perpendicular to the coordinate axis; The adsorption condition includes: the shortest plane distance is less than a set distance, and the projection relationship represents that the projection of the first virtual object and the second virtual object on the coordinate axis which is perpendicular to the coordinate axis exists overlap.

6. The apparatus according to claim 5, the position relationship determining unit comprising: a position change determining sub-unit, configured to determine whether the first virtual object has a position change in the virtual space scene; a position relationship determining sub-unit, configured to, in response to the position change of the first virtual object, determine, for each coordinate axis in the virtual space scene, the relative position relationship of the first virtual object and the second virtual object on the coordinate axis.

7. A computer readable storage medium, the computer readable storage medium storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by a processor to implement the virtual object processing method according to any one of claims 1 to 4.

8. An electronic device, comprising at least a memory and a processor; wherein the processor is configured to execute the virtual object processing method according to any one of claims 1 to 4; the memory is configured to store programs required by the processor for operation.

Citation Information

Patent Citations

  • Automatic placement of a virtual object in a three-dimensional space

    US20180045963A1