Building material adsorption method, device and electronic equipment in game
By acquiring and utilizing the attribute information and adsorption point information of scene building materials and preview building materials, and defining the adsorption point using two mutually perpendicular vectors, the problem of automatic adsorption of building materials when rotating on any axis is solved, achieving a uniquely determined automatic adsorption effect, simplifying operation and improving maintainability.
Patent Information
- Application Number
- CN202310129140.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-01
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2043-02-01
AI Technical Summary
In existing technologies, building materials in games cannot be automatically attached to scene building materials when the preview body rotates around any axis, resulting in non-unique attachment positions. Furthermore, existing solutions require complex manual operation and are difficult to maintain.
By acquiring the attribute information and adsorption point information of the scene building materials and the preview building materials, the adsorption point is defined using two mutually perpendicular vectors. Based on preset matching conditions, the position and posture of the preview building materials are determined to achieve automatic adsorption.
With the building material in the preview rotating around any axis, its position and posture on the scene building material can be uniquely determined, achieving automatic adsorption, simplifying operation and improving maintainability.
Smart Images

Figure CN116196610B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game interaction design technology, and in particular to a method, apparatus and electronic device for adsorbing building materials in games. Background Technology
[0002] In the game's building mechanics, building materials are generally used as basic units. Various structures are built by combining these materials. The building gameplay can be understood as stacking blocks, with building materials corresponding to blocks of different shapes. When placing a building material, players can preview its transformations and placement. A building material being placed is usually called a preview object, while a placed building material is called a scene building material.
[0003] In related technologies, to snap a preview object into scene building materials, a snapping point needs to be defined in a preset coordinate system using a position and an orientation. This snapping point can be either a socket or a plug, with the scene building materials providing the socket and the preview object providing the plug. When the plug and socket have the same position and orientation in the preset coordinate system, they can be matched together to snap the preview object into the scene building material. However, because the snapping point is defined using only one orientation, snapping point matching can only be achieved when the preview object's rotation is limited to the vertical axis. If the preview object can rotate around any axis, an infinite number of snapping positions can be obtained, making it impossible to automatically snap the preview object into the scene building material. Summary of the Invention
[0004] The purpose of this invention is to provide a method, device, and electronic device for adsorbing building materials in games, so as to automatically adsorb the preview object into the scene building materials when the preview object can rotate around any axis.
[0005] In a first aspect, the present invention provides a method for adsorbing building materials in a game. A graphical user interface is provided through a terminal device, displaying scene building materials already placed in the scene and preview building materials to be placed. Both the scene building materials and the preview building materials have adsorption points, represented by a position and two mutually perpendicular vectors. The method includes: acquiring attribute information and adsorption point information of the scene building materials, as well as adsorption point information of the preview building materials; wherein the attribute information includes position coordinates and orientation; the adsorption point information includes the position coordinates of the adsorption point and vector information of two mutually perpendicular vectors; determining the attribute information of the preview building materials based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building materials, and the adsorption point information of the preview building materials; and adsorbing the preview building materials onto the scene building materials according to the position coordinates and orientation indicated by the attribute information of the preview building materials.
[0006] Secondly, the present invention provides a building material adsorption device for games, which provides a graphical user interface through a terminal device. The graphical user interface displays scene building materials already placed in the scene, as well as preview building materials to be placed. Both the scene building materials and the preview building materials are provided with adsorption points, which are represented by a position and two mutually perpendicular vectors. The device includes: an information acquisition module for acquiring attribute information and adsorption point information of the scene building materials, as well as adsorption point information of the preview building materials; wherein the attribute information includes position coordinates and orientation; the adsorption point information includes the position coordinates of the adsorption point and vector information of two mutually perpendicular vectors; an information determination module for determining the attribute information of the preview building materials based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building materials, and the adsorption point information of the preview building materials; and a building material adsorption module for adsorbing the preview building materials onto the scene building materials according to the position coordinates and orientation indicated by the attribute information of the preview building materials.
[0007] Thirdly, the present invention provides an electronic device including a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the building material adsorption method in the above-mentioned game.
[0008] Fourthly, the present invention provides a computer-readable storage medium storing computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement the building material adsorption method in the aforementioned game.
[0009] The embodiments of the present invention bring the following beneficial effects:
[0010] This invention provides a method, device, and electronic device for adsorbing building materials in a game. First, it acquires the attribute information and adsorption point information of the scene's building materials, as well as the adsorption point information of a preview building material. The attribute information includes position coordinates and orientation; the adsorption point information includes the position coordinates of the adsorption point and vector information of two mutually perpendicular vectors. Then, based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene's building materials, and the adsorption point information of the preview building material, the attribute information of the preview building material is determined. Finally, according to the position coordinates and orientation indicated by the attribute information of the preview building material, the preview building material is adsorbed onto the scene's building materials. In this method, the adsorption point consists of a position and two mutually perpendicular vectors. Therefore, when adsorbing at two adsorption points, the adsorption orientation and position of the preview building material can be defined. Thus, even when the preview building material can rotate around any axis, this method can uniquely determine the position and orientation of the preview building material adsorbed onto the scene's building materials, thereby automatically adsorbing the preview building material.
[0011] Other features and advantages of the invention will be set forth in the following description, or some features and advantages may be inferred from the description or determined without doubt, or may be learned by practicing the techniques described above.
[0012] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0013] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0014] Figure 1 This is a schematic diagram of adsorption point matching provided in a related art according to an embodiment of the present invention;
[0015] Figure 2 A schematic diagram of exhaustive adsorption provided in an embodiment of the present invention;
[0016] Figure 3 A flowchart of a method for adsorbing building materials in a game, provided as an embodiment of the present invention;
[0017] Figure 4 This is a schematic diagram of adsorption at an adsorption point provided in an embodiment of the present invention;
[0018] Figure 5 A flowchart of another method for adsorbing building materials in a game, provided as an embodiment of the present invention;
[0019] Figure 6 A flowchart of another method for adsorbing building materials in a game, provided as an embodiment of the present invention;
[0020] Figure 7 This is a schematic diagram illustrating the scoring based on the distance from the adsorption position of the preview building material on the scene building material to the center of the graphical user interface, as provided in an embodiment of the present invention.
[0021] Figure 8 This is a schematic diagram illustrating the scoring based on the distance from the adsorption position of the preview building material on the scene building material to the virtual camera, as provided in an embodiment of the present invention.
[0022] Figure 9 This is a schematic diagram illustrating the scoring based on the difference between the adsorption posture of the preview building material on the scene building material and the posture of the preview building material before adsorption, provided by an embodiment of the present invention.
[0023] Figure 10 This is a schematic diagram of the structure of a building material adsorption device in a game, provided by an embodiment of the present invention;
[0024] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0026] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0027] In the game's building mechanics, building materials are generally used as basic units, and various structures are built by combining these materials. The building gameplay can be understood as stacking blocks, with building materials corresponding to blocks of different shapes. When placing a building material, players can preview its transformation and placement; the building material being placed is usually called a preview object, and the already placed building material is called a scene building material. Typically, to ensure that the preview object is placed correctly in the player's desired position, a flexible and reliable automatic snapping mechanism is needed.
[0028] In related technologies, automatic attachment between the preview object and scene building materials is typically achieved through snap-in point matching. Snap-in points are categorized into two types: sockets and plugs. During previewing, the scene building materials provide the sockets, and the preview object provides the plugs. Plugs and sockets can snap together when matched. Existing technologies require defining the snap-in point using a position and an orientation within a preset coordinate system, such as... Figure 1 The diagram shown is a schematic representation of adsorption point matching provided in related technologies. Figure 1 The square in the image represents scene building materials and provides a socket, which is composed of a square containing a circle and an arrow. Figure 1 The triangle icon in the image represents the preview body and provides a plug, which consists of a circle and an arrow inside the triangle; when the plug and socket are in the same position and orientation in the world coordinate system, they can be matched together to complete the snapping.
[0029] There are also solutions in related technologies that do not use adsorption point matching, such as... Figure 2 The diagram shown illustrates exhaustive adsorption. Figure 2 The squares in the image represent scene building materials, but the preview objects are also marked. The squares exhaustively list all possible positions and postures of the preview objects when they are triangular, and you can choose the most suitable one.
[0030] However, with adsorption point matching, a single set of adsorption points can typically be applied to various building materials, such as... Figure 1 The square adsorption point can match not only triangles but also the square itself. However, this method has drawbacks. Because the adsorption point is defined by only one orientation, it is only usable when the rotation of the preview object is limited to the vertical axis. If the preview object can rotate around any axis, an infinite number of adsorption positions can be obtained, making it impossible to automatically adsorb the preview object into scene building materials. The advantage of exhaustive adsorption methods is that they are applicable to any situation, and all adsorption methods are known, resulting in the best effect in gameplay. However, the disadvantages are also obvious: all adsorption methods need to be filled in manually, are not reusable, have a large workload, are prone to omissions and errors, and are difficult to maintain later.
[0031] To address the aforementioned issues, this invention provides a method, apparatus, and electronic device for adsorbing building materials in games. This method can be applied to games with building gameplay, especially in scenarios where building materials are automatically adsorbed.
[0032] In one embodiment of this disclosure, the building material adsorption method in a game can run on a local terminal device or a server. When the building material adsorption method in a game runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and client devices.
[0033] In an optional implementation, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program and the game screen presentation are separate. The storage and operation of the game's data processing are completed on the cloud gaming server. The client device is used for data reception, transmission, and game screen presentation. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a mobile terminal, television, computer, or PDA; however, the information processing is performed by the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game screen and other data, returns it to the client device via the network, and finally decodes and outputs the game screen through the client device.
[0034] In an optional implementation, taking a game as an example, the local terminal device stores the game program and is used to display the game screen. The local terminal device is used to interact with the player through a graphical user interface (GUI), i.e., conventionally by downloading, installing, and running the game program via an electronic device. The local terminal device can provide the GUI to the player in various ways, such as rendering it on the terminal's display screen or providing it to the player via holographic projection. For example, the local terminal device can include a display screen for displaying the GUI, which includes game screens, and a processor for running the game, generating the GUI, and controlling the display of the GUI on the display screen.
[0035] In one possible implementation, this invention provides a method for adsorbing building materials in a game. A graphical user interface (GUI) is provided via a terminal device, which can be either a local terminal device or a client device in a cloud interaction system. The GUI displays scene building materials already placed in the scene, and preview building materials to be placed (equivalent to the aforementioned preview objects). Both the scene building materials and the preview building materials have adsorption points, represented by two mutually perpendicular vectors. Figure 3 As shown, the method includes the following specific steps:
[0036] Step S302: Obtain the attribute information and adsorption point information of the scene building materials, and preview the adsorption point information of the building materials; wherein, the attribute information includes position coordinates and posture; the adsorption point information includes the position coordinates of the adsorption point and the vector information of two mutually perpendicular vectors.
[0037] In practical applications, at least one adsorption point can be set on both the scene building materials and the preview building materials. The position of each adsorption point in the building material and the two mutually perpendicular vectors are pre-set. In the specific implementation, the two mutually perpendicular vectors are both unit vectors, which facilitates the matching of adsorption points.
[0038] The aforementioned attribute information of scene building materials is used to indicate their position and orientation. The adsorption point information of scene building materials indicates the position coordinates of each adsorption point and the vector information of two mutually perpendicular vectors, including the length of the vector direction. In practical implementation, based on scene building materials already placed in the graphical user interface, the attribute information and adsorption point information of the scene building materials can be directly obtained; the adsorption point information of preview building materials can be determined by the position of the adsorption point of the preview building material currently selected by the player and the direction of the vector indication.
[0039] Step S304: Based on the preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building materials, and the adsorption point information of the preview building materials, determine the attribute information of the preview building materials.
[0040] The aforementioned adsorption point matching conditions can be determined based on R&D needs. For example, the adsorption point matching conditions could be that the adsorption point in the scene building material and the adsorption point in the preview building material are at the same position, and the two vectors also indicate the same direction in the preset coordinate system. In specific implementation, the attribute information of the preview building material is used to indicate the position and posture of the preview building material adsorbed on the scene building material; based on the position, coordinates, and adsorption point information of the scene building material, the position and posture of the preview building material adsorbed on the scene building material can be deduced.
[0041] Step S306: Based on the position coordinates and posture indicated by the attribute information of the preview building material, attach the preview building material to the scene building material.
[0042] In practical implementation, if the preview building material contains an adsorption point and the scene building material also contains an adsorption point, then based on the adsorption point matching conditions, the adsorption point information of the preview building material, the attribute information of the scene building material, and the adsorption point information, a position coordinate and posture corresponding to the preview building material can be obtained, and the preview building material can be adsorbed onto the scene building material according to the position coordinate and posture.
[0043] like Figure 4 The diagram shown is a schematic diagram of adsorption at an adsorption point. Figure 4 The squares represent scene building materials, and the circles represent preview building materials. The positions of the circles within the building materials represent the positions of the snap points. The two arrowed line segments on the circle represent mutually perpendicular vectors (which can be represented by vector 1 and vector 2). When the snap points of the preview building material and the scene building material are in the same position, and vector 1 and vector 2 are in the same world coordinates, they can be matched together and snapped. At this point, based on the position and posture of the scene building material and the snap point information, the position and posture of the preview building material can be deduced, thus snapping the preview building material onto the scene building material.
[0044] In practical implementation, if both the preview building material and the scene building material contain multiple adsorption points, then multiple adsorption point combinations can be obtained. Each adsorption point combination includes an adsorption point from the scene building material and an adsorption point from the preview building material. Then, for each adsorption point combination, a position coordinate and orientation corresponding to the preview building material can be obtained. Based on preset selection rules, target position coordinates and target orientation are selected from the position coordinates and orientation of the preview building material corresponding to each adsorption point combination. Finally, the preview building material is adsorbed onto the scene building material according to the target position coordinates and target orientation.
[0045] This invention provides a method for adsorbing building materials in a game. First, it acquires the attribute information and adsorption point information of the scene building materials, as well as the adsorption point information of a preview building material. The attribute information includes position coordinates and orientation; the adsorption point information includes the position coordinates of the adsorption point and vector information of two mutually perpendicular vectors. Then, based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building materials, and the adsorption point information of the preview building material, the attribute information of the preview building material is determined. Finally, according to the position coordinates and orientation indicated by the attribute information of the preview building material, the preview building material is adsorbed onto the scene building material. In this method, the adsorption point consists of a position and two mutually perpendicular vectors. Therefore, when adsorbing at two adsorption points, the adsorption orientation and position of the preview building material can be defined. Thus, even when the preview building material can rotate around any axis, this method can uniquely determine the position and orientation of the preview building material adsorbed onto the scene building material, thereby automatically adsorbing the preview building material.
[0046] This invention also provides another method for adsorbing building materials in games. This method is implemented based on the above embodiments. The method focuses on describing the specific process of determining the attribute information of the preview building materials based on preset adsorption point matching conditions, adsorption point information and attribute information of the scene building materials, and the adsorption point information of the preview building materials (implemented through steps S504-S506 below). Figure 5 As shown, the method includes the following specific steps:
[0047] Step S502: Obtain the attribute information and adsorption point information of the scene building materials, as well as preview the adsorption point information of the building materials; wherein, the attribute information includes position coordinates and posture; the adsorption point information includes the position coordinates of the adsorption point and the vector information of two mutually perpendicular vectors.
[0048] Step S504: Based on the adsorption point matching conditions, the vector information of the adsorption points of the scene building material, the vector information of the adsorption points of the preview building material, and the posture of the scene building material, determine the posture of the preview building material; wherein, the adsorption point matching conditions include: the vector information of the adsorption points of the scene building material is the same as the vector information of the adsorption points of the preview building material, and the position coordinates of the adsorption points of the scene building material are the same as the position coordinates of the adsorption points of the preview building material.
[0049] In practice, the vector information of the adsorption point of the scene building material and the vector information of the adsorption point of the preview building material must be the same in the world coordinate system, and the position coordinates of the adsorption point of the scene building material and the position coordinates of the adsorption point of the preview building material must also be the same in the world coordinate system. Only in this way can the adsorption points of the two scene building materials and the adsorption points of the preview building material be matched together and the adsorption is completed.
[0050] In practical applications, the attribute information of the scene building materials, the snap-in point information of the scene building materials, and the snap-in point information of the preview building materials are all known information. Among them, the pose R and position coordinates T of the scene building materials satisfy the condition that for any vector v in the building material coordinate system... m The vector v transformed into the world coordinate system w for:
[0051] v w =R·v m
[0052] Among them, the building material coordinate system is a coordinate system centered on the building material. For any position p in the building material coordinate system... m Its position p in the world coordinate system w for:
[0053] p w =R·p m +T
[0054] According to the adsorption point matching condition, the adsorption points can only be matched and adsorbed when the vector information of the adsorption points of the scene building materials and the vector information of the adsorption points of the preview building materials are the same in the world coordinate system. Therefore:
[0055] v s3 =v s1 ×v s2
[0056] v p3 =v p1 ×v p2
[0057] R′·v p1 =R·v s1
[0058] R′·v p2 =R·v s2
[0059] R′·v p3 =R·v s3
[0060] Where R′ represents the pose of the preview building material, R represents the pose of the scene building material, and v s1 and v s2 Two vectors representing the adsorption points of the building materials in the scene; v p1 and v p2 Two vectors representing the adsorption points of the preview building materials; v s3 and v p3 These are the cross products of the two vectors corresponding to the scene building materials and the preview building materials, respectively, and they satisfy the same rule. From the above, we can obtain:
[0061] R′·[vp1 v p2 v p3 ] = R·[v s1 v s2 v s3 ]
[0062] R′=R·[v s1 v s2 v s3 ]·[v p1 v p2 v p3 ] -1
[0063] Therefore, the pose R of the preview object can be calculated using the above calculations. ′ .
[0064] Step S506: Based on the above adsorption point matching conditions, the posture of the preview building material, and the position coordinates and posture of the scene building material, determine the position coordinates of the preview building material.
[0065] Based on the adsorption point matching condition, if the position coordinates of the adsorption point of the scene building material and the position coordinates of the adsorption point of the preview building material are the same in the world coordinate system, then:
[0066] R′·p p +T′=R·p s +T
[0067] T′=R·p s +TR′·p p
[0068] The position coordinates of the preview building material can be obtained using the above formula. Where T′ represents the position coordinates of the preview building material, T represents the position coordinates of the scene building material, R′ represents the posture of the preview building material, R represents the posture of the scene building material, and p... s p represents the position coordinates of the adsorption point of the building material in the scene. p This indicates the coordinates of the adsorption point of the preview building material.
[0069] Step S508: Based on the position coordinates and posture of the preview building material, attach the preview building material to the scene building material.
[0070] By adjusting the placement and orientation of the preview building materials according to the determined location coordinates and orientation, the preview building materials can be placed on the scene building materials, and the adsorption points of the preview building materials will be adsorbed onto the adsorption points of the scene building materials.
[0071] The building material adsorption method in the aforementioned game differs from methods that restrict the adsorption point to only one orientation. In this method, the adsorption point is defined by two mutually perpendicular orientations. This limits the adsorption point's posture when the preview building material rotates around any axis, ensuring that only one adsorption method is possible, thus automatically completing the adsorption process. Furthermore, this adsorption process is equivalent to aligning two coordinate systems. Clearly, if both coordinate systems are left-handed or right-handed, the adsorption point can always be aligned through transformation, guaranteeing that the preview building material can adsorb onto the scene building material.
[0072] This invention also provides another method for adsorbing building materials in a game. This method is implemented based on the above embodiments. The method focuses on describing the specific process of adsorbing the preview building material onto the scene building material when both the scene building material and the preview building material contain multiple adsorption points, according to the position coordinates and orientation indicated by the preview building material's attribute information (implemented through steps S608-S612 below). Figure 6 As shown, the method includes the following specific steps:
[0073] Step S602: Obtain the attribute information and adsorption point information of the scene building materials, as well as the adsorption point information of the preview building materials; wherein, the scene building materials contain multiple adsorption points, and the preview building materials also contain multiple adsorption points; the attribute information includes position coordinates and posture, and the adsorption point information includes the position coordinates of the adsorption point and the vector information of two mutually perpendicular vectors.
[0074] In specific implementation, the adsorption point information of the scene building material includes: the position coordinates of each adsorption point among the multiple adsorption points contained in the scene building material and the vector information of two mutually perpendicular vectors, which includes the direction and length of the vectors; the adsorption point information of the preview building material includes: the position coordinates of each adsorption point among the multiple adsorption points contained in the preview building material and the vector information of two mutually perpendicular vectors.
[0075] Step S604: For each adsorption point contained in the scene building material, combine the current adsorption point with each of the multiple adsorption points contained in the preview building material to obtain multiple adsorption point combinations; wherein, each adsorption point combination includes: one adsorption point in the scene building material and one adsorption point in the preview building material.
[0076] Specifically, each adsorption point contained in the scene building material needs to be used as the current adsorption point in sequence, and combined once with each of the multiple adsorption points contained in the preview building material to obtain multiple adsorption point combinations. Among them, an adsorption point combination contains an adsorption point of one scene building material and an adsorption point of one preview building material. Assuming that the scene building material contains M adsorption points and the preview building material contains N adsorption points, then the number of adsorption point combinations is M*N.
[0077] Step S606: For each of the multiple adsorption point combinations, based on the adsorption point matching conditions, the adsorption point information corresponding to the current adsorption point combination, and the attribute information of the scene building materials, determine the attribute information of the preview building materials corresponding to the current adsorption point combination.
[0078] In practical implementation, the adsorption point information corresponding to the current adsorption point combination includes: the adsorption point information of the adsorption points in the scene building materials included in the current adsorption point combination, and the adsorption point information of the adsorption points in the preview building materials included in the current adsorption point combination. The adsorption point matching conditions include: the vector information of the adsorption points of the scene building materials is the same as the vector information of the adsorption points of the preview building materials, and the position coordinates of the adsorption points of the scene building materials are the same as the position coordinates of the adsorption points of the preview building materials.
[0079] Specifically, the step of determining the property information of the preview building material corresponding to the current adsorption point combination can be achieved through steps S504-S506 in the above embodiment, and will not be described in detail here.
[0080] Step S608: Based on the preset scoring rules, the attribute information of the preview building materials corresponding to each group of adsorption point combinations is scored to obtain the scoring results of the attribute information of the preview building materials corresponding to each group of adsorption point combinations.
[0081] The above scoring rules can be determined based on R&D needs. The purpose of setting the scoring rules is to determine the most suitable attribute information of the preview building material from the attribute information of all combinations of adsorption points, so that the preview building material can be automatically adsorbed onto the scene building material according to the determined attribute information. In specific implementation, the above scoring rules include at least one of the following: First, the shorter the distance from the adsorption position of the preview building material on the scene building material to the center of the graphical user interface, the higher the score; Second, the closer the distance from the adsorption position of the preview building material on the scene building material to the virtual camera, the higher the score; Third, the smaller the difference between the adsorption posture of the preview building material on the scene building material and the posture before adsorption, the higher the score. The above adsorption position is equivalent to the position coordinates indicated by the attribute information of the preview building material; the above adsorption posture is equivalent to the posture indicated by the attribute information of the preview building material.
[0082] In practical applications, the three scoring rules mentioned above are applied to different situations. For example... Figure 7 The diagram shows a scoring system based on the distance from the preview material's attachment point on the scene's building materials to the center of the graphical user interface. Figure 7 There are two scene building materials that provide adsorption points, and these two scene building materials are... Figure 7 The square drawn in the middle is used to preview the building materials. Figure 7 The square drawn with a dashed line represents... Figure 7Two optional snapping positions for preview building materials are shown. Players prefer preview materials to snap to a position closer to the center of the screen (equivalent to the center of the graphical user interface). Therefore, the closer the snapping position of the preview material is to the center of the screen, the higher the score. Furthermore, when the snapping position of the preview material is too far from the center of the screen, it is difficult for players to notice, and this part is directly eliminated.
[0083] like Figure 8 The diagram shows a scoring system based on the distance from the preview building material's attachment position on the scene's building materials to the virtual camera. Figure 8 There are two sets of building materials, one in front and one behind. The building materials in the scene are represented by squares drawn with solid lines, while the building materials in the preview are represented by squares drawn with dashed lines. Figure 8 Two possible attachment points for preview building materials were drawn. The distance from the attachment point to the center of the screen was exactly the same for both. However, players prefer attachment points that are closer to them (i.e., closer to the virtual camera). Therefore, the closer the attachment point is to the player, the higher the score. Similarly, attachment points that are too far from the player need to be eliminated.
[0084] like Figure 9 The diagram shows a scoring system based on the difference between the preview building material's adsorption posture on the scene building material and its posture before adsorption. Figure 9 The top and bottom images show two methods for matching preview building materials with scene building materials, with the center image showing the initial posture of the preview building material in the graphical user interface. At this point, the first two scores are the same for both matching methods, but players prefer that the posture of the preview building material after attachment matches the initial posture. Therefore, a third scoring method is needed: the smaller the difference in posture before and after matching, the higher the score. When the difference between the attached posture and the initial posture after matching is too large, it does not meet player expectations and should be removed.
[0085] In practical applications, if the scoring rules include the three mentioned above, then in order to achieve step S608, for the attribute information of the preview building materials corresponding to each group of adsorption point combinations, the following steps 10-13 are executed to obtain the scoring results of the attribute information of the preview building materials corresponding to each group of adsorption point combinations:
[0086] Step 10: Determine the first score based on the distance from the location coordinates indicated by the attribute information of the preview building material corresponding to the current adsorption point combination to the center of the graphical user interface.
[0087] In practice, each distance value from the location coordinates indicated by the preview building material's attribute information to the center of the graphical user interface is pre-set with a corresponding score. Thus, the first score can be directly determined based on the distance from the location coordinates indicated by the preview building material's attribute information to the center of the graphical user interface.
[0088] Step 11: Determine the second score based on the distance from the location coordinates indicated by the attribute information of the preview building material corresponding to the current adsorption point combination to the virtual camera.
[0089] In practice, each distance value from the location coordinates indicated by the attribute information of the preview building material to the virtual camera is pre-set with a corresponding score. Thus, based on the distance from the location coordinates indicated by the attribute information of the preview building material to the virtual camera, the second score can be directly determined.
[0090] Step 12: Determine the third score based on the posture indicated by the attribute information of the preview building material corresponding to the current adsorption point combination.
[0091] In practical implementation, the difference between the orientation indicated by the preview building material's attribute information and its orientation before attachment is pre-set with corresponding scores. Therefore, based on the orientation indicated by the preview building material's attribute information and its orientation before attachment, a third score can be directly determined. In real-world applications, it is typically necessary to maintain the same attachment orientation of the preview building material on the scene's building materials as its orientation before attachment.
[0092] Step 13: Based on the first score, the second score, and the third score, obtain the score results of the attribute information of the preview building materials corresponding to the current adsorption point combination.
[0093] In practice, each scoring rule has a corresponding scoring range. Based on the scoring range of each scoring rule, combinations of adsorption points that do not meet the expectations are filtered out, which means deleting the attribute information of the preview building material corresponding to the adsorption point combination. Finally, the scores are added together, and the combination with the highest total score is the automatically adsorbed adsorption point combination. When no suitable combination is found, the preview building material is displayed floating in the graphical user interface.
[0094] In practical applications, if the first score falls within a preset first score range, the second score falls within a preset second score range, and the third score falls within a preset third score range, the first score is multiplied by the first weight to obtain the first product, the second score is multiplied by the second weight to obtain the second product, and the third score is multiplied by the third weight to obtain the third product. The first, second, and third products are then added together to obtain the sum, which is determined as the score result corresponding to the attribute information of the preview building material for the current adsorption point combination. Specifically, the first, second, and third score ranges, as well as the first, second, and third weights, can all be determined according to R&D needs and are not specifically limited here. Specifically, the three scores are added together according to their weights, and the highest total score is the final automatic adsorption result. In most cases, these three scores and filtering methods can obtain the desired adsorption result. When special cases are found in the application, more scoring rules can be introduced, and are not specifically limited here.
[0095] Furthermore, if the first score is not within the preset first score range, the second score is not within the preset second score range, or the third score is not within the third score range, it is determined that the adsorption points in the scene building materials included in the current adsorption point combination do not match the adsorption points in the preview building materials, and the attribute information of the preview building materials corresponding to the current adsorption point combination is deleted. That is, the current adsorption point combination will be deleted, and the two adsorption points contained in the current adsorption point combination will not be adsorbed together.
[0096] In some embodiments, if the adsorption points in the scene building materials and the adsorption points in the preview building materials contained in each adsorption point combination do not match, the preview building materials are displayed at a specified location in the graphical user interface. This specified location can be determined according to development needs; for example, it could be the center of the graphical user interface or the initial display location of the preview building materials.
[0097] Step S610: Determine the attribute information of the preview building material with the highest score as the final attribute information.
[0098] Step S612: According to the posture and position coordinates indicated by the final attribute information, attach the preview building material to the scene building material.
[0099] The building material adsorption method described above in the game can still flexibly and reliably adsorb preview building materials and scene building materials even when the preview building materials can rotate around any axis, allowing players to build very smoothly. At the same time, for developers, the definition of adsorption points is simple and intuitive, most of which can be automatically generated by the program, are reusable, and are very easy to maintain.
[0100] Corresponding to the above method embodiments, this invention also provides a building material adsorption device in a game, which provides a graphical user interface through a terminal device. This graphical user interface displays scene building materials already placed in the scene, as well as preview building materials to be placed. Both the scene building materials and the preview building materials are provided with adsorption points, which are represented by two mutually perpendicular vectors. Figure 10 As shown, the device includes:
[0101] The information acquisition module 110 is used to acquire the attribute information and adsorption point information of the scene building materials, as well as the adsorption point information of the preview building materials; wherein, the attribute information includes position coordinates and posture; the adsorption point information includes the position coordinates of the adsorption point and the vector information of two mutually perpendicular vectors.
[0102] The information determination module 111 is used to determine the attribute information of the preview building material based on preset adsorption point matching conditions, adsorption point information and attribute information of the scene building material, and adsorption point information of the preview building material.
[0103] The building material adsorption module 112 is used to adsorb the preview building material onto the scene building material according to the position coordinates and posture indicated by the attribute information of the preview building material.
[0104] The building material adsorption device in the aforementioned game first acquires the attribute information and adsorption point information of the scene building materials, as well as the adsorption point information of the preview building material. The attribute information includes position coordinates and orientation; the adsorption point information includes the position coordinates of the adsorption point and the vector information of two mutually perpendicular vectors. Then, based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building materials, and the adsorption point information of the preview building material, the attribute information of the preview building material is determined. Then, according to the position coordinates and orientation indicated by the attribute information of the preview building material, the preview building material is adsorbed onto the scene building material. In this method, the adsorption point consists of a position and two mutually perpendicular vectors. Therefore, when adsorbing at two adsorption points, the adsorption orientation and position of the preview building material can be limited. Thus, even when the preview building material can rotate around any axis, this method can uniquely determine the position and orientation of the preview building material adsorbed onto the scene building material, thereby automatically adsorbing the preview building material.
[0105] Specifically, the above-mentioned adsorption point matching conditions include: the vector information of the adsorption point of the scene building material is the same as the vector information of the adsorption point of the preview building material, and the position coordinates of the adsorption point of the scene building material are the same as the position coordinates of the adsorption point of the preview building material; the above-mentioned information determination module 111 is used to: determine the posture of the preview building material based on the adsorption point matching conditions, the vector information of the adsorption point of the scene building material, the vector information of the adsorption point of the preview building material, and the posture of the scene building material; and determine the position coordinates of the preview building material based on the adsorption point matching conditions, the posture of the preview building material, the position coordinates of the scene building material, and the posture.
[0106] In practical implementation, the posture of the aforementioned preview building materials is determined by the following formula:
[0107] R′=R·[v s1 v s2 v s3 ]·[v p1 v p2 v p3 ] -1
[0108] Where R′ represents the pose of the preview building material, R represents the pose of the scene building material, and v s1 and v s2 Two vectors, v, represent the adsorption points of the building materials in the scene. s3 =v s1 ×v s2 ;v p1 and v p2 Two vectors, v, represent the adsorption points of the preview building materials. p3 =v p1 ×vp2 .
[0109] In practical implementation, the location coordinates of the aforementioned preview building materials are determined using the following formula:
[0110] T′=R·p s +TR′·p p
[0111] Where T′ represents the position coordinates of the preview building material, T represents the position coordinates of the scene building material, R′ represents the posture of the preview building material, R represents the posture of the scene building material, and p s p represents the position coordinates of the adsorption point of the building material in the scene. p This indicates the coordinates of the adsorption point of the preview building material.
[0112] Furthermore, the aforementioned scene building material contains multiple adsorption points; the aforementioned preview building material contains multiple adsorption points; the aforementioned device further includes an adsorption point combination module, used to: before the step of determining the attribute information of the preview building material based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building material, and the adsorption point information of the preview building material, combine the current adsorption point with each of the multiple adsorption points contained in the preview building material for each adsorption point contained in the scene building material to obtain multiple adsorption point combinations; wherein, each adsorption point combination includes: one adsorption point in the scene building material and one adsorption point in the preview building material.
[0113] Specifically, the aforementioned information determination module 111 is used to: for each of the multiple adsorption point combinations, perform the following operation: based on the adsorption point matching conditions, the adsorption point information corresponding to the current adsorption point combination, and the attribute information of the scene building materials, determine the attribute information of the preview building materials corresponding to the current adsorption point combination; wherein, the adsorption point information corresponding to the current adsorption point combination includes: the adsorption point information of the adsorption points in the scene building materials included in the current adsorption point combination, and the adsorption point information of the adsorption points in the preview building materials included in the current adsorption point combination.
[0114] Furthermore, the aforementioned building material adsorption module 112 is used to: score the attribute information of the preview building material corresponding to each set of adsorption point combinations based on preset scoring rules, and obtain the scoring result of the attribute information of the preview building material corresponding to each set of adsorption point combinations; determine the attribute information of the preview building material with the highest score as the final attribute information; and adsorb the preview building material onto the scene building material according to the posture and position coordinates indicated by the final attribute information.
[0115] In specific implementation, the above scoring rules include at least one of the following: the shorter the distance from the spot where the preview building material is attached to the scene building material to the center of the graphical user interface, the higher the score; the closer the distance from the spot where the preview building material is attached to the scene building material to the virtual camera, the higher the score; the smaller the difference between the attachment posture of the preview building material on the scene building material and the posture before the preview building material is attached, the higher the score.
[0116] Furthermore, the aforementioned building material adsorption module 112 is used to: perform the following operations on the attribute information of the preview building material corresponding to each group of adsorption points: determine a first score based on the distance from the position coordinates indicated by the attribute information of the preview building material corresponding to the current adsorption point combination to the center of the graphical user interface; determine a second score based on the distance from the position coordinates indicated by the attribute information of the preview building material corresponding to the current adsorption point combination to the virtual camera; determine a third score based on the posture indicated by the attribute information of the preview building material corresponding to the current adsorption point combination; and obtain the score result corresponding to the attribute information of the preview building material corresponding to the current adsorption point combination based on the first score, the second score, and the third score.
[0117] Furthermore, the aforementioned building material adsorption module 112 is also used to: if the first score is within a preset first score range, the second score is within a preset second score range, and the third score is within a preset third score range, multiply the first score by the first weight to obtain a first product, multiply the second score by the second weight to obtain a second product, and multiply the third score by the third weight to obtain a third product; add the first product, the second product, and the third product to obtain a summed result, and determine the summed result as the score result corresponding to the attribute information of the preview building material corresponding to the current adsorption point combination.
[0118] In a specific implementation, the above device also includes an information deletion module, used to: if the first score is not within the preset first score range, the second score is not within the preset second score range, or the third score is not within the third score range, determine that the adsorption points in the scene building materials included in the current adsorption point combination do not match the adsorption points in the preview building materials, and delete the attribute information of the preview building materials corresponding to the current adsorption point combination.
[0119] In practical applications, if the adsorption points in the scene building materials and the adsorption points in the preview building materials contained in each adsorption point combination do not match, the preview building materials will be displayed at the specified location in the graphical user interface.
[0120] The building material adsorption device in the game provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment.
[0121] This invention also provides an electronic device, such as... Figure 11As shown, the electronic device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, which executes the machine-executable instructions to implement the building material adsorption method in the above game.
[0122] Specifically, a graphical user interface is provided through a terminal device, which displays scene building materials already placed in the scene, as well as preview building materials to be placed. Both scene building materials and preview building materials have adsorption points, represented by a position and two mutually perpendicular vectors. The building material adsorption method in the game includes: acquiring the attribute information and adsorption point information of the scene building materials, as well as the adsorption point information of the preview building materials; wherein the attribute information includes position coordinates and orientation; the adsorption point information includes the position coordinates of the adsorption point and the vector information of two mutually perpendicular vectors; determining the attribute information of the preview building materials based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building materials, and the adsorption point information of the preview building materials; and adsorbing the preview building materials onto the scene building materials according to the position coordinates and orientation indicated by the attribute information of the preview building materials.
[0123] In the aforementioned building material adsorption method, the adsorption point consists of a position and two mutually perpendicular vectors. Thus, when adsorbing at the two adsorption points, the adsorption posture and position of the preview building material can be limited. Furthermore, when the preview building material can rotate around any axis, this method can uniquely determine the position and posture of the preview building material adsorbed on the scene building material, thereby automatically adsorbing the preview building material.
[0124] In an optional embodiment, the above-mentioned adsorption point matching conditions include: the vector information of the adsorption point of the scene building material is the same as the vector information of the adsorption point of the preview building material, and the position coordinates of the adsorption point of the scene building material are the same as the position coordinates of the adsorption point of the preview building material; the above-mentioned step of determining the attribute information of the preview building material based on the preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building material, and the adsorption point information of the preview building material includes: determining the posture of the preview building material based on the adsorption point matching conditions, the vector information of the adsorption point of the scene building material, the vector information of the adsorption point of the preview building material, and the posture of the scene building material; and determining the position coordinates of the preview building material based on the adsorption point matching conditions, the posture of the preview building material, the position coordinates of the scene building material, and the posture.
[0125] In an optional embodiment, the posture of the aforementioned preview building material is determined by the following formula:
[0126] R′=R·[v s1 v s2 v s3 ]·[v p1 v p2 v p3 ] -1
[0127] Where R′ represents the pose of the preview building material, R represents the pose of the scene building material, and v s1 and v s2 Two vectors, v, represent the adsorption points of the building materials in the scene. s3 =v s1 ×v s2 ;v p1 and v p2 Two vectors, v, represent the adsorption points of the preview building materials. p3 =v p1 ×v p2 .
[0128] In an optional embodiment, the location coordinates of the aforementioned preview building materials are determined by the following formula:
[0129] T′=R·p s +TR′·p p
[0130] Where T′ represents the position coordinates of the preview building material, T represents the position coordinates of the scene building material, R′ represents the posture of the preview building material, R represents the posture of the scene building material, and p s p represents the position coordinates of the adsorption point of the building material in the scene. p This indicates the coordinates of the adsorption point of the preview building material.
[0131] In an optional embodiment, the scene building material includes multiple adsorption points; the preview building material includes multiple adsorption points; before the step of determining the attribute information of the preview building material based on preset adsorption point matching conditions, adsorption point information and attribute information of the scene building material, and adsorption point information of the preview building material, the method further includes: for each adsorption point included in the scene building material, combining the current adsorption point with each of the multiple adsorption points included in the preview building material to obtain multiple adsorption point combinations; wherein, each adsorption point combination includes: one adsorption point in the scene building material and one adsorption point in the preview building material.
[0132] In an optional embodiment, the step of determining the attribute information of the preview building material based on preset adsorption point matching conditions, adsorption point information and attribute information of the scene building material, and adsorption point information of the preview building material includes: for each adsorption point combination in multiple adsorption point combinations, performing the following operation: determining the attribute information of the preview building material corresponding to the current adsorption point combination based on the adsorption point matching conditions, the adsorption point information corresponding to the current adsorption point combination, and the attribute information of the scene building material; wherein, the adsorption point information corresponding to the current adsorption point combination includes: the adsorption point information of the adsorption points in the scene building material included in the current adsorption point combination, and the adsorption point information of the adsorption points in the preview building material included in the current adsorption point combination.
[0133] In an optional embodiment, the step of attaching the preview building material to the scene building material according to the position coordinates and posture indicated by the attribute information of the preview building material includes: scoring the attribute information of the preview building material corresponding to each set of attachment points based on a preset scoring rule, and obtaining the scoring result of the attribute information of the preview building material corresponding to each set of attachment points; determining the attribute information of the preview building material with the highest score as the final attribute information; and attaching the preview building material to the scene building material according to the posture and position coordinates indicated by the final attribute information.
[0134] In an optional embodiment, the scoring rules include at least one of the following: the shorter the distance from the adsorption position of the preview building material on the scene building material to the center of the graphical user interface, the higher the score; the closer the distance from the adsorption position of the preview building material on the scene building material to the virtual camera, the higher the score; the smaller the difference between the adsorption posture of the preview building material on the scene building material and the posture before the preview building material is adsorbed, the higher the score.
[0135] In an optional embodiment, the step of scoring the attribute information of the preview building materials corresponding to each set of adsorption point combinations based on preset scoring rules to obtain the scoring result of the attribute information of the preview building materials corresponding to each set of adsorption point combinations includes: for the attribute information of the preview building materials corresponding to each set of adsorption point combinations, performing the following operations: determining a first score based on the distance from the position coordinates indicated by the attribute information of the preview building materials corresponding to the current adsorption point combination to the center of the graphical user interface; determining a second score based on the distance from the position coordinates indicated by the attribute information of the preview building materials corresponding to the current adsorption point combination to the virtual camera; determining a third score based on the posture indicated by the attribute information of the preview building materials corresponding to the current adsorption point combination; and obtaining the scoring result corresponding to the attribute information of the preview building materials corresponding to the current adsorption point combination based on the first score, the second score, and the third score.
[0136] In an optional embodiment, the step of obtaining the score result corresponding to the attribute information of the preview building material corresponding to the current adsorption point combination based on the first score, the second score, and the third score includes: if the first score is within a preset first score range, the second score is within a preset second score range, and the third score is within a preset third score range, multiplying the first score by the first weight to obtain a first product, multiplying the second score by the second weight to obtain a second product, and multiplying the third score by the third weight to obtain a third product; adding the first product, the second product, and the third product to obtain a summed result, and determining the summed result as the score result corresponding to the attribute information of the preview building material corresponding to the current adsorption point combination.
[0137] In an optional embodiment, the method further includes: if the first score is not within a preset first score range, the second score is not within a preset second score range, or the third score is not within a third score range, determining that the adsorption points in the scene building materials included in the current adsorption point combination do not match the adsorption points in the preview building materials, and deleting the attribute information of the preview building materials corresponding to the current adsorption point combination.
[0138] In an optional embodiment, the method further includes: if the adsorption points in the scene building materials and the adsorption points in the preview building materials contained in each adsorption point combination do not match, displaying the preview building materials at a specified location in the graphical user interface.
[0139] Furthermore, Figure 11 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 101, the communication interface 103 and the memory 100 connected via the bus 102.
[0140] The memory 100 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 11 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0141] Processor 101 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 101 or by instructions in software form. Processor 101 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 100, and processor 101 reads information from memory 100 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.
[0142] This invention also provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are called and executed by a processor, they cause the processor to implement the building material adsorption method in the above-mentioned game. For specific implementation details, please refer to the method embodiments, which will not be repeated here.
[0143] Specifically, a graphical user interface is provided through a terminal device, which displays scene building materials already placed in the scene, as well as preview building materials to be placed. Both scene building materials and preview building materials have adsorption points, represented by a position and two mutually perpendicular vectors. The building material adsorption method in the game includes: acquiring the attribute information and adsorption point information of the scene building materials, as well as the adsorption point information of the preview building materials; wherein the attribute information includes position coordinates and orientation; the adsorption point information includes the position coordinates of the adsorption point and the vector information of two mutually perpendicular vectors; determining the attribute information of the preview building materials based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building materials, and the adsorption point information of the preview building materials; and adsorbing the preview building materials onto the scene building materials according to the position coordinates and orientation indicated by the attribute information of the preview building materials.
[0144] In the aforementioned building material adsorption method, the adsorption point consists of a position and two mutually perpendicular vectors. Thus, when adsorbing at the two adsorption points, the adsorption posture and position of the preview building material can be limited. Furthermore, when the preview building material can rotate around any axis, this method can uniquely determine the position and posture of the preview building material adsorbed on the scene building material, thereby automatically adsorbing the preview building material.
[0145] In an optional embodiment, the above-mentioned adsorption point matching conditions include: the vector information of the adsorption point of the scene building material is the same as the vector information of the adsorption point of the preview building material, and the position coordinates of the adsorption point of the scene building material are the same as the position coordinates of the adsorption point of the preview building material; the above-mentioned step of determining the attribute information of the preview building material based on the preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building material, and the adsorption point information of the preview building material includes: determining the posture of the preview building material based on the adsorption point matching conditions, the vector information of the adsorption point of the scene building material, the vector information of the adsorption point of the preview building material, and the posture of the scene building material; and determining the position coordinates of the preview building material based on the adsorption point matching conditions, the posture of the preview building material, the position coordinates of the scene building material, and the posture.
[0146] In an optional embodiment, the posture of the aforementioned preview building material is determined by the following formula:
[0147] R′=R·[v s1 v s2 v s3 ]·[v p1 v p2 v p3 ] -1
[0148] Where R′ represents the pose of the preview building material, R represents the pose of the scene building material, and v s1 and v s2 Two vectors, v, represent the adsorption points of the building materials in the scene. s3=v s1 ×v s2 ;v p1 and v p2 Two vectors, v, represent the adsorption points of the preview building materials. p3 =v p1 ×v p2 .
[0149] In an optional embodiment, the location coordinates of the aforementioned preview building materials are determined by the following formula:
[0150] T′=R·p s +TR ′ ·p p
[0151] Where T′ represents the position coordinates of the preview building material, T represents the position coordinates of the scene building material, R′ represents the posture of the preview building material, R represents the posture of the scene building material, and p s p represents the position coordinates of the adsorption point of the building material in the scene. p This indicates the coordinates of the adsorption point of the preview building material.
[0152] In an optional embodiment, the scene building material includes multiple adsorption points; the preview building material includes multiple adsorption points; before the step of determining the attribute information of the preview building material based on preset adsorption point matching conditions, adsorption point information and attribute information of the scene building material, and adsorption point information of the preview building material, the method further includes: for each adsorption point included in the scene building material, combining the current adsorption point with each of the multiple adsorption points included in the preview building material to obtain multiple adsorption point combinations; wherein, each adsorption point combination includes: one adsorption point in the scene building material and one adsorption point in the preview building material.
[0153] In an optional embodiment, the step of determining the attribute information of the preview building material based on preset adsorption point matching conditions, adsorption point information and attribute information of the scene building material, and adsorption point information of the preview building material includes: for each adsorption point combination in multiple adsorption point combinations, performing the following operation: determining the attribute information of the preview building material corresponding to the current adsorption point combination based on the adsorption point matching conditions, the adsorption point information corresponding to the current adsorption point combination, and the attribute information of the scene building material; wherein, the adsorption point information corresponding to the current adsorption point combination includes: the adsorption point information of the adsorption points in the scene building material included in the current adsorption point combination, and the adsorption point information of the adsorption points in the preview building material included in the current adsorption point combination.
[0154] In an optional embodiment, the step of attaching the preview building material to the scene building material according to the position coordinates and posture indicated by the attribute information of the preview building material includes: scoring the attribute information of the preview building material corresponding to each set of attachment points based on a preset scoring rule, and obtaining the scoring result of the attribute information of the preview building material corresponding to each set of attachment points; determining the attribute information of the preview building material with the highest score as the final attribute information; and attaching the preview building material to the scene building material according to the posture and position coordinates indicated by the final attribute information.
[0155] In an optional embodiment, the scoring rules include at least one of the following: the shorter the distance from the adsorption position of the preview building material on the scene building material to the center of the graphical user interface, the higher the score; the closer the distance from the adsorption position of the preview building material on the scene building material to the virtual camera, the higher the score; the smaller the difference between the adsorption posture of the preview building material on the scene building material and the posture before the preview building material is adsorbed, the higher the score.
[0156] In an optional embodiment, the step of scoring the attribute information of the preview building materials corresponding to each set of adsorption point combinations based on preset scoring rules to obtain the scoring result of the attribute information of the preview building materials corresponding to each set of adsorption point combinations includes: for the attribute information of the preview building materials corresponding to each set of adsorption point combinations, performing the following operations: determining a first score based on the distance from the position coordinates indicated by the attribute information of the preview building materials corresponding to the current adsorption point combination to the center of the graphical user interface; determining a second score based on the distance from the position coordinates indicated by the attribute information of the preview building materials corresponding to the current adsorption point combination to the virtual camera; determining a third score based on the posture indicated by the attribute information of the preview building materials corresponding to the current adsorption point combination; and obtaining the scoring result corresponding to the attribute information of the preview building materials corresponding to the current adsorption point combination based on the first score, the second score, and the third score.
[0157] In an optional embodiment, the step of obtaining the score result corresponding to the attribute information of the preview building material corresponding to the current adsorption point combination based on the first score, the second score, and the third score includes: if the first score is within a preset first score range, the second score is within a preset second score range, and the third score is within a preset third score range, multiplying the first score by the first weight to obtain a first product, multiplying the second score by the second weight to obtain a second product, and multiplying the third score by the third weight to obtain a third product; adding the first product, the second product, and the third product to obtain a summed result, and determining the summed result as the score result corresponding to the attribute information of the preview building material corresponding to the current adsorption point combination.
[0158] In an optional embodiment, the method further includes: if the first score is not within a preset first score range, the second score is not within a preset second score range, or the third score is not within a third score range, determining that the adsorption points in the scene building materials included in the current adsorption point combination do not match the adsorption points in the preview building materials, and deleting the attribute information of the preview building materials corresponding to the current adsorption point combination.
[0159] In an optional embodiment, the method further includes: if the adsorption points in the scene building materials and the adsorption points in the preview building materials contained in each adsorption point combination do not match, displaying the preview building materials at a specified location in the graphical user interface.
[0160] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a terminal device, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0161] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0162] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for adsorbing building materials in a game, characterized in that, A graphical user interface is provided through a terminal device, which displays scene building materials already placed in the scene, as well as preview building materials to be placed; wherein, both the scene building materials and the preview building materials are provided with adsorption points, and the adsorption points are represented by a single position and two mutually perpendicular vectors; the method includes: Obtain the attribute information and adsorption point information of the scene building material, as well as the adsorption point information of the preview building material; wherein, the attribute information includes position coordinates and posture; the adsorption point information includes the position coordinates of the adsorption point and the vector information of two mutually perpendicular vectors; Based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building materials, and the adsorption point information of the preview building materials, the attribute information of the preview building materials is determined; wherein, the attribute information includes the posture and position coordinates of the preview building materials. Based on the position coordinates and posture indicated by the attribute information of the preview building material, the preview building material is attached to the scene building material; The posture of the preview building material is determined by the following formula: in, R represents the posture of the preview building material, and R represents the posture of the scene building material. and Two vectors representing the adsorption points of the building materials in the scene. ; and Two vectors representing the adsorption points of the preview building material. .
2. The method according to claim 1, characterized in that, The adsorption point matching conditions include: the vector information of the adsorption point of the scene building material is the same as the vector information of the adsorption point of the preview building material, and the position coordinates of the adsorption point of the scene building material are the same as the position coordinates of the adsorption point of the preview building material. The step of determining the attribute information of the preview building material based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building material, and the adsorption point information of the preview building material includes: Based on the adsorption point matching conditions, the vector information of the adsorption points of the scene building materials, the vector information of the adsorption points of the preview building materials, and the posture of the scene building materials, the posture of the preview building materials is determined. Based on the adsorption point matching conditions, the posture of the preview building material, and the position coordinates and posture of the scene building material, the position coordinates of the preview building material are determined.
3. The method according to claim 1, characterized in that, The location coordinates of the preview building materials are determined by the following formula: in, The coordinates of the preview building material are shown, and T represents the coordinates of the scene building material. R represents the posture of the preview building material, and R represents the posture of the scene building material. This indicates the coordinates of the adsorption point of the building materials in the scene. This indicates the coordinates of the adsorption point of the preview building material.
4. The method according to claim 1, characterized in that, The scene building material contains multiple adsorption points; the preview building material contains multiple adsorption points. Before the step of determining the attribute information of the preview building material based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building material, and the adsorption point information of the preview building material, the method further includes: For each adsorption point included in the scene building material, the current adsorption point is combined with each of the multiple adsorption points included in the preview building material to obtain multiple adsorption point combinations; wherein, each adsorption point combination includes: one adsorption point in the scene building material and one adsorption point in the preview building material.
5. The method according to claim 4, characterized in that, The step of determining the attribute information of the preview building material based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building material, and the adsorption point information of the preview building material includes: For each of the plurality of adsorption point combinations, the following operation is performed: Based on the adsorption point matching conditions, the adsorption point information corresponding to the current adsorption point combination, and the attribute information of the scene building materials, the attribute information of the preview building materials corresponding to the current adsorption point combination is determined. The adsorption point information corresponding to the current adsorption point combination includes: the adsorption point information of the adsorption points in the scene building materials included in the current adsorption point combination, and the adsorption point information of the adsorption points in the preview building materials included in the current adsorption point combination.
6. The method according to claim 5, characterized in that, The step of attaching the preview building material to the scene building material based on the position coordinates and orientation indicated by the attribute information of the preview building material includes: Based on preset scoring rules, the attribute information of the preview building material corresponding to each group of adsorption point combinations is scored to obtain the scoring result of the attribute information of the preview building material corresponding to each group of adsorption point combinations. The attribute information of the preview building material with the highest score is determined as the final attribute information; According to the posture and position coordinates indicated by the final attribute information, the preview building material is attached to the scene building material.
7. The method according to claim 6, characterized in that, The scoring rules include at least one of the following: the shorter the distance from the position of the preview building material on the scene building material to the center of the graphical user interface, the higher the score; the closer the position of the preview building material on the scene building material to the virtual camera, the higher the score; the smaller the difference between the posture of the preview building material on the scene building material and its posture before being attached, the higher the score.
8. The method according to claim 7, characterized in that, The step of scoring the attribute information of the preview building material corresponding to each group of adsorption point combinations based on preset scoring rules, and obtaining the scoring result of the attribute information of the preview building material corresponding to each group of adsorption point combinations, includes: For each group of adsorption point combinations corresponding to the property information of the preview building material, perform the following operations: The first score is determined based on the distance from the location coordinates indicated by the attribute information of the preview building material corresponding to the current adsorption point combination to the center of the graphical user interface; The second score is determined based on the distance from the location coordinates indicated by the attribute information of the preview building material corresponding to the current adsorption point combination to the virtual camera. A third score is determined based on the posture indicated by the attribute information of the preview building material corresponding to the current adsorption point combination. Based on the first score, the second score, and the third score, the score result corresponding to the attribute information of the preview building material corresponding to the current adsorption point combination is obtained.
9. The method according to claim 8, characterized in that, The step of obtaining the rating result corresponding to the attribute information of the preview building material corresponding to the current adsorption point combination based on the first rating, the second rating, and the third rating includes: If the first score is within a preset first score range, the second score is within a preset second score range, and the third score is within a preset third score range, then the first score is multiplied by the first weight to obtain a first product, the second score is multiplied by the second weight to obtain a second product, and the third score is multiplied by the third weight to obtain a third product. The first product, the second product, and the third product are added together to obtain a summation result. This summation result is then determined as the rating result corresponding to the attribute information of the preview building material for the current adsorption point combination.
10. The method according to claim 9, characterized in that, The method further includes: If the first score is not within the preset first score range, the second score is not within the preset second score range, or the third score is not within the third score range, it is determined that the adsorption points in the scene building materials included in the current adsorption point combination do not match the adsorption points in the preview building materials, and the attribute information of the preview building materials corresponding to the current adsorption point combination is deleted.
11. The method according to claim 10, characterized in that, The method further includes: If the adsorption points in the scene building materials and the adsorption points in the preview building materials contained in each adsorption point combination do not match, the preview building materials are displayed at a specified location in the graphical user interface.
12. A building material adsorption device for games, characterized in that, A graphical user interface is provided through a terminal device, which displays scene building materials already placed in the scene, as well as preview building materials to be placed; wherein, both the scene building materials and the preview building materials are provided with adsorption points, and the adsorption points are represented by a position and two mutually perpendicular vectors; the device includes: The information acquisition module is used to acquire the attribute information and adsorption point information of the scene building materials, as well as the adsorption point information of the preview building materials; wherein, the attribute information includes position coordinates and posture; the adsorption point information includes the position coordinates of the adsorption point and the vector information of two mutually perpendicular vectors; The information determination module is used to determine the attribute information of the preview building material based on preset adsorption point matching conditions, the adsorption point information and attribute information of the scene building material, and the adsorption point information of the preview building material; wherein, the attribute information includes the posture and position coordinates of the preview building material. The building material adsorption module is used to adsorb the preview building material onto the scene building material according to the position coordinates and posture indicated by the attribute information of the preview building material; The posture of the preview building material is determined by the following formula: in, R represents the posture of the preview building material, and R represents the posture of the scene building material. and Two vectors representing the adsorption points of the building materials in the scene. ; and Two vectors representing the adsorption points of the preview building material. .
13. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the building material adsorption method in the game according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement the building material adsorption method in the game as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Intelligent interactive building block system and control method thereof
CN105709435A
Target positioning method and device in virtual interaction scene and electronic equipment
CN110147159A