A method and device for placing virtual items
By calculating the placement posture of virtual objects in the three-dimensional space and automatically adjusting it, the cumbersome problem of manually adjusting the surface fit between the virtual objects and the three-dimensional space in the prior art is solved, and efficient and accurate fusion of virtual objects and three-dimensional environment is achieved.
Patent Information
- Application Number
- CN202411354634.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-09-26
AI Technical Summary
In the prior art, users need to manually adjust the degree of fit between the virtual object and the placed surface in the three-dimensional space, resulting in the need of repeated repetition of fine operations, which brings visual and physical fatigue to the user and affects user experience and item satisfaction.
By monitoring the intersection events of the virtual object corresponding to the virtual item and the placement surface in the three-dimensional space, the placement posture of the virtual object in the three-dimensional space is calculated, and the virtual object is moved according to the placement posture to achieve the purpose of fitting the placement.
An automatic and accurate virtual item placement method is realized, which simplifies the placement process and eliminates manual adjustments, improving the placement efficiency of virtual items and the integration efficiency of virtual objects with the real three-dimensional environment.
Smart Images

Figure CN118887371B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for placing virtual items. Background Art
[0002] With the development of dynamic video, animated images, 3D and AR technologies, providing users with immersive experience has gradually become the exploration and development direction of various service industries. For example, online trading platforms or architectural design systems integrate the objects of interest as virtual objects with the real environment, so that users can get a simulated real experience in advance. When integrating objects as virtual objects with the real environment, users need to manually adjust the degree of fit between the virtual objects and the placement surface in the real three-dimensional environment. For example, the coffee machine needs to be placed on the desktop, and the air conditioner needs to be placed on the wall, etc., to achieve a better simulation placement effect.
[0003] In the process of implementing the present invention, it is found that the prior art has the following problems:
[0004] Although the existing method of manually adjusting the degree of fit between the virtual object and the placement surface in the three-dimensional space can basically meet the needs of integrating the object with the real environment, since the fitting placement of the virtual object with the placement surface in the three-dimensional space is a delicate operation, the user needs to repeatedly fit and place it to achieve a better display effect, which brings visual and physical fatigue to the user, affects the user's experience, and accordingly, also affects the user's satisfaction with the object. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a method and device for placing a virtual object. According to the monitored intersection events between the virtual object corresponding to the virtual object and each placement surface in the three-dimensional space, the placement posture of the virtual object in the three-dimensional space is calculated, so that the virtual object can be moved according to the placement posture to achieve the purpose of fitting placement, thereby realizing an automatic and accurate virtual object placement. According to the movement operation of the virtual object, the position where the virtual object needs to be fitted is accurately calculated, which not only meets the needs of fitting placement, but also simplifies the placement process, eliminates manual adjustment, and improves the placement efficiency of the virtual object. Correspondingly, the fusion efficiency of the virtual object and the real three-dimensional environment is also improved.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for placing a virtual item is provided, comprising:
[0007] Acquire a three-dimensional space, and load a virtual object corresponding to the virtual item into the three-dimensional space;
[0008] Monitoring a movement operation of 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;
[0009] The placement position of the virtual object is determined according to the placement gesture, so that one or more surfaces of the virtual object are aligned with the one or more target placement surfaces.
[0010] Optionally, identifying a placement surface of the object in the three-dimensional space includes: identifying a position and a size of a placement surface of the object in the three-dimensional space, the placement surface monitoring a collision action or a proximity action.
[0011] Optionally, after loading the virtual object corresponding to the virtual item in the three-dimensional space, the method further includes: determining a bounding volume of the virtual object according to a shape and size of the virtual object, and generating an intersection event when the bounding volume collides with or approaches one or more target placement surfaces among the placement surfaces.
[0012] Optionally, in response to an intersection event between the virtual object and one or more target placement surfaces among the placement surfaces, determining the placement posture of the virtual object in the three-dimensional space includes: determining an intersection pattern corresponding to the intersection event based on the intersection event between the virtual object and one or more target placement surfaces among the placement surfaces; and calculating the placement posture of the virtual object in the three-dimensional space based on the intersection pattern.
[0013] Optionally, the intersection mode includes: a single-sided intersection mode in which the virtual object intersects with one target placement surface in the placement surface, a double-sided intersection mode in which the virtual object intersects with two target placement surfaces in the placement surface, and a three-sided intersection mode in which the virtual object intersects with three target placement surfaces in the placement surface; according to the intersection mode, calculating the placement posture of the virtual object in the three-dimensional space, including: in response to the intersection mode being one of the single-sided intersection mode, the double-sided intersection mode and the three-sided intersection mode, determining the placement mode of the virtual object; determining the placement posture of the virtual object according to the placement mode and the surface normal of the target placement surface.
[0014] Optionally, the placement posture 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, determining the projection coordinates of the center coordinates of the virtual object in the three-dimensional space, and combining the surface normal of the target placement surface to calculate the placement posture of the virtual object in the three-dimensional space.
[0015] Optionally, the placement mode corresponding to the single-surface intersection mode is a face-to-face placement mode; in response to the intersection mode being the single-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 combined 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, determining the projection coordinates of the center coordinates of the virtual object on the target placement surface; according to the surface normal of the target placement surface, adjusting the height of the projection coordinates, and calculating the face-to-face placement position of the virtual object; in response to the target placement surface being perpendicular to the standard surface, determining the projection coordinates of the center coordinates of the virtual object on the target placement surface; according to the surface normal of the target placement surface, adjusting the depth of the projection coordinates, and calculating the face-to-face placement position of the virtual object; and according to the surface normal of the target placement surface, calculating the rotation orientation matrix of the virtual object when it is face-to-face placed in the three-dimensional space.
[0016] Optionally, the placement mode corresponding to the double-surface intersection mode is an edge placement mode; in response to the intersection mode being the double-surface intersection mode, based on the placement mode, determining the projection coordinates of the center coordinates of the virtual object in the three-dimensional space, and combining the surface normal of the target placement surface to calculate the placement posture of the virtual object in the three-dimensional space, including: judging that the two target placement surfaces are respectively parallel or perpendicular to a preset standard surface; or are both perpendicular to the standard surface; in response to the two target placement surfaces being respectively parallel or perpendicular to the standard surface, determining the projection coordinates of the center coordinates of the virtual object on the intersection of the two target placement surfaces; and according to the surface normals of the two target placement surfaces, calculating the projection coordinates of the center coordinates of the virtual object on the intersection of the two target placement surfaces. The height and depth of the shadow coordinates are adjusted to calculate the edge placement position of the virtual object, and according to the surface normal of the target placement surface perpendicular to the standard plane, the rotation orientation matrix of the virtual object when it is placed edge to edge in the three-dimensional space is calculated; in response to the two target placement surfaces being perpendicular to the standard plane, the projection coordinates of the center coordinates of the virtual object on the intersection of the two target placement surfaces are determined; according to the surface normals of the two target placement surfaces, the depth and width of the projection coordinates are adjusted to calculate the edge placement position of the virtual object; and according to the surface normal of the target placement surface perpendicular to the standard plane, the rotation orientation matrix of the virtual object when it is placed edge to edge in the three-dimensional space is calculated.
[0017] Optionally, the placement mode corresponding to the three-plane intersection mode is a corner placement mode; in response to the intersection mode being the three-plane 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 combined with the surface normal of the target placement surface, the placement posture of the virtual object in the three-dimensional space is calculated, including: determining the projection coordinates of the center coordinates of the virtual object on the corner point composed of the three target placement surfaces; according to the surface normals of the three target placement surfaces, the projection coordinates are adjusted in width, height and depth to calculate the corner placement position of the virtual object, and according to the surface normal of the target placement surface, the rotation orientation matrix of the virtual object when it is placed at the corner in the three-dimensional space is calculated.
[0018] Optionally, determining the bounding volume of the virtual object according to the shape and size of the virtual object includes: simplifying the shape of the virtual object to obtain the shape of the bounding volume of the virtual object; and magnifying the size of the virtual object according to a preset magnification factor according to the shape of the bounding volume to obtain the bounding volume of the virtual object.
[0019] Optionally, after determining the placement position of the virtual object according to the placement posture, the method further includes: adding placement attributes to the virtual object, each surface in the virtual object listens for collision actions or proximity actions, and when a collision action or proximity action is listened, the surface of the virtual object is used as the target placement surface.
[0020] Optionally, the method further includes: pre-moving the virtual object according to the placement gesture to display a placement manner of the virtual object; and determining a placement position of the virtual object in response to receiving an instruction to place the virtual object according to the placement gesture.
[0021] According to a second aspect of an embodiment of the present invention, there is provided a device for placing a virtual item, comprising:
[0022] A virtual item loading module, used to obtain a three-dimensional space and load a virtual object corresponding to the virtual item in the three-dimensional space;
[0023] a placement posture determination module, configured to monitor a movement operation of the virtual object and identify a placement surface of the object in the three-dimensional space; and determine a placement posture of the virtual 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;
[0024] The virtual object placement module is used to determine the placement position of the virtual object according to the placement posture, so that one or more surfaces of the virtual object are aligned with the one or more target placement surfaces.
[0025] According to a third aspect of an embodiment of the present invention, there is provided an electronic device for placing a virtual item, comprising:
[0026] one or more processors;
[0027] a storage device for storing one or more programs,
[0028] When the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the embodiment of the present invention.
[0029] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method provided by the first aspect of the embodiment of the present invention is implemented.
[0030] According to a fifth aspect of an embodiment of the present invention, there is provided a computer program product, including a computer program, wherein when the computer program is executed by a processor, the method provided in the first aspect of the embodiment of the present invention is implemented.
[0031] An embodiment of the invention has the following advantages or beneficial effects: by acquiring the three-dimensional space, a virtual object corresponding to the virtual item is loaded in the three-dimensional space; the movement operation of the virtual object is monitored, and the 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, the placement posture of the virtual object in the three-dimensional space is determined; 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 aligned with one or more target placement surfaces. The technical solution realizes an automatic and accurate item placement method, and the position where the virtual object needs to be placed is accurately calculated according to the movement operation of the virtual object, which not only meets the need for fitting placement, but also simplifies the placement process, eliminates manual adjustment, and improves the placement efficiency of virtual items. Correspondingly, it also improves the fusion efficiency of virtual objects and the real three-dimensional environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0033] Figure 1 is a schematic diagram of the main process of the method for placing virtual items according to an embodiment of the present invention;
[0034] Figure 2 is a schematic diagram of a virtual object pre-moved according to a placement posture according to an embodiment of the present invention;
[0035] Figure 3is a flow chart of a method for placing a virtual item according to a reference embodiment of the present invention;
[0036] Figure 4 is a flow chart of a method for calculating a placement posture according to an embodiment of the present invention;
[0037] Figure 5 is a schematic diagram of an intersection event between a virtual object and each placement surface in a three-dimensional space according to an embodiment of the present invention;
[0038] Figure 6 is a schematic diagram of a virtual object in an embodiment of the present invention being placed in a three-dimensional space according to a calculated placement posture;
[0039] Figure 7 is a schematic diagram of the overall process of the method for placing virtual items according to an embodiment of the present invention;
[0040] Figure 8 is a schematic diagram of main modules of a device for placing virtual items according to an embodiment of the present invention;
[0041] Fig. 9 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0042] Fig.10 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0043] It should be noted that the acquisition, storage and application of user personal information involved in the technical solution of the present disclosure are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0044] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0045] Although the existing method of manually adjusting the degree of fit between the virtual object and the placement surface in the three-dimensional space can basically meet the needs of integrating the object with the real environment, since the fitting placement of the virtual object with the placement surface in the three-dimensional space is a delicate operation, the user needs to repeatedly fit and place it to achieve a better effect, which brings visual and physical fatigue to the user, affects the user's experience, and accordingly, also affects the user's satisfaction with the object.
[0046] In order to solve the above problems existing in the prior art, the present invention proposes a method for placing virtual objects. According to the intersection events between the virtual object corresponding to the virtual object and each placement surface in the three-dimensional space monitored, the placement posture of the virtual object in the three-dimensional space is determined, so that the placement position of the virtual object is determined according to the placement posture to achieve the purpose of fitting placement. An automatic and accurate method for placing virtual objects is realized. According to the movement operation of the virtual object, the position where the virtual object needs to be placed is accurately calculated, which not only meets the needs of fitting placement, but also simplifies the placement process, eliminates manual adjustment, and improves the placement efficiency of virtual objects. Correspondingly, the fusion efficiency of virtual objects and the real three-dimensional environment is also improved.
[0047] Figure 1 FIG. 1 is a schematic diagram of the main process of the method for placing virtual items according to an embodiment of the present invention. Figure 1 As shown, the method for placing virtual items in the embodiment of the present invention includes the following steps S101 to S103.
[0048] Step S101: Acquire a three-dimensional space, and load a virtual object corresponding to a virtual item into the three-dimensional space.
[0049] Specifically, when users browse items to be traded on an online trading platform, for some items that have the property of being integrated with real three-dimensional space, such as home appliances, furniture, home furnishings, etc., users can send a simulated item placement request to the background item placement system through the specified button in the browsing window, or start a simulated item placement task to simulate the effect of placing the items to be traded in real three-dimensional space. Specifically, it can be the size adaptation effect of the item and the three-dimensional space, or it can be the matching effect of the item and the three-dimensional space layout. When starting the item simulation placement task in the background, the size, color, layout and other information of the three-dimensional space are imported into the system. Of course, it is also possible to more conveniently build the three-dimensional space required by the user in the item placement system by importing pictures of the three-dimensional space, and it is also possible to directly take pictures of the three-dimensional space where the item is to be placed online and upload them to the item placement system.
[0050] Furthermore, based on the above-constructed three-dimensional space simulating the real placement environment, the virtual items selected by the user are modeled, or the online trading platform has completed the modeling of all items on the platform in advance, and then the modeled virtual objects are loaded into the above-mentioned three-dimensional space. It can be understood that the virtual objects of the embodiments of the present invention have exactly the same appearance and the same proportional size as the virtual items, and completely simulate the placement and display of the virtual items in the three-dimensional space.
[0051] Step S102: monitor the movement operation of the virtual object and identify the 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 among the placement surfaces, determine the placement posture of the virtual object in the three-dimensional space.
[0052] Specifically, after loading the items to be placed into the three-dimensional space, the display angle of the three-dimensional space is adjusted, and the recognition tool is used to parse the attributes of each object in the three-dimensional space, such as: the ground, wall, ceiling, desktop, screen surface, box surface, etc., to determine whether the object allows the placement of items based on the attributes, and when it is determined that the object allows the placement of items, the placement surface of the object is determined. It should be noted that the objects in the three-dimensional space mentioned in the embodiments of the present invention can be physical objects, that is, objects initially contained in the three-dimensional space, such as the ground, wall, ceiling, and desktop mentioned above, or they can be the placement surfaces provided by the virtual object surface after the virtual object is placed in the three-dimensional space, such as the screen surface after the screen is placed in the three-dimensional space, the box surface after the box is placed in the three-dimensional space, etc. The embodiments of the present invention do not make specific limitations, as long as the individual surface in the three-dimensional space is the object mentioned in the embodiments of the present invention.
[0053] In addition, the placement surface of the embodiment of the present invention can be any plane or curved surface, as long as there is some space on the placement surface for placing objects, for example, there is some flat or concave space on the spherical placement surface. Of course, the user can also manually select the placement surface of the physical object from the three-dimensional space.
[0054] After the user enters the simulated placement page, the user has the authority to manually move the virtual object corresponding to the item. At the same time, the item placement system will also monitor the user's movement operation on the virtual object. If the virtual object is monitored to intersect with one or more of the above-identified placement surfaces in the three-dimensional space, the intersecting placement surface will be used as the 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 intention to place the item can be predicted and predicted. Then, according to the position intention, for example, it 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 item category of the virtual object, the placement position and rotation angle of the virtual object in the three-dimensional space that fits one or more target placement surfaces are comprehensively determined.
[0055] Exemplarily, based on the user's placement intention of hanging the virtual object on the ceiling, the item category of the virtual object is obtained as 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 that fits the ceiling is calculated, and then according to the current angle of the lamp, the lamp is synchronously adjusted according to the angle of the three-dimensional space, and the placement angle is calculated. The placement position and rotation orientation angle constitute the placement posture of the lamp virtual object in the three-dimensional space.
[0056] It is understandable that when an intersection event is detected between a virtual object and a target placement surface, the authenticity or rationality of the intercepted intersection event can be verified first to determine whether there is a conflict between the item category of the virtual object and the placement attribute corresponding to the target placement surface, such as an intersection event between a virtual object of the floor fan category and the target placement surface of the wall, or an intersection event between a virtual object of the TV category and the target placement surface of the ceiling. If there is a conflict between the item category and the placement attribute corresponding to the target placement surface, it is equivalent to a verification failure, and the intercepted intersection event is ignored. Only when the verification passes, the intersection event is considered.
[0057] Step S103: determining a placement position of the virtual object according to the placement gesture, so that one or more surfaces of the virtual object fit with the one or more target placement surfaces.
[0058] 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 fitted with the target placement surface in the three-dimensional space. It can be understood that the fitting of the embodiment of the present invention can be a conventional fitting of one surface of the virtual object with one target placement surface, a fitting of multiple surfaces of the virtual object with multiple target placement surfaces, or a non-conventional fitting of one surface of the virtual object with multiple target placement surfaces, such as a cylindrical trash can suspended and fixed at the corner where two walls intersect, or a non-conventional fitting of multiple surfaces of the virtual object with one target placement surface, such as placing a multi-faceted basin on the concave target placement surface in the middle of the washbasin.
[0059] According to an embodiment of the present invention, the method further includes: pre-moving the virtual object according to the placement gesture to display the placement method of the virtual object; and determining the placement position of the virtual object in response to receiving an instruction to place the virtual object according to the placement gesture.
[0060] Specifically, in order to ensure that the placement position is the user's intended position to the greatest extent, the embodiment of the present invention also provides a human-computer interaction interface. Before the object 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, and the virtual object is first moved on the copy according to the placement posture to obtain the placement method of the virtual object, and the placement method is fed back to the user. The placement method of the embodiment of the present invention can be to feed back the diagram of the virtual object after the copy is moved to the user in the form of a display diagram for the user to preview. If the user is not satisfied with the placement method, the virtual object can be moved again to send an instruction to the object placement system to recalculate the placement posture, and the object placement system recalculates according to the newly monitored intersection event. If the user is satisfied with the placement method, a placement instruction is sent to place the virtual object according to the placement posture. After receiving the instruction, the object placement system determines the placement position of the virtual object and moves the virtual object in the formal three-dimensional space diagram according to the placement posture to achieve the purpose of automatic fitting placement.
[0061] Figure 2 It is a schematic diagram of the virtual object pre-movement according to the placement posture in an embodiment of the present invention. The object placement system calculates the placement posture, and before preparing to move the virtual object according to the placement posture, a copy of the current three-dimensional space view is created, and the virtual object is moved on the copy according to the placement posture, such as the gray cube virtual object in the figure is moved to the blue position, to achieve pre-movement on the three-dimensional space copy, and the image after moving on the copy is fed back to the user as the placement method of the virtual object for the user to preview.
[0062] Figure 3 is a flow chart of a method for placing virtual items according to a reference embodiment of the present invention. As another embodiment of the present invention, Figure 3 As shown, the method for placing the virtual item may include:
[0063] Step S301: Acquire a three-dimensional space, and load a virtual object corresponding to a virtual item into the three-dimensional space.
[0064] Step S302: monitoring the movement operation of the virtual object, identifying the position and size of the placement surface of the object in the three-dimensional space, and the placement surface monitoring the collision action or the approach action.
[0065] Specifically, for the placement surfaces of each object in the three-dimensional space on which other items can be placed, in order to improve the efficiency of subsequent monitoring of intersection events and 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. The collider not only has the ability to monitor collisions with other objects, but also has the ability to monitor the degree of proximity with other objects when other objects move toward the placement surface, and determines that a proximity action has occurred when the degree of proximity is less than a preset proximity threshold. For example, the proximity distance between other objects and the placement surface is 0.5 cm, which is less than the preset proximity threshold of 1 cm, so the placement surface monitors the proximity action.
[0066] Step S303: Determine a bounding volume of the virtual object according to the shape and size of the virtual object, and generate an intersection event when the bounding volume collides with or approaches one or more target placement surfaces among the placement surfaces.
[0067] Specifically, based on the colliders constructed for each placement surface, a trigger that can trigger the collider is established on the periphery of the virtual object. Specifically, a bounding volume that is consistent with the shape of the virtual object and appropriately enlarged in size is established on the outside of the virtual object, for example, the size is enlarged by 0.1 times, and the bounding volume is given the attributes of the trigger. The bounding volume is encapsulated on the outside of the virtual object. Usually, the center of the bounding volume coincides with the center of the virtual object. In this way, the collider only needs to focus on monitoring the actions of the trigger, alleviating the resource consumption of monitoring.
[0068] According to one embodiment of the present invention, determining the bounding volume of the virtual object based on the shape and size of the virtual object includes: simplifying the shape of the virtual object to obtain the shape of the bounding volume of the virtual object; and magnifying the size of the virtual object according to a preset magnification factor based on the shape of the bounding volume to obtain the bounding volume of the virtual object.
[0069] Specifically, in order to facilitate the subsequent monitoring of the movement operation of the virtual object and simplify the internal judgment logic of the program, the embodiment of the present invention uses a rectangular parallelepiped as a general simplified enclosing body shape. As long as the shape of the virtual object is a long strip, the shape of the enclosing body to be simplified is defined as a rectangular parallelepiped. Of course, if the shape of the virtual object is a spherical body, the shape of the simplified enclosing body is a sphere. The shape of the simplified enclosing body is still determined according to the shape of the virtual object. The embodiment of the present invention adopts a simplified enclosing body shape with a simple structure, which not only simplifies the code, but also reduces the performance overhead of the system. Finally, according to the shape of the enclosing body, according to the preset magnification factor, the various sizes of the virtual object are enlarged to obtain an enclosing body that can cover the virtual object and has a simple structure. For example, for an enclosing body determined to be in the shape of a rectangular parallelepiped, the virtual object is enlarged according to the magnification factor of 0.2 times set in the three axes of x, y, and z to obtain the enclosing body of the virtual object.
[0070] Step S304: In response to an intersection event occurring when the bounding volume collides with one or more target placement surfaces among the placement surfaces, a placement posture of the virtual object in the three-dimensional space is determined.
[0071] Specifically, when the user performs a moving operation on the virtual object in the three-dimensional space, such as moving, rotating, scaling, etc., the collider of each placement surface monitors in real time whether there is a collision or proximity between the bounding volume trigger in the three-dimensional space and the virtual object, and triggers the intersection event between the bounding volume and the target placement surface when a collision or proximity is detected. Then, the placement posture of the virtual object in the three-dimensional space is determined based on the specific intersection event.
[0072] The embodiments of the present invention use a collider with the ability to monitor collision actions or proximity actions built based on the placement surface, and a bounding volume trigger that triggers the collider, which simplifies the implementation logic of the code. The structure of the bounding volume simplified based on the shape of the virtual object further reduces the resource overhead of the system and promotes the specific implementation of the fitting placement solution of the virtual items of the present invention in three-dimensional space.
[0073] Step S305: Determine the placement position of the virtual object according to the placement gesture, so that one or more surfaces of the virtual object fit with the one or more target placement surfaces.
[0074] According to another embodiment of the present invention, after moving the virtual object according to the placement gesture, the method further includes: adding placement attributes to the virtual object, each surface in the virtual object listens for collision actions or fit actions, and when a collision action or fit action is listened, the surface of the virtual object is used as the target placement surface.
[0075] Specifically, considering that the virtual object has been integrated with the three-dimensional space after being moved and placed according to the placement gesture, it should become an object in the three-dimensional space, that is, the surface of the virtual object is also allowed to be used as the placement surface for other subsequent objects to be placed. After the virtual object is moved according to the placement gesture, a placement attribute is added to the virtual object, and the ability to listen to collision actions or proximity actions is given to each surface in the virtual object, thereby achieving the purpose of converting the virtual object into an object in the three-dimensional space. In this way, multiple virtual objects can be stacked and placed in three-dimensional space one after another, which improves the adaptability of the placement method. For example, after the virtual object of a table is placed on the ground placement surface, the table is converted into an object in the three-dimensional space, and then the virtual object of the vase is placed on the table placement surface.
[0076] The embodiment of the present invention also provides a specific method for calculating the placement posture of a virtual object in a three-dimensional space. Figure 4 is a flow chart of a method for calculating a placement posture according to an embodiment of the present invention. As another embodiment of the present invention, Figure 4 As shown, the calculation method of the placement posture may include:
[0077] Step S401: Determine an intersection mode corresponding to an intersection event according to an intersection event occurring between the virtual object and one or more target placement surfaces among the placement surfaces.
[0078] Specifically, when an intersection event occurs between a virtual object and a placement surface in three-dimensional space, the object placement system collects the collision actions of the collider and the bounding volume trigger to obtain one or more target placement surfaces that the virtual object collides with in three-dimensional space. Then, the intersection mode corresponding to this intersection event is determined based on the number of target placement surfaces. Normally, the number of target placement surfaces is one face, two faces, three faces or more. It can be understood that the intersection of a virtual object with different numbers of target placement surfaces represents different placement intentions of the user. The embodiment of the present invention determines the corresponding intersection mode based on the number of target placement surfaces, and then predicts the user's placement intention.
[0079] According to one embodiment of the present invention, the intersection mode includes: a single-sided intersection mode in which the virtual object intersects with one target placement surface in the placement surface, a double-sided intersection mode in which the virtual object intersects with two target placement surfaces in the placement surface, and a three-sided intersection mode in which the virtual object intersects with three target placement surfaces in the placement surface.
[0080] Specifically, according to the actual placement of virtual objects and the positional relationship between the placement surfaces in the three-dimensional space, when a virtual object intersects with more than three target placement surfaces, the embodiment of the present invention considers that it is unreasonable, which may be caused by insufficient space, overlapping placement surface recognition, etc., and ignores the intersection event of more than three target placement surfaces. Correspondingly, there are three corresponding intersection modes for the remaining intersections with one target placement surface, intersections with two target placement surfaces, and intersections with three target placement surfaces. They are: a single-sided intersection mode (also called an intersection mode) in which a virtual object intersects with one target placement surface in each placement surface, a double-sided intersection mode (also called an intersection line mode) in which a virtual object intersects with two target placement surfaces in each placement surface, and a three-sided intersection mode (also called a corner point mode) in which a virtual object intersects with three target placement surfaces in each placement surface.
[0081] For example, Figure 5 It is a schematic diagram of the intersection events between the virtual objects of the embodiment of the present invention and the various placement surfaces in the three-dimensional space. The figure shows different intersection events corresponding to 6 virtual objects. The placement surfaces in the three-dimensional space include a ground, two walls and a ceiling. The colored highlighted box represents the virtual object, and the gray box outside it is the constructed bounding volume. It can be seen from the figure that virtual objects 1, 3, 4 and 5 are in a single-sided intersection mode or also called an intersection mode that intersects with a target placement surface, virtual object 2 is a double-sided intersection mode or also called an intersection mode that intersects with two target placement surfaces (ground + wall), and virtual object 6 is a three-sided intersection mode or also called a corner mode that intersects with three target placement surfaces (ground + wall + wall).
[0082] Step S402: Calculate the placement posture of the virtual object in the three-dimensional space according to the intersection mode.
[0083] Specifically, according to the intersection mode determined above, the user's intention to place the virtual object in the three-dimensional space is predicted, such as whether to place it on the ground, against a wall, or against a corner. According to the placement intention, combined with the size, angle and other information of the virtual object, the placement position of the virtual object in the three-dimensional space and the corresponding rotation orientation angle are calculated.
[0084] According to one embodiment of the present invention, the placement posture of the virtual object in the three-dimensional space is calculated according to the intersection mode, including: in response to the intersection mode being one of the single-sided intersection mode, the double-sided intersection mode and the three-sided intersection mode, determining the placement mode of the virtual object; and determining the placement posture of the virtual object according to the placement mode and the surface normal of the target placement surface.
[0085] Specifically, according to the intersection mode determined above, the corresponding placement mode is predicted, and then according to the determined placement mode, the surface normal of the target placement surface is referred to to determine the orientation and position of the virtual object in the three-dimensional space to obtain the placement posture of the virtual object.
[0086] According to another embodiment of the present invention, the placement posture 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, determining the projection coordinates of the center coordinates of the virtual object in the three-dimensional space, and combining the surface normal of the target placement surface to calculate the placement posture of the virtual object in the three-dimensional space.
[0087] Specifically, an embodiment of the present invention provides a method for calculating a placement posture by projection. According to the intersection mode determined above, a corresponding placement mode is predicted, and then according to the corresponding placement mode, the projection position of the center coordinates of the virtual object in the three-dimensional space is determined, and then the projection coordinates of the center coordinates of the virtual object in the three-dimensional space are obtained to calculate the placement position of the virtual object in the three-dimensional space. Finally, according to the surface normal of the target placement surface, the rotation orientation angle of the virtual object in the three-dimensional space is calculated, and the placement position and rotation orientation angle of the virtual object constitute the placement posture.
[0088] According to another embodiment of the present invention, the placement mode corresponding to the single-surface intersection mode is a face-to-face placement mode; in response to the intersection mode being the single-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 combined 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, determining the projection coordinates of the center coordinates of the virtual object on the target placement surface; according to the surface normal of the target placement surface, adjusting the height of the projection coordinates to calculate the face-to-face placement position of the virtual object; in response to the target placement surface being perpendicular to the standard surface, determining the projection coordinates of the center coordinates of the virtual object on the target placement surface; according to the surface normal of the target placement surface, adjusting the depth of the projection coordinates to calculate the face-to-face placement position of the virtual object; and according to the surface normal of the target placement surface, calculating the rotation orientation matrix of the virtual object when it is face-to-face placed in the three-dimensional space.
[0089] Specifically, when the intersection mode is the intersection mode, the virtual object intersects with a target placement surface in the three-dimensional space, indicating that the user wants to place the object on the target placement surface, which is the surface placement mode. At this time, it is only necessary to place the surface where the object and the target placement surface intersect with the target placement surface. Figure 5 It can be seen that the target placement surface may be the ground, the ceiling, or the wall. Different target placement surfaces have different methods for calculating the placement posture. Therefore, it is necessary to first determine the position and direction of the target placement surface in the three-dimensional space. In the embodiment of the present invention, the ground plane is used as the standard plane. The specific position and direction of the 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 identified.
[0090] Of course, in addition to the above-mentioned method of simultaneously making judgments when identifying the placement surfaces of each physical object in the three-dimensional space, the target placement surface can also be judged before calculating the projection coordinates of the center coordinates of the virtual object in the three-dimensional space. In the embodiment of the present invention, the target placement surface parallel to the ground plane is defined as a "plane", and the target placement surface perpendicular to the ground plane is defined as a "vertical plane".
[0091] Furthermore, when the target placement surface is a "plane" (ground or ceiling), calculate the projection coordinates p of the center coordinates of the virtual object on the target placement surface, set the height of the virtual object with the bounding volume to height (that is, 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, so the position of the projection point is that the virtual object is half embedded under the target placement surface, so the height value of the projection coordinate needs to be adjusted. For the ground, move the height by height / 2 along the direction of the surface normal. For the ceiling, move the height by height / 2 along the direction of the surface normal. The surface placement position of the virtual object is obtained as follows:
[0092] ,
[0093] In addition, when the target placement surface is a "plane", considering that the default orientation of the virtual object in three-dimensional space is the surface normal direction of the target placement surface, there is no need to adjust the rotation angle, and only the surface placement position needs to be calculated.
[0094] When the target placement surface is a "vertical surface" (wall), calculate the projection coordinates p of the center coordinates of the virtual object on the target placement surface, set the depth of the virtual object with the bounding volume to depth (that is, the z direction), and the surface normal of the target placement surface is , similar to the method of adjusting the height of the "plane" mentioned above, this time you only need to adjust the depth value of the projection coordinates, move the depth by depth / 2 along the direction of the surface normal, and get the surface placement position of the virtual object:
[0095] ,
[0096] Additionally, for the "vertical plane", set the initial orientation of the virtual object to (0,0,1), combined with the final orientation as the face normal In this embodiment of the present invention, quaternion quat ( , ) Calculate the rotational orientation matrix R of the virtual object when it is placed in close contact with the target placement surface. When the virtual object is subsequently moved according to the placement posture, the orientation of the virtual object is first adjusted to the standard orientation according to the rotational orientation matrix, and then moved according to the placement position to achieve close contact placement of the virtual object.
[0097] According to another embodiment of the present invention, the placement mode corresponding to the double-surface intersection mode is the edge placement mode; in response to the intersection mode being the double-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 combined 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 that the two target placement surfaces are respectively parallel or perpendicular to a preset standard surface; or are both perpendicular to the standard surface; in response to the two target placement surfaces being respectively parallel or perpendicular to the standard surface, determining the projection coordinates of the center coordinates of the virtual object on the intersection of the two target placement surfaces; according to the surface normals of the two target placement surfaces, The projection coordinates are adjusted in height and depth to obtain the edge placement position of the virtual object by calculation, and the rotation orientation matrix of the virtual object when placed edge to edge in the three-dimensional space is calculated according to the surface normal of the target placement surface perpendicular to the standard plane; in response to the two target placement surfaces being perpendicular to the standard plane, the projection coordinates of the center coordinates of the virtual object on the intersection of the two target placement surfaces are determined; according to the surface normals of the two target placement surfaces, the projection coordinates are adjusted in depth and width to obtain the edge placement position of the virtual object by calculation; and according to the surface normal of the target placement surface perpendicular to the standard plane, the rotation orientation matrix of the virtual object when placed edge to edge in the three-dimensional space is calculated.
[0098] Specifically, when the intersection mode is the intersection mode, the virtual object intersects with two target placement surfaces in the three-dimensional space, indicating that the user wants to place the object at the intersection of the two target placement surfaces, and stick to the intersection line of the two target placement surfaces, which is the edge placement mode. At this time, the projection position of the virtual object in the three-dimensional space is the intersection line. In addition, through the above Figure 5It can be seen that the target placement surface may be the ground and the wall, the ceiling and the wall, or two adjacent walls. The method of calculating the placement posture is different for the target placement surface in different positions and directions in the three-dimensional space. Therefore, it is first necessary to determine the directions of the two target placement surfaces in the three-dimensional space. In the embodiment of the present invention, the ground plane is used as the standard plane, and the target placement surface parallel to the ground plane is designated as a "plane", and the target placement surface perpendicular to the ground plane is designated as a "vertical plane".
[0099] When the two target placement surfaces are "plane" and "vertical", calculate the projection coordinates p of the center coordinates of the virtual object on the intersection of the two target placement surfaces, set the depth of the virtual object with the bounding volume to depth (that is, the z direction), the height to height (that is, the y direction), and the surface normal of the "vertical" surface to , and the surface normal vector of the “plane” is , similar to the idea of the above adjustment method, at this time, the depth value and height value of the projection coordinate need to be adjusted according to the corresponding surface normal direction, and the line placement position of the virtual object is obtained as follows:
[0100] .
[0101] Additionally, for the "vertical plane", set the initial orientation of the virtual object to (0,0,1), combined with the final orientation as the face normal In this embodiment of the present invention, quaternion quat ( , ) Calculate the rotational orientation matrix R of the virtual object when it is placed in line with the target placement surface. When the virtual object is subsequently moved according to the placement posture, the orientation of the virtual object is first adjusted to the standard orientation according to the rotational orientation matrix R, and then moved according to the placement position to achieve line placement of the virtual object.
[0102] When the two target placement surfaces are "vertical plane" and "vertical plane", calculate the projection coordinates p of the center coordinates of the virtual object on the intersection of the two target placement surfaces, set the depth of the virtual object with the bounding volume to depth (that is, the z direction) and the width to width (that is, the x direction). Similar to the idea of the above adjustment method, the depth value and width value of the projection coordinates need to be adjusted according to the corresponding surface normal direction, and the line placement position of the virtual object is obtained as follows:
[0103] .
[0104] In addition, for the case where both target placement surfaces are "vertical planes", the embodiment of the present invention also needs to select a standard orientation from the two "vertical planes" in order to determine the rotation orientation matrix of the virtual object. The embodiment of the present invention compares the angle between the user's viewing direction in three-dimensional space and the surface normals of the two target placement surfaces, and selects the target surface normal from the surface normals of the two target placement surfaces as the standard orientation for subsequent calculation of the rotation matrix according to the comparison result. The specific method for determining the target surface normal is to select the maximum angle from the two angles formed by the user's viewing direction and the two surface normals, and use the surface normal of the target placement surface corresponding to the maximum angle as the target surface normal. Because the user's viewing direction is opposite to the directions of the two surface normals, the maximum angle is taken.
[0105] Furthermore, the target surface normal is used as the target standard orientation of the virtual object. (0,0,1), using a similar method as above, the rotation matrix R of the virtual object when it is placed in line with the target placement surface is calculated through quaternion. When the virtual object is subsequently moved according to the placement posture, the orientation of the virtual object is first adjusted to the standard orientation according to the rotation matrix R, and then moved according to the placement position to achieve the line placement of the virtual object.
[0106] According to another embodiment of the present invention, the placement mode corresponding to the three-plane intersection mode is a corner placement mode; in response to the intersection mode being the three-plane 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 combined with the surface normal of the target placement surface, the placement posture of the virtual object in the three-dimensional space is calculated, including: determining the projection coordinates of the center coordinates of the virtual object on the corner point composed of the three target placement surfaces; according to the surface normals of the three target placement surfaces, the projection coordinates are adjusted in width, height and depth to calculate the corner placement position of the virtual object, and according to the surface normal of the target placement surface, the rotation orientation matrix of the virtual object when placed at the corner in the three-dimensional space is calculated.
[0107] Specifically, when the intersection mode is the corner point mode, the virtual object intersects with the three target placement surfaces in the three-dimensional space, indicating that the user wants to place the object at the intersection of the three target placement surfaces, and stick it to the corner point of the three target placement surfaces (that is, the point where the three target placement surfaces intersect), which is the corner placement mode. At this time, the projection position of the virtual object in the three-dimensional space is the corner point. In addition, through the above Figure 5 It can be seen that at this time, the three target placement surfaces are ground + wall + wall, or ceiling + wall + wall. The embodiment of the present invention takes the ground plane as the standard plane, and stipulates that the target placement surface parallel to the ground plane is a "plane", and the target placement surface perpendicular to the ground plane is a "vertical plane".
[0108] Then the positional relationship of the three target placement surfaces is "plane" + "vertical plane" + "vertical plane". In this case, calculate the projection coordinates p of the center coordinates of the virtual object on the corner point composed of the three target placement surfaces, set the depth of the virtual object with the bounding volume to depth (that is, z direction), height to height (that is, y direction), and width to width (that is, x direction). Similar to the idea of the above adjustment method, the depth value, height value and width value of the projection coordinates need to be adjusted according to the corresponding surface normal direction. The corner placement position of the virtual object is:
[0109]
[0110] In addition, for "plane" + "vertical plane" + "vertical plane", similar to the above method of determining the target surface normal from the surface normals of the two "vertical planes", by comparing the angle between the user's viewing direction in three-dimensional space and the surface normals of the two "vertical planes", the surface normal of the "vertical plane" corresponding to the maximum angle is selected as the target surface normal, and the target surface normal is used as the target standard orientation of the virtual object. (0,0,1), the rotation matrix R of the virtual object when it is placed in contact with the target placement surface is calculated through quaternion.
[0111] It should be noted that in order to facilitate the alignment calculation between matrices, the matrix for uniformly defining the placement posture of the virtual object is expressed as , where R is the rotation matrix and t is the placement position.
[0112] Finally, according to various intersection patterns, the placement posture of the virtual object in the three-dimensional space is calculated. When moving the virtual object according to the placement posture, 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 to achieve the fitting placement of the virtual object in the three-dimensional space.
[0113] Figure 6 It is a schematic diagram of the virtual object of an embodiment of the present invention being placed in a three-dimensional space according to the calculated placement posture. It can be seen from the figure that the virtual object initially intersects with a "vertical plane" in the three-dimensional space. The intersection mode is the intersection mode, and the corresponding placement mode is the surface placement mode, that is, placement that fits the "vertical plane". First, determine the projection coordinates of the center coordinates of the virtual object on the target placement surface ("vertical plane"), and perform depth adjustment on the projection coordinates according to the surface normal of the target placement surface, and calculate the surface placement position t of the virtual object; then calculate the rotation orientation matrix R of the surface placement according to the surface normal of the "vertical plane" and the current orientation of the virtual object, as shown Figure 6The white background in the figure is a diagram for calculating the placement posture (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 to achieve the surface placement of the virtual object.
[0114] Figure 7 The figure is a schematic diagram of the overall process of the method for placing virtual items in an embodiment of the present invention. A three-dimensional space is obtained, and the placement surfaces of each physical object in the three-dimensional space are identified, as well as the position attributes ("plane", "vertical plane") of each placement surface in the three-dimensional space, and the ability to monitor collision actions is given to each placement surface. A virtual object corresponding to the item to be placed is loaded in the three-dimensional space, and an enclosing volume of the virtual object is constructed. Monitor the user's movement operation on the virtual object, respond to the intersection event between the enclosing volume of the virtual object and one or more target placement surfaces in each placement surface, and determine, according to the number of target placement surfaces where the intersection event occurs, the intersection mode corresponding to the intersection event, as 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, and at the same time determine whether the position attribute of the target placement surface in each intersection mode in the three-dimensional space is "plane" or "vertical plane", specifically, the one target placement surface corresponding to the intersection point mode is "plane" or "vertical plane"; the two target placement surfaces corresponding to the intersection line mode are "plane" + "vertical plane" or "vertical plane" + vertical plane; the three target placement surfaces corresponding to the corner point mode are "plane" + "vertical plane" + "vertical plane".
[0115] Furthermore, according to different intersection modes, the placement modes corresponding to the intersection modes, and the position attributes of the target placement surfaces of each intersection mode in three-dimensional space, 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 to calculate the fitting placement position of the virtual object. At the same time, according to the current orientation of the virtual object and the surface normal of the "vertical surface" in the target placement surface, the rotation orientation matrix of the virtual object in the three-dimensional space is calculated, and the placement posture of the virtual object is obtained according to the fitting placement position and the rotation orientation matrix. 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 a fitting manner with one or more target placement surfaces.
[0116] Figure 8 Schematic diagram of the main modules of the device for placing items according to an embodiment of the present invention. Figure 8 As shown, the device 800 for placing an item mainly includes a virtual item loading module 801 , a placement posture determining module 802 and a virtual item placing module 803 .
[0117] A virtual item loading module 801 is used to obtain a three-dimensional space and load a virtual object corresponding to a virtual item in the three-dimensional space;
[0118] a placement posture determination module 802, configured to monitor a movement operation of the virtual object and identify a placement surface of the object in the three-dimensional space; and determine a placement posture of the virtual 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;
[0119] The virtual object placement module 803 is used to determine the placement position of the virtual object according to the placement gesture, so that one or more surfaces of the virtual object fit with the one or more target placement surfaces.
[0120] According to an embodiment of the present invention, the placement posture determination module 802 is further used to: identify the position and size of the placement surface of the object in the three-dimensional space, and the placement surface monitors the collision action or the approach action.
[0121] According to another embodiment of the present invention, the device for placing the object 800 further includes a bounding volume generation module (not shown in the figure), which is used to: after loading the virtual object corresponding to the virtual object in the three-dimensional space, determine the bounding volume of the virtual object according to the shape and size of the virtual object, and generate an intersection event when the bounding volume collides with or approaches one or more target placement surfaces among the placement surfaces.
[0122] According to another embodiment of the present invention, the placement posture determination module 802 is further used to: determine an intersection pattern corresponding to an intersection event occurring between the virtual object and one or more target placement surfaces among the placement surfaces; and calculate the placement posture of the virtual object in the three-dimensional space based on the intersection pattern.
[0123] According to another embodiment of the present invention, the intersection mode includes: a single-sided intersection mode in which the virtual object intersects with one target placement surface in the placement surface, a double-sided intersection mode in which the virtual object intersects with two target placement surfaces in the placement surface, and a three-sided intersection mode in which the virtual object intersects with three target placement surfaces in the placement surface; the placement posture determination module 802 is further used to: determine the placement mode of the virtual object in response to the intersection mode being one of the single-sided intersection mode, the double-sided intersection mode and the three-sided intersection mode; determine the placement posture of the virtual object according to the placement mode and the surface normal of the target placement surface.
[0124] According to another embodiment of the present invention, the placement posture determination module 802 is also used to: determine the projection coordinates of the center coordinates of the virtual object in the three-dimensional space based on the placement mode, and calculate the placement posture of the virtual object in the three-dimensional space in combination with the surface normal of the target placement surface.
[0125] According to another embodiment of the present invention, the placement mode corresponding to the single-surface intersection mode is a face-to-face placement mode; the placement posture determination module 802 is also used 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 the projection coordinates of the center coordinates of the virtual object on the target placement surface; according to the surface normal of the target placement surface, adjust the height of the projection coordinates to calculate the face-to-face placement position of the virtual object; in response to the target placement surface being perpendicular to the standard surface, determine the projection coordinates of the center coordinates of the virtual object on the target placement surface; according to the surface normal of the target placement surface, adjust the depth of the projection coordinates to calculate the face-to-face placement position of the virtual object; and according to the surface normal of the target placement surface, calculate the rotation orientation matrix of the virtual object when it is placed face-to-face in the three-dimensional space.
[0126] According to another embodiment of the present invention, the placement mode corresponding to the double-surface intersection mode is an edge placement mode; the placement posture determination module 802 is further used to: determine whether the two target placement surfaces are parallel or perpendicular to a preset standard surface, respectively; or are perpendicular to both of the standard surfaces; in response to the two target placement surfaces being parallel or perpendicular to the standard surface, respectively, determine the projection coordinates of the center coordinates of the virtual object on the intersection of the two target placement surfaces; according to the surface normals of the two target placement surfaces, adjust the projection coordinates in height and depth to calculate the edge placement position of the virtual object, and according to the surface normal of the target placement surface perpendicular to the standard surface, calculate the rotation orientation matrix of the virtual object when it is placed edge to edge in the three-dimensional space; in response to the two target placement surfaces being perpendicular to the standard surface, determine the projection coordinates of the center coordinates of the virtual object on the intersection of the two target placement surfaces; according to the surface normals of the two target placement surfaces, adjust the projection coordinates in depth and width to calculate the edge placement position of the virtual object; and according to the surface normal of the target placement surface perpendicular to the standard surface, calculate the rotation orientation matrix of the virtual object when it is placed edge to edge in the three-dimensional space.
[0127] According to another embodiment of the present invention, the placement mode corresponding to the three-surface intersection mode is a corner placement mode; the placement posture determination module 802 is also used to: determine the projection coordinates of the center coordinates of the virtual object on the corner points formed by the three target placement surfaces; according to the surface normals of the three target placement surfaces, adjust the projection coordinates in width, height and depth to calculate the corner placement position of the virtual object, and according to the surface normals of the target placement surfaces, calculate the rotation orientation matrix of the virtual object when it is placed at the corner in the three-dimensional space.
[0128] According to another embodiment of the present invention, the bounding volume generation module (not shown in the figure) is further used to: simplify 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, enlarge the size of the virtual object according to a preset magnification factor to obtain the bounding volume of the virtual object.
[0129] According to another embodiment of the present invention, the virtual item placement device 800 further includes a placement attribute adding module (not shown in the figure), which is used to: after determining the placement position of the virtual object according to the placement posture, add placement attributes to the virtual object, each surface in the virtual object listens for collision actions or proximity actions, and when a collision action or proximity action is listened, the surface of the virtual object is used as the target placement surface.
[0130] According to another embodiment of the present invention, the virtual item placement device 800 further includes a human-computer interaction module (not shown in the figure), which is used to: pre-move the virtual object according to the placement posture to display the placement method of the virtual item; and determine the placement position of the virtual object in response to receiving an instruction to place the virtual item according to the placement posture.
[0131] Fig. 9 is an exemplary system architecture diagram to which embodiments of the present invention can be applied.
[0132] like Fig. 9 As shown, system architecture 900 may include terminal devices 901, 902, 903, network 904 and server 905. Network 904 is used to provide a medium for communication links between terminal devices 901, 902, 903 and server 905. Network 904 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0133] Users can use terminal devices 901, 902, 903 to interact with server 905 through network 904 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 901, 902, 903, such as item placement applications, etc. (only as an example).
[0134] The terminal devices 901 , 902 , and 903 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.
[0135] The server 905 may be a server that provides various services, such as a background management server that supports the placement of items by users using the terminal devices 901, 902, and 903 (for example only). The background management server may obtain a three-dimensional space, load a virtual object corresponding to a virtual item in the three-dimensional space; monitor the movement operation of the virtual object, and identify the placement surface of the object in the three-dimensional space; determine the placement posture of the virtual 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; determine the placement position of the virtual object according to the placement posture, so that one or more surfaces of the virtual object fit with the one or more target placement surfaces, and feed back the processing result (such as the placement result, etc. - for example only) to the terminal device.
[0136] It should be noted that the method for placing virtual items provided in the embodiment of the present invention is generally executed by the server 905 , and accordingly, the device for placing virtual items is generally disposed in the server 905 .
[0137] It should be understood that Fig. 9 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0138] Reference below Fig.10 , Fig.10 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. Fig.10 The terminal device or server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0139] like Fig.10 As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage part 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the 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.
[0140] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.
[0141] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1009, and / or installed from the removable medium 1011. When the computer program is executed by the central processing unit (CPU) 1001, the above-mentioned functions defined in the system of the present invention are executed.
[0142] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination thereof.
[0143] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0144] The units involved in the embodiments of the present invention may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes: a virtual item loading module, a placement posture determination module and a virtual item placement module.
[0145] The names of these modules do not, in some cases, constitute a limitation on the modules themselves. For example, a virtual item loading module may also be described as a "module for acquiring a three-dimensional space and loading virtual objects corresponding to virtual items in the three-dimensional space."
[0146] On the other hand, the present invention also provides a computer-readable medium, which may be included in the device described in the embodiment; or may exist independently without being assembled into the device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by a device, the device includes: acquiring a three-dimensional space, loading a virtual object corresponding to a virtual item in the three-dimensional space; monitoring movement operations on the virtual object, and identifying the placement surface of the object in the three-dimensional space; determining the placement posture of the virtual 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 the placement position of the virtual object according to the placement posture, so that one or more surfaces of the virtual object fit with the one or more target placement surfaces.
[0147] The technical solution according to the embodiment of the present invention has the following advantages or beneficial effects: by acquiring the three-dimensional space, a virtual object corresponding to the virtual item is loaded in the three-dimensional space; the movement operation of the virtual object is monitored, and the 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, the placement posture of the virtual object in the three-dimensional space is determined; 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 aligned with one or more target placement surfaces. The technical solution realizes an automatic and accurate item placement method, and the position where the virtual object needs to be placed in a fitting manner is accurately calculated according to the movement operation of the virtual object, which not only meets the need for fitting placement, but also simplifies the placement process, eliminates manual adjustment, and improves the placement efficiency of virtual items. Correspondingly, the fusion efficiency of virtual objects and the real three-dimensional environment is also improved.
[0148] The specific implementation methods described herein do not constitute limitations on the scope of protection of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.
Claims
1. A method for placing a virtual item, characterized in that: include: Acquire a three-dimensional space, and load a virtual object corresponding to the virtual item into the three-dimensional space; Monitoring a movement operation of 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; Wherein, in response to an intersection event between the virtual object and one or more target placement surfaces among the placement surfaces, determining the placement 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 between the virtual object and one or more target placement surfaces among the placement surfaces; and calculating the placement posture of the virtual object in the three-dimensional space according to the intersection mode; The intersection modes include: a single-surface intersection mode in which the virtual object intersects with one target placement surface among the placement surfaces, a double-surface intersection mode in which the virtual object intersects with two target placement surfaces among the placement surfaces, and a three-surface intersection mode in which the virtual object intersects with three target placement surfaces among the placement surfaces; The placement position of the virtual object is determined according to the placement gesture, so that one or more surfaces of the virtual object are aligned with the one or more target placement surfaces.
2. The method according to claim 1, characterized in that Identifying a placement surface of the object in the three-dimensional space, including: The position and size of a placement surface of the object in the three-dimensional space are identified, and the placement surface monitors a collision action or a proximity action.
3. The method according to claim 2, characterized in that After loading the virtual object corresponding to the virtual item in the three-dimensional space, the method further includes: 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 among the placement surfaces.
4. The method according to claim 1, characterized in that: Calculating the placement posture of the virtual object in the three-dimensional space according to the intersection mode includes: 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 a placement posture of the virtual object according to the placement mode and a surface normal of the target placement surface.
5. The method according to claim 4, characterized in that Determining the placement posture of the virtual object according to the placement mode and the surface normal of the target placement surface includes: 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.
6. The method according to claim 5, characterized in that The placement mode corresponding to the single-surface intersection mode is the veneer placement mode; In response to the intersection mode being the single-surface intersection mode, based on the placement mode, determining the projection coordinates of the center coordinates of the virtual object in the three-dimensional space, 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, including: 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, determining the projection coordinates of the center coordinates of the virtual object on the target placement surface; adjusting the projection coordinates in height according to the surface normal of the target placement surface, and calculating the surface placement position of the virtual object; 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 depth-adjusted to obtain the surface-to-surface placement position of the virtual object by calculation; and according to the surface normal of the target placement surface, the rotation orientation matrix of the virtual object when it is surface-to-surface placed in the three-dimensional space is calculated.
7. The method according to claim 5, characterized in that The placement mode corresponding to the double-sided intersection mode is the edge placement mode; In response to the intersection mode being the two-sided intersection mode, based on the placement mode, determining the projection coordinates of the center coordinates of the virtual object in the three-dimensional space, 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, including: Determine that the two target placement surfaces are respectively parallel or perpendicular to a preset standard surface; or are perpendicular to both the standard surfaces; In response to the two target placement surfaces being parallel and perpendicular to the standard surface respectively, determining the projection coordinates of the center coordinates of the virtual object on the intersection of the two target placement surfaces; adjusting the projection coordinates in height and depth according to the surface normals of the two target placement surfaces, calculating the edge placement position of the virtual object, and calculating the rotation orientation matrix of the virtual object when it is placed edge to edge in the three-dimensional space according to the surface normal of the target placement surface perpendicular to the standard surface; In response to the two target placement surfaces being perpendicular to the standard plane, the projection coordinates of the center coordinates of the virtual object on the intersection of the two target placement surfaces are determined; according to the surface normals of the two target placement surfaces, the depth and width of the projection coordinates are adjusted to calculate the edge placement position of the virtual object; and according to the surface normal of the target placement surface perpendicular to the standard plane, the rotation orientation matrix of the virtual object when it is placed edge to edge in the three-dimensional space is calculated.
8. The method according to claim 5, characterized in that The placement mode corresponding to the three-surface intersection mode is the corner placement mode; In response to the intersection mode being the three-plane intersection mode, based on the placement mode, determining the projection coordinates of the center coordinates of the virtual object in the three-dimensional space, and combining the surface normal of the target placement surface to calculate the placement posture of the virtual object in the three-dimensional space, including: Determine the projection coordinates of the center coordinates of the virtual object on the corner points formed by the three target placement surfaces; adjust the width, height and depth of the projection coordinates according to the surface normals of the three target placement surfaces, calculate the corner placement position of the virtual object, and calculate the rotation orientation matrix of the virtual object when it is placed corner-by-corner in the three-dimensional space according to the surface normals of the target placement surfaces.
9. The method according to claim 3, characterized in that: Determining a bounding volume of the virtual object according to the shape and size of the virtual object includes: Simplifying the shape of the virtual object to obtain the shape of the bounding volume of the virtual object; According to the shape of the enclosing volume, the size of the virtual object is enlarged according to a preset enlargement factor to obtain the enclosing volume of the virtual object.
10. The method according to claim 1, characterized in that After determining the placement position of the virtual object according to the placement gesture, the method further includes: A placement attribute is added to the virtual object, and each surface in the virtual object monitors a collision action or a proximity action, and when a collision action or a proximity action is monitored, the surface of the virtual object is used as the target placement surface.
11. The method according to claim 1, characterized in that: The method further comprises: Pre-moving the virtual object according to the placement gesture to display the placement of the virtual object; In response to receiving an instruction to place the virtual item according to the placement gesture, a placement position of the virtual object is determined.
12. A device for placing virtual items, characterized in that: include: A virtual item loading module, used to obtain a three-dimensional space and load a virtual object corresponding to the virtual item in the three-dimensional space; a placement posture determination module, configured to monitor a movement operation of the virtual object and identify a placement surface of the object in the three-dimensional space; and determine a placement posture of the virtual 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 placement posture determination module is further used to: determine an intersection mode corresponding to the intersection event according to an intersection event occurring between the virtual object and one or more target placement surfaces on the placement surface; Calculating a placement posture of the virtual object in the three-dimensional space according to the intersection mode; The intersection modes include: a single-surface intersection mode in which the virtual object intersects with one target placement surface among the placement surfaces, a double-surface intersection mode in which the virtual object intersects with two target placement surfaces among the placement surfaces, and a three-surface intersection mode in which the virtual object intersects with three target placement surfaces among the placement surfaces; The virtual object placement module is used to determine the placement position of the virtual object according to the placement posture, so that one or more surfaces of the virtual object are aligned with the one or more target placement surfaces.
13. A mobile electronic device terminal, characterized in that: include: 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 according to any one of claims 1 to 11.
14. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
Attitude determination method and device of virtual object in three-dimensional virtual environment and medium
CN108245893A