Virtual item placement method and apparatus
By listening to the intersection events between virtual objects and the placement surface in three-dimensional space, the placement posture of virtual objects is calculated and adjusted, solving the visual and physical fatigue problems caused by manual adjustment by users. This achieves automatic and accurate placement of virtual items, improving user experience and integration efficiency.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-05-23
- Publication Date
- 2026-04-02
AI Technical Summary
In existing technologies, users need to manually adjust the fit between virtual objects and surfaces placed in three-dimensional space, which leads to visual and physical fatigue and affects user experience and satisfaction.
By listening to the intersection events between the virtual object and the surface placed in three-dimensional space, the placement posture of the virtual object is calculated, and its position is automatically adjusted to achieve a close fit.
It enables automatic and precise placement of virtual items, simplifies the operation process, and improves placement efficiency and the integration efficiency of virtual objects with the real environment.
Smart Images

Figure CN2025096851_02042026_PF_FP_ABST
Abstract
Description
A virtual item placement method and device
[0001] Cross-reference to Related Applications
[0002] This application claims priority to Chinese Patent Application No. 202411354634.7, filed September 26, 2024, the entire contents of which are incorporated herein by reference. TECHNICAL FIELD
[0003] The present disclosure relates to the field of computer technology, and in particular, to a virtual item placement method and device. BACKGROUND
[0004] With the development of dynamic video, moving pictures, 3D and AR technology, providing immersive experience to users has gradually become the development direction of various service industries. For example, online transaction platforms or building design systems, the object of interest is fused with the real environment as a virtual object to enable users to obtain a simulated real experience in advance. When the object is fused with the real environment as a virtual object, the user needs to manually adjust the fit degree of the virtual object and the placement surface in the real three-dimensional environment, such as placing the coffee machine on the table, placing the air conditioner on the wall, etc., to achieve a better simulation placement effect.
[0005] In the process of implementing the present disclosure, it is found that the prior art has the following problems:
[0006] The existing method of manually adjusting the fit degree of the virtual object and the placement surface in the three-dimensional space can basically meet the fusion needs of the object and the real environment. However, since the fit placement of the virtual object and the placement surface in the three-dimensional space is a fine operation, the user needs to repeatedly fit and place several times to achieve a good display effect, which brings visual and physical fatigue to the user and affects the user's experience, and accordingly, the satisfaction of the object in the user's mind is also affected. SUMMARY
[0007] Therefore, the embodiments of the present disclosure provide a virtual item placement method and device. According to the intersection event between the virtual object corresponding to the virtual item and each placement surface in the three-dimensional space, the placement posture of the virtual object in the three-dimensional space is calculated, so as to move the virtual object according to the placement posture to achieve the purpose of fit placement, and an automatic and accurate virtual item placement is realized. The position of the virtual object that needs to be fit placed is accurately calculated according to the movement operation of the virtual object, which not only meets the need of fit placement, but also simplifies the placement process, eliminates manual adjustment, improves the placement efficiency of the virtual item, and accordingly, the fusion efficiency of the virtual object and the real three-dimensional environment is also improved.
[0008] To achieve the object, according to an aspect of the present disclosure, a virtual object placing method is provided, comprising:
[0009] acquiring a three-dimensional space, and loading a virtual object corresponding to the virtual object in the three-dimensional space;
[0010] listening to a moving operation of the virtual object, and identifying a placing surface of the virtual object in the three-dimensional space; and determining a placing posture of the virtual object in the three-dimensional space in response to an intersection event of the virtual object and one or more target placing surfaces in the placing surface.
[0011] determining a placing position of the virtual object according to the placing posture, so that one or more surfaces of the virtual object are attached to the one or more target placing surfaces.
[0012] Optionally, identifying the placing surface of the virtual object in the three-dimensional space comprises: identifying a position and a size of the placing surface of the virtual object in the three-dimensional space, and listening to a collision action or an approaching action of the placing surface.
[0013] Optionally, after the virtual object corresponding to the virtual object is loaded in the three-dimensional space, the method further comprises: determining a bounding volume of the virtual object according to a shape and a size of the virtual object, and determining that the intersection event occurs when the bounding volume collides with or approaches the one or more target placing surfaces.
[0014] Optionally, in response to the intersection event of the virtual object and the one or more target placing surfaces in the placing surface, determining the placing posture of the virtual object in the three-dimensional space comprises: determining an intersection mode corresponding to the intersection event according to the intersection event of the virtual object and the one or more target placing surfaces in the placing surface; and calculating the placing posture of the virtual object in the three-dimensional space according to the intersection mode.
[0015] Optionally, the intersection mode comprises: a single-surface intersection mode in which the virtual object intersects with one target placing surface in the placing surface, a double-surface intersection mode in which the virtual object intersects with two target placing surfaces in the placing surface, and a three-surface intersection mode in which the virtual object intersects with three target placing surfaces in the placing surface; and calculating the placing posture of the virtual object in the three-dimensional space according to the intersection mode comprises: determining a placing mode of the virtual object in response to the intersection mode being one of the single-surface intersection mode, the double-surface intersection mode, and the three-surface intersection mode; and determining the placing posture of the virtual object according to the placing mode and a surface normal of the target placing surface.
[0016] Optionally, determining the placing posture of the virtual object according to the placing mode and the surface normal of the target placing surface comprises: determining a projection coordinate of a center coordinate of the virtual object in the three-dimensional space based on the placing mode, and calculating the placing posture of the virtual object in the three-dimensional space in combination with the surface normal of the target placing surface.
[0017] Optionally, the placement mode corresponding to the single-sided intersection mode is a surface-adhesion placement mode; in response to the intersection mode being the single-sided intersection mode, based on the placement mode, the projection coordinates of the center coordinates of the virtual object in the three-dimensional space are determined, and in combination with the surface normal of the target placement surface, the placement posture of the virtual object in the three-dimensional space is calculated, including: judging whether the target placement surface is parallel or perpendicular to a preset standard surface; in response to the target placement surface being parallel to the standard surface, the projection coordinates of the center coordinates of the virtual object on the target placement surface are determined; according to the surface normal of the target placement surface, the projection coordinates are adjusted in height, and the surface-adhesion placement position of the virtual object is calculated; in response to the target placement surface being perpendicular to the standard surface, the projection coordinates of the center coordinates of the virtual object on the target placement surface are determined; according to the surface normal of the target placement surface, the projection coordinates are adjusted in depth, and the surface-adhesion placement position of the virtual object is calculated; and according to the surface normal of the target placement surface, the rotation orientation matrix of the virtual object when placed in surface adhesion in the three-dimensional space is calculated.
[0018] Optionally, the placement mode corresponding to the double-sided intersection mode is a edge-adhesion placement mode; in response to the intersection mode being the double-sided intersection mode, based on the placement mode, the projection coordinates of the center coordinates of the virtual object in the three-dimensional space are determined, and in combination with the surface normal of the target placement surface, the placement posture of the virtual object in the three-dimensional space is calculated, including: judging whether the two target placement surfaces are respectively parallel, perpendicular to a preset standard surface, or both perpendicular to the standard surface; in response to the two target placement surfaces being respectively parallel, perpendicular to the standard surface, the projection coordinates of the center coordinates of the virtual object on the intersection line of the two target placement surfaces are determined; according to the surface normal of the two target placement surfaces, the projection coordinates are adjusted in height and depth, and the edge-adhesion placement position of the virtual object is calculated, and according to the surface normal of the target placement surface perpendicular to the standard surface, the rotation orientation matrix of the virtual object when placed in edge adhesion in the three-dimensional space is calculated; in response to the two target placement surfaces being both perpendicular to the standard surface, the projection coordinates of the center coordinates of the virtual object on the intersection line of the two target placement surfaces are determined; according to the surface normal of the two target placement surfaces, the projection coordinates are adjusted in depth and width, and the edge-adhesion placement position of the virtual object is calculated; and according to the surface normal of the target placement surface perpendicular to the standard surface, the rotation orientation matrix of the virtual object when placed in edge adhesion in the three-dimensional space is calculated.
[0019] Optionally, the placement mode corresponding to the three-face intersection mode is a corner-pasting placement mode; in response to the intersection mode being the three-face intersection mode, the projection coordinates of the center coordinates of the virtual object in the three-dimensional space are determined based on the placement mode, and a placement posture of the virtual object in the three-dimensional space is calculated in combination with the surface normal of the target placement surface, including: determining the projection coordinates of the center coordinates of the virtual object on the corner point formed by the three target placement surfaces; performing width, height and depth adjustment on the projection coordinates according to the surface normal of the three target placement surfaces, to calculate a corner-pasting placement position of the virtual object, and calculating a rotation orientation matrix of the virtual object when the virtual object is corner-pasted in the three-dimensional space according to the surface normal of the target placement surface.
[0020] Optionally, the bounding volume of the virtual object is determined according to the shape and size of the virtual object, including: performing simplification processing on the shape of the virtual object to obtain the shape of the bounding volume of the virtual object; and performing magnification on the size of the virtual object according to the shape of the bounding volume and a preset magnification coefficient, to obtain the bounding volume of the virtual object.
[0021] Optionally, after the placement position of the virtual object is determined according to the placement posture, the method further includes: adding a placement attribute to the virtual object, and each surface in the virtual object listens for a collision action or a close action, and when the collision action or the close action is listened to, the surface of the virtual object is taken as a target placement surface.
[0022] Optionally, the method further includes: pre-moving the virtual object according to the placement posture to display a placement mode of the virtual object; and in response to receiving an instruction to place the virtual object according to the placement posture, determining the placement position of the virtual object.
[0023] According to a second aspect of the embodiments of the present disclosure, a virtual object placement device is provided, including:
[0024] A virtual object loading module is configured to obtain a three-dimensional space and load a virtual object corresponding to a virtual object in the three-dimensional space.
[0025] A placement posture determination module is configured to listen to a movement operation on the virtual object and identify a placement surface in the three-dimensional space; and in response to an intersection event between the virtual object and one or more target placement surfaces in the placement surface, determine a placement posture of the virtual object in the three-dimensional space.
[0026] A virtual object placement module is configured to determine a placement position of the virtual object according to the placement posture, so that one or more surfaces of the virtual object are pasted with the one or more target placement surfaces.
[0027] According to a third aspect of the embodiments of the present disclosure, a virtual object placement electronic device is provided, including:
[0028] one or more processors;
[0029] a storage device storing one or more programs,
[0030] when the one or more programs are executed by one or more processors, the one or more processors implement the method according to the first aspect of the embodiments of the present disclosure.
[0031] According to a fourth aspect of the embodiments of the present disclosure, a computer readable medium is provided, and the computer readable medium stores a computer program. The program is executed by a processor to implement the method according to the first aspect of the embodiments of the present disclosure.
[0032] According to a fifth aspect of the embodiments of the present disclosure, a computer program product is provided, and the computer program product includes a computer program. The computer program is executed by a processor to implement the method according to the first aspect of the embodiments of the present disclosure.
[0033] One embodiment in the present disclosure has the following advantages or beneficial effects: by acquiring a three-dimensional space, loading a virtual object corresponding to a virtual item in the three-dimensional space, listening to a movement operation on the virtual object, and identifying a placement surface of an object in the three-dimensional space, in response to an intersection event between the virtual object and one or more target placement surfaces in the placement surface, determining a placement pose of the virtual object in the three-dimensional space, and determining a placement position of the virtual object according to the placement pose, so that one or more surfaces of the virtual object are fitted with the one or more target placement surfaces, the technical solution realizes an automatic and accurate item placement method. The position where the virtual object needs to be fitted and placed is accurately calculated according to the movement operation on the virtual object, which not only meets the need of fitting and placing, but also simplifies the placement process, eliminates manual adjustment, improves the placement efficiency of the virtual item, and accordingly improves the fusion efficiency of the virtual object and the real three-dimensional environment. BRIEF DESCRIPTION OF DRAWINGS
[0034] The accompanying drawings are used to better understand the present disclosure and do not constitute an improper limitation on the present disclosure. Among them:
[0035] FIG. 1 is a schematic diagram of the main flow of a virtual item placement method according to an embodiment of the present disclosure;
[0036] FIG. 2 is a schematic diagram of a virtual object pre-moving according to a placement pose according to an embodiment of the present disclosure;
[0037] FIG. 3 is a flowchart of a virtual item placement method according to one referable embodiment of the present disclosure;
[0038] FIG. 4 is a flowchart of a placement pose calculation method according to an embodiment of the present disclosure;
[0039] FIG. 5 is a schematic diagram of a virtual object and each placement surface in a three-dimensional space generating an intersection event according to an embodiment of the present disclosure;
[0040] FIG. 6 is a schematic diagram of a virtual object being placed in a three-dimensional space according to a calculated placement posture according to an embodiment of the present disclosure;
[0041] FIG. 7 is a schematic diagram of the overall flow of a virtual object placement method according to an embodiment of the present disclosure;
[0042] FIG. 8 is a schematic diagram of the main modules of a virtual object placement device according to an embodiment of the present disclosure;
[0043] FIG. 9 is an exemplary system architecture diagram to which embodiments of the present disclosure can be applied;
[0044] FIG. 10 is a schematic diagram of the structure of a computer system of a terminal device or server suitable for use in implementing embodiments of the present disclosure. DETAILED DESCRIPTION
[0045] It should be noted that in the technical solutions of the present disclosure, the acquisition, storage, and application of user personal information involved comply with relevant laws and regulations and do not violate public order and good customs.
[0046] Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, which include various details of the embodiments of the present disclosure to aid in understanding, and should be considered as merely exemplary. Thus, those of ordinary skill in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0047] Although the existing method of manually adjusting the degree of fit of a virtual object to a placement surface in a three-dimensional space can basically meet the needs of the fusion of an object and a real environment, since the fit placement of a virtual object to a placement surface in a three-dimensional space is a fine operation, the user needs to repeatedly fit place several times to achieve good results, which brings visual and physical fatigue to the user and affects the user's experience, and accordingly, the satisfaction of the object in the user's mind is also affected.
[0048] To solve the above problems in the prior art, the present disclosure proposes a virtual object placement method, which determines a placement posture of a virtual object in a three-dimensional space according to an intersection event between a virtual object corresponding to a virtual object and each placement surface in a three-dimensional space, so as to determine a placement position of the virtual object according to the placement posture to achieve the purpose of fit placement, thereby realizing an automatic and accurate virtual object placement method. According to the movement operation of the virtual object, the position of the virtual object that needs to be fit placed is accurately calculated, which not only meets the needs of fit placement, but also simplifies the placement process, eliminates manual adjustment, improves the placement efficiency of the virtual object, and accordingly, the fusion efficiency of the virtual object and the real three-dimensional environment is also improved.
[0049] FIG. 1 is a schematic diagram of the main flow of a virtual object placement method according to an embodiment of the present disclosure. As shown in FIG. 1, the virtual object placement method according to the embodiment of the present disclosure includes the following steps S101-S103.
[0050] In step S101, a three-dimensional space is obtained, and a virtual object corresponding to a virtual object is loaded in the three-dimensional space.
[0051] Specifically, when a user browses a transaction object on an online transaction platform, for some objects with a fusion use attribute with a real three-dimensional space, such as home appliances, furniture, home decoration products, etc., the user can send an object simulation placement request to the background object placement system or start an object simulation placement task through a specified button in the browsing window to simulate the effect of placing the transaction object in the real three-dimensional space. Specifically, it can be the size adaptation effect of the object and the three-dimensional space, or it can be the collocation effect of the object and the three-dimensional space layout. When starting the object simulation placement task in the background, the size, color, layout, etc. of the three-dimensional space are imported into the system. Of course, it can also be more convenient to construct the three-dimensional space required by the user in the object placement system by importing a picture of the three-dimensional space. It can also directly take a picture of the three-dimensional space where the object is to be placed online and upload it to the object placement system.
[0052] Further, based on the above-mentioned three-dimensional space simulating a real placement environment, the virtual object selected by the user is modeled, or the online transaction platform has completed the modeling of all objects on the platform in advance, and the modeled virtual object is loaded into the above-mentioned three-dimensional space. It can be understood that the virtual object of the embodiment of the present disclosure has the same appearance and the same scale size as the virtual object, so as to completely simulate the placement and display of the virtual object in the three-dimensional space.
[0053] In step S102, a movement operation on the virtual object is listened to, and a placement surface of the object in the three-dimensional space is identified; in response to an intersection event between the virtual object and one or more target placement surfaces in the placement surface, a placement pose of the virtual object in the three-dimensional space is determined.
[0054] Specifically, after the to-be-placed object is loaded into the three-dimensional space, the display angle of the three-dimensional space is adjusted, the attributes of each object in the three-dimensional space are analyzed by using the recognition tool, for example, ground, wall, ceiling, desktop, screen surface, box surface, etc., whether the object allows the object to be placed is determined according to the attributes, and when it is determined that the object allows the object to be placed, the placement surface of the object is determined. It should be noted that the object in the three-dimensional space mentioned in the embodiment of the present disclosure can be a real object, that is, an object initially contained in the three-dimensional space, for example, the ground, wall, ceiling, desktop mentioned in the above examples, or a virtual object, that is, a placement surface provided by a virtual object after the virtual object is placed in the three-dimensional space, for example, a screen surface after a screen is placed in the three-dimensional space, a box surface after a box is placed in the three-dimensional space, etc. The embodiment of the present disclosure does not make specific limitations as long as an individual in the three-dimensional space has a surface.
[0055] In addition, the placement surface of the embodiment of the present disclosure can be any plane or curved surface, as long as there is a part of space on the placement surface that can place an object, for example, a part of flat or concave space on a spherical placement surface. Of course, the user can also manually select the placement surface of the real object from the three-dimensional space.
[0056] After the user enters the simulation placement page, the user has the right to manually move the virtual object corresponding to the object. At the same time, the object placement system also listens to the movement operation of the virtual object by the user. If it is detected that the virtual object intersects with one or more placement surfaces in the three-dimensional space recognized above, the placement surface that occurs intersection is taken as a target placement surface. The target placement surface is a manifestation of the user's placement intention. According to the determined target placement surface, the user's intended position intention for placing the object can be predicted, and then according to the position intention, for example, the object needs to be placed on the ground or hung on the ceiling, combined with the current angle of the virtual object, the size of the target placement surface, the size of the virtual object, and the category of the virtual object, etc., the placement position and the rotation orientation angle of the virtual object fitting one or more target placement surfaces in the three-dimensional space are comprehensively determined.
[0057] For example, based on the user's placement intention of hanging the virtual object on the ceiling, the category of the virtual object is a lamp, then according to the size of the ceiling, the layout of the three-dimensional space, and the size of the virtual object, the specific placement position of the virtual object fitting the ceiling is calculated, and then according to the current angle of the lamp, the angle of the lamp in the three-dimensional space is adjusted synchronously, the placement angle, the placement position and the rotation orientation angle are calculated, and the placement posture of the lamp virtual object in the three-dimensional space is composed.
[0058] It can be understood that when the intersection event between the virtual object and the target placement surface is monitored, the authenticity or rationality of the monitored intersection event can also be verified first, and it is determined whether the item category of the virtual object conflicts with the placement attribute corresponding to the target placement surface, for example, the intersection event between the virtual object of the floor fan category and the target placement surface of the wall, or the intersection event between the virtual object of the television category and the target placement surface of the ceiling. These conflicts. If a conflict occurs between the item category and the placement attribute corresponding to the target placement surface, it is equivalent to a failed verification, and the monitored intersection event is ignored. Only when the verification is passed, the intersection event is considered to occur.
[0059] In step S103, the placement position of the virtual object is determined according to the placement posture, so that one or more surfaces of the virtual object are attached to the one or more target placement surfaces.
[0060] Specifically, based on the placement posture of the virtual object calculated above, the placement position of the virtual object in the three-dimensional space is obtained, and the virtual object is attached to the target placement surface in the three-dimensional space. It can be understood that the attachment of the embodiments of the present disclosure can be a conventional virtual object with one surface attached to one target placement surface, a virtual object with multiple surfaces attached to multiple target placement surfaces, or a non-conventional virtual object with one surface attached to multiple target placement surfaces, such as a cylindrical garbage can suspended and fixed at the corner of two intersecting walls. It can also be very unconventional that multiple surfaces of a virtual object are attached to one target placement surface, such as a multi-surface basin placed on a concave target placement surface in the middle of a washstand.
[0061] According to one embodiment of the present disclosure, the method further comprises: pre-moving the virtual object according to the placement posture to display the placement mode of the virtual item; and determining the placement position of the virtual object in response to receiving an instruction to place the virtual item according to the placement posture.
[0062] Specifically, to ensure the placement position is the intended position of the user to the greatest extent, the disclosure embodiment further provides a human-computer interaction interface. Before the item placement system calculates the placement posture and prepares to move the virtual object according to the placement posture, a copy of the current view is established, the virtual object is first moved on the copy according to the placement posture, the placement manner of the virtual object is obtained, and the placement manner is fed back to the user. The placement manner of the disclosure embodiment can be the illustration of the virtual object after moving on the copy, which is fed back to the user in the form of a display diagram for preview. If the user is not satisfied with the placement manner, the user can perform a moving operation on the virtual object again to send an instruction to the item placement system to recalculate the placement posture. The item placement system recalculates according to the newly monitored intersection event. If the user is satisfied with the placement manner, the user sends a placement instruction to place the virtual object according to the placement posture. After receiving the instruction, the item placement system determines the placement position of the virtual object and moves the virtual object in the formal three-dimensional space illustration according to the placement posture to achieve the purpose of automatic fitting placement.
[0063] FIG. 2 is a schematic diagram of a virtual object pre-moving according to a placement posture according to an embodiment of the disclosure. Before the item placement system calculates the placement posture and prepares to move the virtual object according to the placement posture, a copy of the current three-dimensional space view is established, and the virtual object is moved on the copy according to the placement posture, as shown in the figure, the gray cuboid virtual object is moved to the blue position, pre-moving on the three-dimensional space copy is achieved, and the diagram after moving on the copy is fed back to the user as the placement manner of the virtual object for preview.
[0064] FIG. 3 is a flowchart of a virtual object placement method according to one reference embodiment of the disclosure. As another embodiment of the disclosure, as shown in FIG. 3, the virtual object placement method can include:
[0065] Step S301, a three-dimensional space is obtained, and a virtual object corresponding to a virtual object is loaded in the three-dimensional space.
[0066] Step S302, a moving operation on the virtual object is monitored, and the position and size of a placement surface of an object in the three-dimensional space are identified, the placement surface monitors a collision action or a close action.
[0067] Specifically, for the placement surface of each object in the three-dimensional space on which other objects can be placed, in order to improve the efficiency of subsequent intersection event listening, simplify the specific code logic, after identifying the placement surface of the object in the three-dimensional space, a corresponding collider is generated for the placement surface according to the position and size of the placement surface. Each placement surface is a collider, which not only has the ability to listen to the collision with other objects, but also has the ability to listen to the proximity degree when other objects move to the placement surface, and determines that the proximity action occurs when the proximity degree is less than the preset proximity threshold, for example, the proximity distance between the other object and the placement surface is 0.5 cm, which is less than the preset proximity threshold of 1 cm, so the placement surface listens to the proximity action.
[0068] In step S303, a bounding volume of the virtual object is determined according to the shape and size of the virtual object, and an intersection event occurs when the bounding volume collides with or approaches one or more target placement surfaces in the placement surface.
[0069] Specifically, based on the colliders constructed for each placement surface, a trigger that can trigger the colliders is established on the periphery of the virtual object. Specifically, a bounding volume that is consistent with the shape of the virtual object and is appropriately enlarged in size, for example, enlarged by 0.1 times, is established on the outside of the virtual object, and the bounding volume is assigned the attribute of the trigger. The bounding volume is encapsulated on the outside of the virtual object, and in general, the center of the bounding volume and the center of the virtual object are coincident. In this way, the colliders only need to focus on listening to the action of the trigger, thereby relieving the resource consumption of listening.
[0070] According to one embodiment of the present disclosure, the bounding volume of the virtual object is determined according to the shape and size of the virtual object, including: performing a simplification process on the shape of the virtual object to obtain the shape of the bounding volume of the virtual object; and according to the shape of the bounding volume, enlarging the size of the virtual object according to a preset enlargement coefficient to obtain the bounding volume of the virtual object.
[0071] Specifically, in order to facilitate subsequent listening to the moving operation of the virtual object, simplify the internal judgment logic of the program, the embodiment of the present disclosure uses a cuboid as a general simplified bounding volume shape. As long as the shape of the virtual object is a long strip, the shape of the bounding volume defined by the simplified processing is a cuboid. Of course, if the shape of the virtual object is a sphere, the simplified bounding volume shape is a sphere. The shape of the simplified bounding volume is still determined according to the shape of the virtual object. The embodiment of the present disclosure adopts the simplified bounding volume shape with simple structure, which not only simplifies the code, but also reduces the performance overhead of the system. Finally, according to the shape of the bounding volume, the dimensions of the virtual object are enlarged according to the preset magnification factor, and the bounding volume that can cover the virtual object and has a simple structure is obtained. For example, for the bounding volume with a shape of a cuboid, the virtual object is enlarged according to the magnification factor of 0.2 times set along the x, y and z axes, respectively, to obtain the bounding volume of the virtual object.
[0072] Step S304, in response to the intersection event occurring when the bounding volume collides with one or more target placement surfaces in the placement surface, determining the placement pose of the virtual object in the three-dimensional space.
[0073] Specifically, the user moves the virtual object in the three-dimensional space, such as moving, rotating, scaling, etc. The colliders of each placement surface listen to whether the bounding volume trigger in the three-dimensional space collides or approaches, and trigger the intersection event of the bounding volume and the target placement surface when the collision or approach is listened to. According to the specific intersection event, the placement pose of the virtual object in the three-dimensional space is determined.
[0074] The embodiment of the present disclosure is based on the colliders with the ability to listen to the collision action or the approach action constructed by the placement surface, and the bounding volume trigger that triggers the colliders, which simplifies the implementation logic of the code, and the structure of the simplified bounding volume based on the shape of the virtual object further reduces the resource overhead of the system, and promotes the specific landing implementation of the fitting placement scheme of the virtual object in the three-dimensional space.
[0075] Step S305, determining the placement position of the virtual object according to the placement pose, so that one or more surfaces of the virtual object are fitted with the one or more target placement surfaces.
[0076] According to another embodiment of the present disclosure, after moving the virtual object according to the placement pose, the method further comprises: adding a placement attribute to the virtual object, and each surface of the virtual object listens to the collision action or the fitting action, and when the collision action or the approach action is listened to, the surface of the virtual object is taken as a target placement surface.
[0077] Specifically, considering that the virtual object has been integrated with the three-dimensional space after being moved according to the placement posture, it should become an object in the three-dimensional space, that is, the surface of the virtual object is also allowed to serve as a placement surface for other objects to be placed subsequently. After moving the virtual object according to the placement posture, a placement attribute is added to the virtual object, and each surface in the virtual object is endowed with the ability to listen to a collision action or a close action, so as to achieve the purpose of converting the virtual object into an object in the three-dimensional space. In this way, multiple virtual objects are placed in the three-dimensional space in a stacking manner, and the adaptability of the placement method is improved. For example, after a virtual object of a table is placed on a ground placement surface, the table is converted into an object in the three-dimensional space, and then a virtual object of a vase is placed on the placement surface of the table.
[0078] The embodiment of the present disclosure also provides a specific method for calculating a placement posture of a virtual object in a three-dimensional space. FIG. 4 is a flowchart of a method for calculating a placement posture according to an embodiment of the present disclosure. As another embodiment of the present disclosure, as shown in FIG. 4, the method for calculating a placement posture can include:
[0079] In step S401, an intersection mode corresponding to an intersection event between the virtual object and one or more target placement surfaces in the placement surface is determined according to the intersection event.
[0080] Specifically, when the virtual object intersects with the placement surface in the three-dimensional space, the object placement system collects the collision action of the collider and the bounding volume trigger to obtain one or more target placement surfaces in the three-dimensional space where the virtual object collides. Then, the intersection mode corresponding to the intersection event is determined according to the number of target placement surfaces. Generally, the number of target placement surfaces is one face, two faces, three faces or more. Understandably, the virtual object intersects with different numbers of target placement surfaces, which represents different placement intentions of the user. According to the number of target placement surfaces, the corresponding intersection mode is determined, and the placement intention of the user is predicted.
[0081] According to one embodiment of the present disclosure, the intersection mode includes a single-face intersection mode in which the virtual object intersects with one target placement surface in the placement surface, a double-face intersection mode in which the virtual object intersects with two target placement surfaces in the placement surface, and a three-face intersection mode in which the virtual object intersects with three target placement surfaces in the placement surface.
[0082] Specifically, according to the actual virtual object placement situation and the positional relationship between the placement surfaces in the three-dimensional space, when the virtual object intersects with more than three target placement surfaces, the embodiment of the present disclosure considers that it is unreasonable, which is caused by reasons such as insufficient space, placement surface recognition overlap, and ignores the intersection event of more than three target placement surfaces. Correspondingly, for the remaining intersection with one target placement surface, intersection with two target placement surfaces, and intersection with three target placement surfaces, there are three intersection modes. Respectively, the single-face intersection mode (also known as the intersection point mode) of the virtual object intersecting with one target placement surface in each placement surface, the double-face intersection mode (also known as the intersection line mode) of the virtual object intersecting with two target placement surfaces in each placement surface, and the three-face intersection mode (also known as the corner point mode) of the virtual object intersecting with three target placement surfaces in each placement surface.
[0083] Exemplarily, FIG. 5 is a schematic diagram of a virtual object intersecting with each placement surface in a three-dimensional space according to an embodiment of the present disclosure. The figure shows six different intersection events corresponding to virtual objects. The placement surfaces of the three-dimensional space include one ground, two walls, and one ceiling. The color highlighted frame represents the virtual object, and the gray frame outside represents the constructed bounding volume. As can be seen from the figure, virtual objects 1, 3, 4, and 5 are single-face intersection modes or also known as intersection point modes intersecting with one target placement surface, virtual object 2 is a double-face intersection mode or also known as an intersection line mode intersecting with two target placement surfaces (ground + wall), and virtual object 6 is a three-face intersection mode or also known as a corner point mode intersecting with three target placement surfaces (ground + wall + wall).
[0084] Step S402, according to the intersection mode, calculating the placement pose of the virtual object in the three-dimensional space.
[0085] Specifically, according to the above-mentioned determined intersection mode, the placement intention of the user to the virtual object in the three-dimensional space is predicted, for example, whether to place on the ground, or to place against the wall, or to place against the corner. According to the placement intention, combined with the size, angle and other information of the virtual object, the placement position and the corresponding rotation orientation angle of the virtual object in the three-dimensional space are calculated.
[0086] According to one embodiment of the present disclosure, according to the intersection mode, the placement pose of the virtual object in the three-dimensional space is calculated, including: in response to the intersection mode being one of the single-face intersection mode, the double-face intersection mode, and the three-face intersection mode, determining the placement mode of the virtual object; according to the placement mode and the face normal of the target placement surface, determining the placement pose of the virtual object.
[0087] Specifically, according to the determined intersection mode, a corresponding placement mode is predicted, and then according to the determined placement mode, a surface normal of the target placement surface is referred to to determine an orientation and a position of the virtual object in the three-dimensional space, so as to obtain a placement pose of the virtual object.
[0088] According to another embodiment of the present disclosure, the placement pose of the virtual object is determined according to the placement mode and the surface normal of the target placement surface, including: based on the placement mode, a projection coordinate of a center coordinate of the virtual object in the three-dimensional space is determined, and in combination with the surface normal of the target placement surface, a placement pose of the virtual object in the three-dimensional space is calculated.
[0089] Specifically, the present disclosure provides a projection calculation method for a placement pose, according to the determined intersection mode, a corresponding placement mode is predicted, and then according to the corresponding placement mode, a projection position of a center coordinate of the virtual object in the three-dimensional space is determined, and then a projection coordinate of the center coordinate of the virtual object in the three-dimensional space is obtained, so as to calculate a placement position of the virtual object in the three-dimensional space. Finally, according to the surface normal of the target placement surface, a rotation orientation angle of the virtual object in the three-dimensional space is calculated, and the placement position and the rotation orientation angle of the virtual object form the placement pose.
[0090] According to still another embodiment of the present disclosure, the placement mode corresponding to the single-face intersection mode is a surface-adhesion placement mode; in response to the intersection mode being the single-face intersection mode, based on the placement mode, a projection coordinate of a center coordinate of the virtual object in the three-dimensional space is determined, and in combination with the surface normal of the target placement surface, a placement pose of the virtual object in the three-dimensional space is calculated, including: judging whether the target placement surface is parallel or perpendicular to a preset standard surface; in response to the target placement surface being parallel to the standard surface, determining a projection coordinate of the center coordinate of the virtual object on the target placement surface; according to the surface normal of the target placement surface, adjusting the projection coordinate in height, so as to calculate a surface-adhesion placement position of the virtual object; in response to the target placement surface being perpendicular to the standard surface, determining a projection coordinate of the center coordinate of the virtual object on the target placement surface; according to the surface normal of the target placement surface, adjusting the projection coordinate in depth, so as to calculate a surface-adhesion placement position of the virtual object; and according to the surface normal of the target placement surface, calculating a rotation orientation matrix of the virtual object when placed on the surface in the three-dimensional space.
[0091] Specifically, when the intersection mode is the intersection point mode, the virtual object intersects with a target placement surface in the three-dimensional space, which indicates that the user wants to place the item on the target placement surface, i.e., the surface placement mode, and at this time, only the surface intersecting the item and the target placement surface needs to be placed on the target placement surface. In addition, it can be known from the above FIG. 5 that the target placement surface can be the ground, can be the ceiling, and can also be the wall, and different target placement surfaces have different calculation methods of the placement posture, so first, the position and direction of the target placement surface in the three-dimensional space need to be determined, and the position and direction of the specific target placement surface in the three-dimensional space can be determined synchronously when the placement surfaces of each entity object in the three-dimensional space are recognized.
[0092] Of course, in addition to the above method of determining the position and direction of the target placement surface in the three-dimensional space synchronously when the placement surfaces of each entity object in the three-dimensional space are recognized, the target placement surface can also be determined before the projection coordinate of the center coordinate of the virtual object in the three-dimensional space is calculated. It is agreed in the embodiment of the present disclosure that the target placement surface parallel to the ground plane is a "horizontal plane", and the target placement surface perpendicular to the ground plane is a "vertical plane".
[0093] Further, when the target placement surface is a "horizontal plane" (the ground or the ceiling), the projection coordinate p of the center coordinate of the virtual object on the target placement surface is calculated, the height of the virtual object with the bounding box is set as height (i.e., the y direction), and the surface normal of the target placement surface is It can be understood that the projection point is the center coordinate of the virtual object, and the position of the projection point is the lower half of the virtual object embedded in the target placement surface, so the height value of the projection coordinate needs to be adjusted. For the ground, the height is moved by height / 2 along the direction of the surface normal, and for the ceiling, the height is also moved by height / 2 along the direction of the surface normal, and the surface placement position of the virtual object is obtained as:
[0094] In addition, for the case that the target placement surface is a "horizontal plane", considering that the default orientation of the virtual object in the three-dimensional space is the direction of the surface normal of the target placement surface, the rotation angle does not need to be adjusted, and only the surface placement position needs to be calculated.
[0095] When the target placement surface is a "vertical plane" (the wall), the projection coordinate p of the center coordinate of the virtual object on the target placement surface is calculated, the depth of the virtual object with the bounding box is set as depth (i.e., the z direction), and the surface normal of the target placement surface is Similar to the height adjustment method of the "flat surface" described above, at this time, only the depth value of the projection coordinates needs to be adjusted, and the depth is moved by depth / 2 along the direction of the surface normal to obtain the surface-attached placement position of the virtual object as
[0096] In addition, for the "vertical surface", the initial orientation of the virtual object is set as The final orientation is combined as the surface normal The embodiments of the present disclosure adjust the orientation of the virtual object to the standard orientation by the quaternion quat The rotation orientation matrix R of the virtual object when placed against the target placement surface is calculated. When the virtual object is moved according to the placement posture subsequently, the orientation of the virtual object is first adjusted to the standard orientation according to the rotation orientation matrix, and then moved according to the placement position, to realize the surface-attached placement of the virtual object.
[0097] According to another embodiment of the present disclosure, the placement mode corresponding to the double-face intersection mode is the edge-attached placement mode; in response to the intersection mode being the double-face intersection mode, based on the placement mode, the projection coordinates of the center coordinates of the virtual object in the three-dimensional space are determined, and the placement posture of the virtual object in the three-dimensional space is calculated in combination with the surface normal of the target placement surface, including: judging that the two target placement surfaces are respectively parallel, perpendicular to the preset standard surface; or both perpendicular to the standard surface; in response to the two target placement surfaces being respectively parallel, perpendicular to the standard surface, the projection coordinates of the center coordinates of the virtual object on the intersection line of the two target placement surfaces are determined; according to the surface normal of the two target placement surfaces, the projection coordinates are adjusted in height and depth, and the edge-attached placement position of the virtual object is calculated, and according to the surface normal of the target placement surface perpendicular to the standard surface, the rotation orientation matrix of the virtual object when edge-attached placed in the three-dimensional space is calculated; in response to the two target placement surfaces being both perpendicular to the standard surface, the projection coordinates of the center coordinates of the virtual object on the intersection line of the two target placement surfaces are determined; according to the surface normal of the two target placement surfaces, the projection coordinates are adjusted in depth and width, and the edge-attached placement position of the virtual object is calculated; and according to the surface normal of the target placement surface perpendicular to the standard surface, the rotation orientation matrix of the virtual object when edge-attached placed in the three-dimensional space is calculated.
[0098] Specifically, when the intersection mode is the intersection line mode, the virtual object intersects with two target placement surfaces in three-dimensional space, indicating that the user wants to place the item at the intersection of the two target placement surfaces, which is the edge placement mode. At this time, the projection position of the virtual object in three-dimensional space is the intersection line. In addition, as shown in Figure 5 above, the target placement surface may be the ground and wall, the ceiling and wall, or two adjacent walls. The method for calculating the placement posture is different depending on the position and direction of the target placement surface in three-dimensional space. Therefore, it is first necessary to determine the orientation of the two target placement surfaces in three-dimensional space. In this embodiment, the ground plane is used as the standard plane. The target placement surface parallel to the ground plane is defined as the "plane", and the target placement surface perpendicular to the ground plane is defined as the "vertical plane".
[0099] When the two target placement surfaces are a "plane" and a "vertical plane", calculate the projected coordinates p of the virtual object's center coordinates on the intersection line of the two target placement surfaces. Set the depth of the virtual object with its bounding volume to depth (i.e., the z-direction) and its height to height (i.e., the y-direction). The normal to the "vertical plane" is... The surface normal vector of the "plane" is Similar to the adjustment method described above, this time the depth and height values of the projected coordinates need to be adjusted according to their corresponding face normal directions to obtain the placement position of the virtual object's outline:
[0100] Additionally, for the "vertical plane", the initial orientation of the virtual object is set to... Combine the final orientation as the surface normal This disclosure uses quaternion quat Calculate the rotation orientation matrix R of the virtual object when it is placed flush with the target surface. This allows for subsequent movement of the virtual object according to its placement posture. First, the orientation of the virtual object is adjusted to the standard orientation using the rotation orientation matrix R, and then it is moved according to the placement position, achieving line-fitting placement of the virtual object.
[0101] When the two target placement surfaces are "perpendicular" and "perpendicular", calculate the projection coordinate p of the virtual object's center coordinates on the intersection line of the two target placement surfaces. Set the depth (i.e., z-direction) and width (i.e., x-direction) of the virtual object with a bounding body. Similar to the adjustment method described above, the depth and width values of the projection coordinates need to be adjusted according to their corresponding face normal directions to obtain the virtual object's placement position along the line:
[0102] Additionally, for the case that both target placement surfaces are "vertical surfaces", the embodiment of the present disclosure also needs to select a standard orientation from the two "vertical surfaces" to determine the rotation orientation matrix of the virtual object. The embodiment of the present disclosure selects a target normal vector from the normal vectors of the two target placement surfaces as the standard orientation for subsequent calculation of the rotation matrix by comparing the angle between the observation direction of the user in the three-dimensional space and the normal vectors of the two target placement surfaces, and according to the comparison result. The specific method of determining the target normal vector is to select the maximum angle from the two angles formed by the observation direction of the user and the two normal vectors, and the normal vector of the target placement surface corresponding to the maximum angle is selected as the target normal vector. Because the observation direction of the user and the directions of the two normal vectors are opposite, the maximum angle is taken.
[0103] Further, the target normal vector is taken as the target standard orientation of the virtual object, and the initial orientation of the virtual object is By using the above similar method, the rotation orientation matrix R of the virtual object when placed in line with the target placement surface is calculated by using the quaternion. When the virtual object is moved according to the placement posture subsequently, the orientation of the virtual object is first adjusted to the standard orientation according to the rotation orientation matrix R, and then moved according to the placement position, so as to realize the in-line placement of the virtual object.
[0104] According to another embodiment of the present disclosure, the placement mode corresponding to the three-surface intersection mode is a corner placement mode; in response to the intersection mode being the three-surface intersection mode, based on the placement mode, the projection coordinates of the center coordinates of the virtual object in the three-dimensional space are determined, and the placement posture of the virtual object in the three-dimensional space is calculated in combination with the normal vectors of the target placement surfaces, including: determining the projection coordinates of the center coordinates of the virtual object on the corner points formed by the three target placement surfaces; adjusting the projection coordinates in terms of width, height and depth according to the normal vectors of the three target placement surfaces, to calculate the corner placement position of the virtual object, and calculating the rotation orientation matrix of the virtual object when placed in the corner in the three-dimensional space according to the normal vectors of the target placement surfaces.
[0105] Specifically, when the intersection mode is the corner point mode, the virtual object intersects with three target placement surfaces in the three-dimensional space, which indicates that the user wants to place the object at the intersection of the three target placement surfaces, and in-line on the corner points (that is, the points where the three target placement surfaces intersect) of the three target placement surfaces, that is, the corner placement mode. At this time, the projection position of the virtual object in the three-dimensional space is the corner point. Additionally, it can be known from the above FIG. 5 that at this time, the three target placement surfaces are ground + wall + wall, or ceiling + wall + wall. The embodiment of the present disclosure takes the ground as the standard surface, and agrees that the target placement surface parallel to the ground is a "flat surface", and the target placement surface perpendicular to the ground is a "vertical surface".
[0106] The positional relationship of the three target placement surfaces is "plane" + "vertical plane" + "vertical plane". In this case, the projection coordinates p of the center coordinates of the virtual object on the corner points formed by the three target placement surfaces are calculated. The depth (z direction), height (y direction), and width (x direction) of the virtual object with the bounding box are set. Similar to the adjustment method described above, the depth, height, and width of the projection coordinates are adjusted according to the corresponding normal directions of the surfaces, and the corner placement position of the virtual object is obtained as follows:
[0107] Alternatively, for "plane" + "vertical plane" + "vertical plane", similar to the method of determining the target normal from the normals of two "vertical planes" described above, the target normal is selected as the normal of the "vertical plane" corresponding to the largest angle between the observation direction of the user in the three-dimensional space and the normals of the two "vertical planes". The target normal is used as the target standard orientation of the virtual object, and the initial orientation of the virtual object is The rotation matrix R of the virtual object when placed against the target placement surface is calculated through the quaternion.
[0108] It should be noted that, in order to facilitate the alignment calculation between matrices, the placement pose of the virtual object is uniformly defined as where R is the rotation orientation matrix and t is the placement position.
[0109] Finally, according to various intersection modes, the placement pose of the virtual object in the three-dimensional space is calculated. When moving the virtual object according to the placement pose, the orientation of the virtual object is first adjusted to the standard orientation according to the rotation orientation matrix R, and then moved according to the placement position t, thereby realizing the placement of the virtual object against the three-dimensional space.
[0110] FIG. 6 is a schematic diagram of the virtual object placed against the three-dimensional space according to the calculated placement pose in an embodiment of the present disclosure. As can be seen from the figure, the virtual object initially intersects with a "vertical plane" in the three-dimensional space, the intersection mode is the intersection point mode, and the corresponding placement mode is the surface placement mode, that is, the placement against the "vertical plane". First, the projection coordinates of the center coordinates of the virtual object on the target placement surface ("vertical plane") are determined, and the depth of the projection coordinates is adjusted according to the normal of the target placement surface to calculate the surface placement position t of the virtual object. Then, the rotation orientation matrix R of the surface placement is calculated according to the normal of the "vertical plane" and the current orientation of the virtual object. The white bottom diagram in FIG. 6 is a schematic diagram of calculating the placement pose (surface placement position t and rotation orientation matrix R). Finally, the orientation of the virtual object is adjusted to the standard orientation according to the rotation orientation matrix, and then moved according to the placement position t, thereby realizing the surface placement of the virtual object.
[0111] FIG. 7 is a schematic diagram of the overall flow of the virtual object placement method according to an embodiment of the present disclosure. A three-dimensional space is obtained, and the placement surfaces of various entity objects in the three-dimensional space are identified, as well as the position attributes (‘plane’ and ‘vertical plane’) of the various placement surfaces in the three-dimensional space. The various placement surfaces are endowed with the ability to listen to collision actions. The virtual object corresponding to the virtual object to be placed is loaded in the three-dimensional space, and the bounding volume of the virtual object is constructed. The movement operation of the user on the virtual object is listened to. In response to the intersection event between the bounding volume of the virtual object and one or more target placement surfaces in the various placement surfaces, the number of target placement surfaces in which the intersection event occurs is determined. The intersection mode corresponding to the intersection event is one of the intersection point mode intersecting with one target placement surface, the intersection line mode intersecting with two target placement surfaces, and the corner point mode intersecting with three target placement surfaces. Meanwhile, the position attribute of the target placement surface in the three-dimensional space in each intersection mode is determined to be a ‘plane’ or a ‘vertical plane’, specifically, the target placement surface corresponding to the intersection point mode is a ‘plane’ or a ‘vertical plane’; the two target placement surfaces corresponding to the intersection line mode are a ‘plane’ + a ‘vertical plane’ or a ‘vertical plane’ + a ‘vertical plane’; and the three target placement surfaces corresponding to the corner point mode are a ‘plane’ + a ‘vertical plane’ + a ‘vertical plane’.
[0112] Further, according to different intersection modes, placement modes corresponding to the intersection modes, and the position attribute groups of the target placement surfaces in the three-dimensional space in each intersection mode, the projection coordinates of the center coordinates of the virtual object are calculated, and the position of the virtual object is adjusted in combination with the surface normal. The position of the virtual object is calculated. Meanwhile, according to the current orientation of the virtual object and the surface normal of the ‘vertical plane’ in the target placement surface, the rotation orientation matrix of the virtual object in the three-dimensional space is calculated. According to the position of the virtual object and the rotation orientation matrix, the placement posture of the virtual object is obtained. Finally, the placement position of the virtual object is determined according to the placement posture, so that one or more surfaces of the virtual object are placed in combination with one or more target placement surfaces.
[0113] FIG. 8 is a schematic diagram of the main modules of the object placement device according to an embodiment of the present disclosure. As shown in FIG. 8, the object placement device 800 mainly includes a virtual object loading module 801, a placement posture determination module 802, and a virtual object placement module 803.
[0114] The virtual object loading module 801 is configured to obtain a three-dimensional space, and load a virtual object corresponding to a virtual object in the three-dimensional space.
[0115] The placement posture determination module 802 is configured to listen to a movement operation on the virtual object, and identify a placement surface of the object in the three-dimensional space; and in response to an intersection event of the virtual object and one or more target placement surfaces in the placement surface, determine a placement posture of the virtual object in the three-dimensional space.
[0116] The virtual object placement module 803 is configured to determine a placement position of the virtual object according to the placement posture, so that one or more surfaces of the virtual object are attached to the one or more target placement surfaces.
[0117] According to one embodiment of the present disclosure, the placement posture determination module 802 is further configured to identify a position and a size of the placement surface of the object in the three-dimensional space, and the placement surface listens to a collision action or an attachment action.
[0118] According to another embodiment of the present disclosure, the object placement device 800 further comprises a bounding volume generation module (not shown in the figure), configured to: after loading the virtual object corresponding to the virtual object in the three-dimensional space, determine a bounding volume of the virtual object according to a shape and a size of the virtual object, and when the bounding volume collides with or is attached to one or more target placement surfaces in the placement surface, an intersection event occurs.
[0119] According to still another embodiment of the present disclosure, the placement posture determination module 802 is further configured to: according to the intersection event of the virtual object and one or more target placement surfaces in the placement surface, determine an intersection mode corresponding to the intersection event; and according to the intersection mode, calculate the placement posture of the virtual object in the three-dimensional space.
[0120] According to still another embodiment of the present disclosure, the intersection mode comprises a single-surface intersection mode in which the virtual object intersects with one target placement surface in the placement surface, a double-surface intersection mode in which the virtual object intersects with two target placement surfaces in the placement surface, and a three-surface intersection mode in which the virtual object intersects with three target placement surfaces in the placement surface; and the placement posture determination module 802 is further configured to: in response to the intersection mode being one of the single-surface intersection mode, the double-surface intersection mode and the three-surface intersection mode, determine a placement mode of the virtual object; and according to the placement mode and a surface normal of the target placement surface, determine the placement posture of the virtual object.
[0121] According to another embodiment of the present disclosure, the placement posture determination module 802 is further configured to: based on the placement mode, determine a projection coordinate of a center coordinate of the virtual object in the three-dimensional space, and in combination with the surface normal of the target placement surface, calculate the placement posture of the virtual object in the three-dimensional space.
[0122] According to still another embodiment of the present disclosure, the single-face intersection mode corresponds to a surface-attached placement mode; the placement posture determination module 802 is further configured to: determine whether the target placement surface is parallel or perpendicular to a preset standard surface; in response to the target placement surface being parallel to the standard surface, determine a projection coordinate of a center coordinate of the virtual object on the target placement surface; perform height adjustment on the projection coordinate according to a surface normal of the target placement surface, to obtain a surface-attached placement position of the virtual object; in response to the target placement surface being perpendicular to the standard surface, determine a projection coordinate of the center coordinate of the virtual object on the target placement surface; perform depth adjustment on the projection coordinate according to the surface normal of the target placement surface, to obtain the surface-attached placement position of the virtual object; and calculate a rotation orientation matrix of the virtual object when placed on the surface in the three-dimensional space according to the surface normal of the target placement surface.
[0123] According to another embodiment of the present disclosure, the double-face intersection mode corresponds to a side-attached placement mode; the placement posture determination module 802 is further configured to: determine whether the two target placement surfaces are parallel, perpendicular, or both perpendicular to a preset standard surface; in response to the two target placement surfaces being parallel or perpendicular to the standard surface, respectively, determine a projection coordinate of a center coordinate of the virtual object on a line of intersection of the two target placement surfaces; perform height and depth adjustment on the projection coordinate according to surface normals of the two target placement surfaces, to obtain a side-attached placement position of the virtual object, and calculate a rotation orientation matrix of the virtual object when placed on the side in the three-dimensional space according to the surface normal of the target placement surface that is perpendicular to the standard surface; in response to the two target placement surfaces being both perpendicular to the standard surface, determine a projection coordinate of the center coordinate of the virtual object on the line of intersection of the two target placement surfaces; perform depth and width adjustment on the projection coordinate according to the surface normals of the two target placement surfaces, to obtain the side-attached placement position of the virtual object; and calculate the rotation orientation matrix of the virtual object when placed on the side in the three-dimensional space according to the surface normal of the target placement surface that is perpendicular to the standard surface.
[0124] According to still another embodiment of the present disclosure, the three-face intersection mode corresponds to a corner-attached placement mode; the placement posture determination module 802 is further configured to: determine a projection coordinate of a center coordinate of the virtual object on a corner point formed by the three target placement surfaces; perform width, height, and depth adjustment on the projection coordinate according to surface normals of the three target placement surfaces, to obtain a corner-attached placement position of the virtual object, and calculate a rotation orientation matrix of the virtual object when placed on the corner in the three-dimensional space according to the surface normal of the target placement surface.
[0125] According to still another embodiment of the present disclosure, the bounding volume generation module (not shown in the figure) is further configured to: perform simplification processing on a shape of the virtual object, to obtain a shape of a bounding volume of the virtual object; and perform magnification on a size of the virtual object according to a preset magnification coefficient, to obtain the bounding volume of the virtual object according to the shape of the bounding volume.
[0126] According to another embodiment of the present disclosure, the virtual object placement device 800 further comprises a placement attribute adding module (not shown in the figure) configured to: after determining the placement position of the virtual object according to the placement posture, adding a placement attribute to the virtual object, each surface in the virtual object listens to a collision action or a close action, and when the collision action or the close action is listened to, the surface of the virtual object is taken as a target placement surface.
[0127] According to still another embodiment of the present disclosure, the virtual object placement device 800 further comprises a human-computer interaction module (not shown in the figure) configured to: pre-move the virtual object according to the placement posture to show the placement mode of the virtual object; and in response to receiving an instruction to place the virtual object according to the placement posture, determine the placement position of the virtual object.
[0128] FIG. 9 is an exemplary system architecture diagram to which the embodiments of the present disclosure can be applied.
[0129] As shown in FIG. 9, the system architecture 900 can include terminal devices 901, 902, 903, a network 904, and a server 905. The network 904 is a medium for providing a communication link between the terminal devices 901, 902, 903 and the server 905. The network 904 can include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0130] A user can use the terminal devices 901, 902, 903 to interact with the server 905 through the network 904 to receive or send messages, etc. Various communication client applications, such as an object placement application, etc. (only as an example), can be installed on the terminal devices 901, 902, 903.
[0131] The terminal devices 901, 902, 903 can be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.
[0132] The server 905 can be a server providing various services, for example, a background management server providing support for placement of an item by a user using a terminal device 901, 902, 903 (only as an example). The background management server can acquire a three-dimensional space, load a virtual object corresponding to a virtual item in the three-dimensional space, listen to a movement operation on the virtual object, and identify a placement surface of the object in the three-dimensional space. In response to an intersection event between the virtual object and one or more target placement surfaces in the placement surface, the background management server determines a placement posture of the virtual object in the three-dimensional space, determines a placement position of the virtual object according to the placement posture, and processes one or more surfaces of the virtual object to be attached to the one or more target placement surfaces, and feeds back a processing result (for example, a placement result, only as an example) to the terminal device.
[0133] It should be noted that the placement method of the virtual item provided by the embodiments of the present disclosure is generally executed by the server 905, and accordingly, the placement device of the virtual item is generally arranged in the server 905.
[0134] It should be understood that the number of terminal devices, networks, and servers in FIG. 9 is only illustrative. According to the needs of implementation, there can be any number of terminal devices, networks, and servers.
[0135] Reference is made below to FIG. 10, which is a structural schematic diagram of a computer system of a terminal device or a server suitable for implementing the embodiments of the present disclosure. The terminal device or server shown in FIG. 10 is only an example, and should not bring any limitation to the functions and use range of the embodiments of the present disclosure.
[0136] As shown in FIG. 10, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 1002 or loaded from a storage portion 1008 to a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for operation of the system 1000 are also stored. The CPU 1001, the ROM 1002, and the RAM 1003 are connected to each other through a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0137] The following components are connected to the I / O interface 1005: an input part 1006 including a keyboard, a mouse, etc.; an output part 1007 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage part 1008 including a hard disk, etc.; and a communication part 1009 including a network interface card such as a LAN card, a modem, etc. The communication part 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as necessary. A removable media 1011 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 1010 as necessary, so that a computer program read out therefrom is installed in the storage part 1008 as necessary.
[0138] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for executing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication part 1009, and / or installed from the removable media 1011. When the computer program is executed by the central processing unit (CPU) 1001, the above-described functions defined in the system of the present disclosure are executed.
[0139] It should be noted that the computer-readable medium shown in the disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination thereof. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the disclosure, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the disclosure, the computer-readable signal medium can include a data signal carrying computer-readable program code in a baseband or as a part of a carrier wave. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or apparatus. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination thereof.
[0140] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a part of code containing one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order than that shown in the drawings. For example, two blocks that are shown in succession can actually be executed substantially in parallel, and they can also be executed in reverse order, depending on the involved functions. It should also be noted that each block in the block diagrams or flowcharts, and the combination of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0141] The units described in the embodiments of the present disclosure can be implemented in the form of software, or can be implemented in the form of hardware. The described units can also be arranged in a processor, for example, can be described as: a processor comprising a virtual item loading module, a placement posture determining module and a virtual item placement module.
[0142] In some cases, the names of the modules do not constitute a limitation on the modules themselves, for example, the virtual item loading module can also be described as "a module for obtaining a three-dimensional space, and loading a virtual object corresponding to a virtual item in the three-dimensional space".
[0143] On the other hand, the present disclosure also provides a computer readable medium, which can be included in the device described in the embodiments, or can exist independently without being assembled into the device. The computer readable medium carries one or more programs, which, when executed by the device, cause the device to include: obtaining a three-dimensional space, and loading a virtual object corresponding to a virtual item in the three-dimensional space; listening to a movement operation on the virtual object, and identifying a placement surface of the object in the three-dimensional space; in response to an intersection event between the virtual object and one or more target placement surfaces in the placement surface, determining a placement posture of the virtual object in the three-dimensional space; and determining a placement position of the virtual object according to the placement posture, so that one or more surfaces of the virtual object are fitted with the one or more target placement surfaces.
[0144] According to the technical solutions of the embodiments of the present disclosure, the following advantages or beneficial effects are achieved: by obtaining a three-dimensional space, and loading a virtual object corresponding to a virtual item in the three-dimensional space; listening to a movement operation on the virtual object, and identifying a placement surface of the object in the three-dimensional space; in response to an intersection event between the virtual object and one or more target placement surfaces in the placement surface, determining a placement posture of the virtual object in the three-dimensional space; and determining a placement position of the virtual object according to the placement posture, so that one or more surfaces of the virtual object are fitted with the one or more target placement surfaces, an automatic and accurate item placement method is implemented, the position where the virtual object needs to be fitted and placed is accurately calculated according to the movement operation on the virtual object, not only the need for fitting and placing is met, but also the placement process is simplified, manual adjustment is avoided, the placement efficiency of the virtual item is improved, and accordingly, the fusion efficiency of the virtual object and the real three-dimensional environment is also improved.
[0145] The specific implementation does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can occur depending on design requirements and other factors. Any modification, equivalent replacement and improvement made within the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.
Claims
1. A method for placing a virtual object, comprising: acquiring a three-dimensional space, and loading a virtual object corresponding to a virtual object in the three-dimensional space; listening to a movement operation of the virtual object, and identifying a placement surface in the three-dimensional space; in response to an intersection event between the virtual object and one or more target placement surfaces in the placement surface, determining a placement posture of the virtual object in the three-dimensional space; and determining a placement position of the virtual object according to the placement posture, so that one or more surfaces of the virtual object are attached to the one or more target placement surfaces. Identifying a placement surface in the three-dimensional space comprises:
2. The method of claim 1, wherein, identifying a position and a size of the placement surface in the three-dimensional space, and the placement surface listens to a collision action or an attachment action. After loading the virtual object corresponding to the virtual object in the three-dimensional space, the method further comprises:
3. The method of claim 2, wherein, determining a bounding volume of the virtual object according to a shape and a size of the virtual object, and an intersection event occurs when the bounding volume collides with or is attached to one or more target placement surfaces in the placement surface. In response to the intersection event between the virtual object and one or more target placement surfaces in the placement surface, determining a placement posture of the virtual object in the three-dimensional space comprises:
4. The method of claim 1, wherein, determining an intersection mode corresponding to the intersection event according to the intersection event between the virtual object and one or more target placement surfaces in the placement surface; and calculating the placement posture of the virtual object in the three-dimensional space according to the intersection mode. The intersection mode comprises a single-surface intersection mode in which the virtual object intersects with one target placement surface in the placement surface, a double-surface intersection mode in which the virtual object intersects with two target placement surfaces in the placement surface, and a three-surface intersection mode in which the virtual object intersects with three target placement surfaces in the placement surface.
5. The method of claim 4, wherein, Calculating the placement posture of the virtual object in the three-dimensional space according to the intersection mode comprises: in response to the intersection mode being one of the single-surface intersection mode, the double-surface intersection mode and the three-surface intersection mode, determining a placement mode of the virtual object; and determining the placement posture of the virtual object according to the placement mode and a surface normal of the target placement surface. Determining the placement posture of the virtual object according to the placement mode and the surface normal of the target placement surface comprises:
6. The method of claim 5, wherein, determining a projection coordinate of a center coordinate of the virtual object in the three-dimensional space based on the placement mode, and calculating the placement posture of the virtual object in the three-dimensional space in combination with the surface normal of the target placement surface. The placement mode corresponding to the single-surface intersection mode is an attached placement mode.
7. The method of claim 6, wherein, In response to the intersection mode being the single-surface intersection mode, determining a projection coordinate of a center coordinate of the virtual object in the three-dimensional space based on the placement mode, and calculating the placement posture of the virtual object in the three-dimensional space in combination with the surface normal of the target placement surface comprises: determining whether the target placement surface is parallel or perpendicular to a preset standard plane; in response to the target placement surface being parallel to the standard plane, determining a projection coordinate of a center coordinate of the virtual object on the target placement surface, adjusting the projection coordinate in height according to a surface normal of the target placement surface, and calculating a surface-attached placement position of the virtual object; and in response to the target placement surface being perpendicular to the standard plane, determining a projection coordinate of a center coordinate of the virtual object on the target placement surface, adjusting the projection coordinate in depth according to a surface normal of the target placement surface, and calculating a surface-attached placement position of the virtual object; and calculating a rotation orientation matrix of the virtual object when placed surface-attached in the three-dimensional space according to the surface normal of the target placement surface.
8. The method of claim 6, wherein, the placement mode corresponding to the double-surface intersection mode is an edge-attached placement mode; in response to the intersection mode being the double-surface intersection mode, determining a projection coordinate of a center coordinate of the virtual object in the three-dimensional space based on the placement mode, and calculating a placement posture of the virtual object in the three-dimensional space in combination with a surface normal of the target placement surface, including: determining whether the two target placement surfaces are parallel or perpendicular to a preset standard plane respectively, or are both perpendicular to the standard plane; in response to the two target placement surfaces being parallel or perpendicular to the standard plane respectively, determining a projection coordinate of a center coordinate of the virtual object on an intersection line of the two target placement surfaces, adjusting the projection coordinate in height and depth according to surface normals of the two target placement surfaces, calculating an edge-attached placement position of the virtual object, and calculating a rotation orientation matrix of the virtual object when placed edge-attached in the three-dimensional space according to a surface normal of the target placement surface that is perpendicular to the standard plane; and in response to the two target placement surfaces being both perpendicular to the standard plane, determining a projection coordinate of a center coordinate of the virtual object on an intersection line of the two target placement surfaces, adjusting the projection coordinate in depth and width according to surface normals of the two target placement surfaces, calculating an edge-attached placement position of the virtual object, and calculating a rotation orientation matrix of the virtual object when placed edge-attached in the three-dimensional space according to a surface normal of the target placement surface that is perpendicular to the standard plane.
9. The method of claim 6, wherein, the placement mode corresponding to the three-surface intersection mode is a corner-attached placement mode; in response to the intersection mode being the three-surface intersection mode, determining a projection coordinate of a center coordinate of the virtual object in the three-dimensional space based on the placement mode, and calculating a placement posture of the virtual object in the three-dimensional space in combination with a surface normal of the target placement surface, including: determining a projection coordinate of a center coordinate of the virtual object on a vertex point formed by the three target placement surfaces; performing width, height and depth adjustment on the projection coordinate according to a surface normal of the three target placement surfaces, to obtain a corner placement position of the virtual object, and calculating a rotation orientation matrix of the virtual object when placed in the three-dimensional space according to the surface normal of the target placement surface.
10. The method of claim 3, wherein, According to the shape and size of the virtual object, determine the bounding volume of the virtual object, including: simplifying the shape of the virtual object to obtain the shape of the bounding volume of the virtual object; and According to the shape of the bounding volume, the size of the virtual object is enlarged according to the preset magnification factor, to obtain the bounding volume of the virtual object.
11. The method of claim 1, wherein, After determining the placement position of the virtual object according to the placement posture, the method further comprises: adding placement attributes to the virtual object, each surface in the virtual object listens to collision action or close action, and when the collision action or close action is listened to, the surface of the virtual object is taken as the target placement surface.
12. The method of claim 1, wherein, The method further comprises: pre-moving the virtual object according to the placement posture to show the placement mode of the virtual object; and in response to receiving an instruction to place the virtual object according to the placement posture, determining the placement position of the virtual object.
13. A virtual object placement device, comprising: a virtual object loading module for obtaining a three-dimensional space and loading a virtual object corresponding to a virtual object in the three-dimensional space; a placement posture determination module for listening to a movement operation on the virtual object and identifying a placement surface in the three-dimensional space; in response to an intersection event between the virtual object and one or more target placement surfaces in the placement surface, determining a placement posture of the virtual object in the three-dimensional space; and a virtual object placement module for determining a placement position of the virtual object according to the placement posture, so that one or more surfaces of the virtual object are in contact with the one or more target placement surfaces.
14. A mobile electronic device terminal, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-12.
15. A computer readable medium having stored thereon a computer program, the program being executed by a processor to implement the method of any one of claims 1-12.
16. A computer program product comprising a computer program, the computer program being executed by a processor to implement the method of any one of claims 1-12.