Virtual prop control method and device, electronic equipment and storage medium
By controlling the assembly process of virtual props using splines, the interactivity and immersion issues of magazine loading in virtual reality games were solved, enhancing player engagement and gaming experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ZITIAO NETWORK TECH CO LTD
- Filing Date
- 2023-08-31
- Publication Date
- 2026-08-04
AI Technical Summary
In existing virtual reality games, the magazine loading process of virtual firearms suffers from problems such as low interactivity, jitter, and path deviation, which affect the player's immersion and experience.
By acquiring the spline corresponding to the main prop, the starting point for the movement of the assembly prop is determined, and the assembly prop is controlled to be assembled onto the main prop along the spline trajectory. Combined with the position information of the simulated insertion point and gripping point, the accuracy and immersion of the assembly process are adjusted.
It enhances players' sense of participation and interactivity in item assembly, improves the game experience, reduces resource consumption, and avoids jitter and path deviation.
Smart Images

Figure CN117148972B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of virtual reality (VR) technology, and more specifically, to a method for controlling virtual props, a device for controlling virtual props, an electronic device, and a computer-readable storage medium. Background Technology
[0002] In virtual reality games, to enhance the realism of the game, virtual gun magazines are usually loaded using either animated loading or physical simulation loading. Animated loading refers to the animation effect that triggers when the player performs a loading operation, which shows the magazine entering the magazine chamber. Physical simulation loading uses physical simulation technology to simulate the magazine insertion process based on the physical behavior of the magazine and collision detection, allowing the player to feel the force feedback and the physical interaction between the magazine and the slot.
[0003] However, when using animated loading, the animation effects during the loading process are pre-designed and the player cannot control the loading trajectory of the magazine, resulting in low interactivity between the player and the game. When using physical simulation loading, the limitations of the physics engine, the accuracy of collision detection, and the influence of physical factors result in phenomena such as magazine jitter, magazine crossing and penetrating the weapon, or magazine path deviation in the displayed loading effect, which affects the player's game immersion and experience. Summary of the Invention
[0004] This disclosure provides at least one method, device, electronic device, and storage medium for controlling virtual items, which helps to enhance players' sense of participation, control, and immersion when equipping items during gameplay.
[0005] This disclosure provides a method for controlling virtual props, applied to a target virtual prop, the target virtual prop including a main prop and assembly props detachable from the main prop, the method including:
[0006] In response to the assembly event being triggered, a spline line corresponding to the main prop is obtained, the spline line including a plurality of spline line points set at intervals; the assembly event is used to indicate that the assembly prop is assembled onto the main prop.
[0007] From the plurality of spline points, determine the target spline point that is closest to the assembly prop, and determine the target spline point as the starting point for the movement of the assembly prop;
[0008] The assembly tool is controlled to move based on the starting point and is assembled onto the main tool according to the movement trajectory indicated by the spline.
[0009] In this embodiment, by acquiring the spline corresponding to the main prop and determining the starting point of the assembly prop's movement from multiple spline points, the assembly prop is controlled to move based on the starting point and be assembled onto the main prop according to the trajectory indicated by the spline. Compared with the animation assembly and physical simulation methods in related technologies, this allows players to experience a sense of participation and control in the assembly process. Furthermore, since the spline is pre-set, the process of assembling the prop onto the main prop is smoother, which helps to enhance the player's immersion in the prop assembly and thus improves the game experience.
[0010] In one possible implementation, before obtaining the spline corresponding to the main prop, the method further includes:
[0011] Determine whether the assembly tool meets the preset assembly conditions;
[0012] The step of obtaining the spline corresponding to the main prop includes:
[0013] If the assembly tool meets the preset assembly conditions, obtain the spline line corresponding to the main tool.
[0014] In this embodiment of the disclosure, it is determined whether the assembly prop meets the preset assembly conditions, and if the assembly prop meets the preset assembly conditions, the spline corresponding to the main prop is obtained. That is, there may be a situation where an assembly event is triggered, but the assembly prop cannot be assembled (for example, other assembly props of the same type as the assembly prop are currently assembled on the main prop). In this way, invalid acquisition of spline is avoided.
[0015] In one possible implementation, the assembly tool is provided with a simulated insertion point; controlling the assembly tool to move based on the starting point and to assemble it onto the main tool according to the movement trajectory indicated by the spline includes:
[0016] The control information of the assembly tool is obtained, and the simulated position information of the simulated insertion point is determined based on the control information of the assembly tool.
[0017] Based on the position information of each spline point on the spline, the simulated position information of the simulated insertion point is adjusted to obtain the adjusted position information corresponding to the simulated position information;
[0018] The assembly tool is controlled to move based on the starting point and according to the adjusted position information.
[0019] In this embodiment of the disclosure, since the points on the spline are the trajectory points on which the assembly prop should move, after determining the simulated position information of the simulated insertion point, the spline is adjusted based on each spline point. In this way, the assembly prop can move according to the trajectory indicated by the spline, which helps to improve the accuracy of determining the movement trajectory of the assembly prop.
[0020] In one possible implementation, the assembly tool is provided with simulated gripping points; determining the simulated position information of the simulated insertion point based on the control information of the assembly tool includes:
[0021] Obtain the position information of the simulated gripping point and the position information of the simulated insertion point;
[0022] Based on the position information of the simulated gripping point, the position information of the simulated insertion point, and the control information of the assembly tool, the simulated position information of the simulated insertion point is determined.
[0023] In this embodiment of the disclosure, since the simulated insertion point is a set point, and after the assembly event, it is considered that the assembly prop is attached to the main prop and is unrelated to the virtual object's hand, in order to make the final effect controlled by the virtual object's hand, the position information is converted based on the simulated gripping point. In this way, the simulated position information of the simulated insertion point can be converted into the position information of the virtual object's hand, thereby enabling the user to experience the sense of participation and immersion in the assembly.
[0024] In one possible implementation, adjusting the simulated position information of the simulated insertion point based on the position information of each spline point on the spline to obtain adjusted position information corresponding to the simulated position information includes:
[0025] Based on the position information of each spline point on the spline and the simulated position information of the simulated insertion point, the distance between the simulated insertion point and each spline point is determined, and the position information of the spline point corresponding to the minimum distance is determined as the adjustment position information.
[0026] In this embodiment of the disclosure, the simulated insertion point is compared with each spline point, and the minimum distance among the distances between the simulated insertion point and each spline point is determined as the adjustment position information. In this way, the accuracy of the simulated position information of the simulated insertion point can be improved.
[0027] In one possible implementation, controlling the assembly tool to move according to the adjusted position information based on the starting point of movement includes:
[0028] Based on the adjusted position information and the relative position of the center point of the assembly prop with respect to the simulated insertion point, the position information of the center point of the assembly prop is determined.
[0029] The center point of the assembly tool is controlled to move based on the starting point and according to the position information of the center point of the assembly tool.
[0030] Here, since the simulated insertion point is separate from the assembly prop and is not a point on the assembly prop, it is necessary to assign the simulated insertion point to the assembly prop. Therefore, in this embodiment of the present disclosure, the position information of the center point of the assembly prop is determined based on the relative position of the center point of the assembly prop with respect to the simulated insertion point, and the center point of the assembly prop is controlled to move according to the determined position information. In this way, the movement effect of the assembly prop can be improved.
[0031] In one optional implementation, the main prop is the main body of a firearm, and the mounting prop is a magazine;
[0032] If a collision between the magazine and the main body of the firearm is detected, the assembly event is determined to have been detected.
[0033] In this embodiment of the disclosure, by detecting a collision between the magazine and the main body of the firearm, an assembly event is determined to have been detected, thereby improving the detection accuracy of the assembly event.
[0034] In an optional implementation, the method further includes:
[0035] An assembly completion event is executed when the assembly tool moves to the end point of the spline; the assembly completion event includes at least one of the following:
[0036] Play preset animation, play preset audio, stop playing assembly audio.
[0037] In this embodiment of the disclosure, if the assembly prop moves to the end of the spline, an assembly completion event is executed, such as playing a preset animation, playing a preset audio, or stopping the assembly audio playback. In this way, the player can be notified immediately whether the assembly is complete without the user having to check, thus improving the user's gaming experience.
[0038] This disclosure provides a control device for a virtual item, applied to a target virtual item. The target virtual item includes a main item and an assembly item detachable from the main item. The device includes:
[0039] The acquisition module is used to acquire a spline corresponding to the main prop in response to the assembly event being triggered. The spline includes a plurality of spline points set at intervals. The assembly event is used to indicate that the assembly prop is assembled onto the main prop.
[0040] The determination module is used to determine the target spline point that is closest to the assembly prop from the plurality of spline points, and to determine the target spline point as the starting point for the movement of the assembly prop;
[0041] The control module is used to control the assembly prop to move based on the starting point and to assemble it onto the main prop according to the movement trajectory indicated by the spline.
[0042] In one possible implementation, the device further includes a determining module, the determining module being used to:
[0043] Determine whether the assembly tool meets the preset assembly conditions;
[0044] The acquisition module is specifically used for:
[0045] If the assembly tool meets the preset assembly conditions, obtain the spline line corresponding to the main tool.
[0046] In one possible implementation, the assembly tool is provided with simulated insertion points; the control module is specifically used for:
[0047] The control information of the assembly tool is obtained, and the simulated position information of the simulated insertion point is determined based on the control information of the assembly tool.
[0048] Based on the position information of each spline point on the spline, the simulated position information of the simulated insertion point is adjusted to obtain the adjusted position information corresponding to the simulated position information;
[0049] The assembly tool is controlled to move based on the starting point and according to the adjusted position information.
[0050] In one possible implementation, the assembly tool is provided with simulated gripping points; the control module is specifically used for:
[0051] Obtain the position information of the simulated gripping point and the position information of the simulated insertion point;
[0052] Based on the position information of the simulated gripping point, the position information of the simulated insertion point, and the control information of the assembly tool, the simulated position information of the simulated insertion point is determined.
[0053] In one possible implementation, the control module is specifically used for:
[0054] Compare the target location with the points on the spline, and find the point on the spline with the smallest distance.
[0055] Based on the position information of each spline point on the spline and the simulated position information of the simulated insertion point, the distance between the simulated insertion point and each spline point is determined, and the position information of the spline point corresponding to the minimum distance is determined as the adjustment position information.
[0056] In one possible implementation, the control module is specifically used for:
[0057] Based on the adjusted position information and the relative position of the center point of the assembly prop with respect to the simulated insertion point, the position information of the center point of the assembly prop is determined.
[0058] The center point of the assembly tool is controlled to move based on the starting point and according to the position information of the center point of the assembly tool.
[0059] In one possible implementation, the main prop is the body of a firearm, and the mounting prop is a magazine; the acquisition module is specifically used for:
[0060] If a collision between the magazine and the main body of the firearm is detected, the assembly event is determined to have been detected.
[0061] In one possible implementation, the control module is further configured to:
[0062] An assembly completion event is executed when the assembly tool moves to the end point of the spline; the assembly completion event includes at least one of the following:
[0063] Play preset animation, play preset audio, stop playing assembly audio.
[0064] This disclosure also provides an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the virtual prop control method described in any of the above possible embodiments are performed.
[0065] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the virtual prop control method described in any of the above possible embodiments.
[0066] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0067] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.
[0068] Figure 1 A flowchart illustrating a method for controlling virtual props provided in some embodiments of this disclosure is shown;
[0069] Figure 2 A schematic diagram of a target virtual prop provided in some embodiments of this disclosure is shown;
[0070] Figure 3 A schematic diagram of splines provided in some embodiments of this disclosure is shown;
[0071] Figure 4 A flowchart illustrating a method for assembling an assembly tool to a main body tool, provided in some embodiments of this disclosure, is shown.
[0072] Figure 5 Schematic diagrams of simulated insertion points and simulated gripping points provided in some embodiments of this disclosure are shown;
[0073] Figure 6 A schematic diagram of a control device for virtual props provided in some embodiments of this disclosure is shown;
[0074] Figure 7 A schematic diagram of a control device for virtual props provided in other embodiments of this disclosure is shown;
[0075] Figure 8 A schematic diagram of an electronic device provided in some embodiments of the present disclosure is shown. Detailed Implementation
[0076] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.
[0077] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0078] In this document, the term "and / or" merely describes a relationship, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.
[0079] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0080] Furthermore, the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0081] Virtual reality games work by using computers to simulate a three-dimensional virtual world, providing users with simulations of their senses such as sight, hearing, and touch, allowing them to experience a sense of immersion and freely interact with objects within that space.
[0082] In virtual reality games, to enhance the realism of the game, virtual gun magazines are usually loaded using either animated loading or physical simulation loading. Animated loading refers to the animation effect that triggers when the player performs a loading operation, which shows the magazine entering the magazine chamber. Physical simulation loading uses physical simulation technology to simulate the magazine insertion process based on the physical behavior of the magazine and collision detection, allowing the player to feel the force feedback and the physical interaction between the magazine and the slot.
[0083] Research has found that when using animated loading, the animation effects during the loading process are pre-designed and players cannot control the loading trajectory of the magazine, resulting in low interactivity between the player and the game. When using physical simulation loading, the limitations of the physics engine, the accuracy of collision detection, and physical factors cause phenomena such as magazine jitter, magazine crossing and penetrating the weapon, or magazine path deviation to appear in the loading effect, thus affecting the player's game immersion and experience.
[0084] Based on the above research, this disclosure provides a method, device, electronic device, and storage medium for controlling virtual props. The method is applied to a target virtual prop, which includes a main prop and an assembly prop detachable from the main prop. In response to an assembly event, the method acquires a spline corresponding to the main prop, the spline including multiple spaced spline points. The assembly event instructs the assembly prop to be assembled onto the main prop. A target spline point closest to the assembly prop is determined from the multiple spline points, and this target spline point is designated as the starting point for the assembly prop's movement. The assembly prop is controlled to move based on the starting point and is assembled onto the main prop according to the movement trajectory indicated by the spline. This allows players to experience the assembly process of attaching the assembly prop to the main prop, enhancing participation and interactivity. Furthermore, determining the movement trajectory of the assembly prop based on points on the spline improves the accuracy of the assembly, thereby enhancing player immersion and gaming experience.
[0085] Furthermore, the animation loading method in related technologies requires binding corresponding skeletons to the main prop and the assembled prop. Since there are many virtual props in virtual games, skeleton binding usually requires a lot of game resources. In this embodiment of the disclosure, prop assembly is realized based on splines, which eliminates the need for skeleton binding of props and helps to save game resources.
[0086] To facilitate understanding of this embodiment, the executing entity of the virtual item control method provided in this disclosure will first be described in detail. The executing entity of the virtual item control method provided in this disclosure is an electronic device. In this embodiment, the electronic device is a server, which can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud storage, big data, and artificial intelligence platforms. In other embodiments, the electronic device can also be a terminal device. This terminal device can be a mobile device, user terminal, handheld device, computing device, or wearable device, etc.
[0087] In other embodiments, the electronic device may also include AR (Augmented Reality) devices, VR (Virtual Reality) devices, MR (Mixed Reality) devices, etc. For example, an AR device may be a mobile phone or tablet with AR functionality, or it may be AR glasses; there is no limitation here. Furthermore, the control method for this virtual prop can also be implemented by the processor calling computer-readable instructions stored in memory.
[0088] Here, the terminology of virtual reality technology involved in the embodiments of this disclosure will be explained accordingly.
[0089] Virtual Scene: The virtual scene can be a simulation of the real world, a semi-simulated / semi-fictional virtual environment, or a purely fictional virtual environment. The virtual scene can be any of a two-dimensional, 2.5-dimensional, or three-dimensional virtual scene; this application does not limit the dimension of the virtual scene. For example, a virtual scene can include a virtual sky scene, a virtual land scene, a virtual ocean scene, a virtual space scene, etc. A virtual sky scene can include virtual elements such as a virtual sun and virtual clouds; a virtual land scene can include virtual environmental elements such as virtual deserts and virtual cities; a virtual ocean scene can include virtual marine life (such as fish and shellfish); and a virtual space scene can include elements such as virtual furniture and virtual appliances.
[0090] Virtual objects: These are movable objects within a virtual scene. These movable objects can be virtual characters, animals, anime characters, etc., such as people, animals, plants, oil drums, walls, and stones displayed in a virtual scene. A virtual object can be a virtual avatar representing the player within that virtual scene. A virtual scene can include at least one virtual object. In virtual reality games, players can control virtual objects to move, interact, and engage in combat within the virtual scene of the game.
[0091] Optionally, the virtual object can be a player character controlled by a VR control device (such as a VR controller), artificial intelligence (AI) in a virtual scene battle, or a non-player character (NPC) set in the virtual scene.
[0092] Taking shooting-type virtual reality games as an example, users can control virtual objects to freely fall, glide, or deploy parachutes in the sky of the virtual scene, run, jump, crawl, and bend forward on land, or swim, float, or dive in the ocean. Of course, users can also control virtual objects to move in the virtual scene by riding virtual vehicles, such as virtual cars, virtual aircraft, and virtual yachts. Users can also control virtual objects to interact with other virtual objects by using virtual props, such as throwing virtual props like grenades, cluster grenades, smoke grenades, stun grenades, and Molotov cocktails, or shooting virtual props like machine guns, pistols, and rifles.
[0093] The virtual prop control method in this embodiment is applied to a target virtual prop, which includes a main prop and an assembly prop that is separable from the main prop.
[0094] Here, the target virtual prop refers to a shooting virtual prop, and the target virtual prop is an item held by the target virtual object (the virtual object corresponding to the player) in the target virtual reality game (the prop can be an item pre-assigned to the target virtual object, or an item picked up by the target virtual object in the virtual reality game). The assembly prop can refer to an accessory of the main prop, and the assembly prop can be combined with the main prop.
[0095] The target virtual props may include virtual cold weapons or virtual firearms. The virtual firearms may include virtual firearms or virtual artillery, and the virtual cold weapons may include virtual bows and arrows, virtual slingshots, virtual swords, virtual knives (virtual long knives, virtual short knives), or virtual daggers, etc.
[0096] In this embodiment of the disclosure, the target virtual prop is a virtual firearm. The main prop can refer to the body of the virtual firearm (e.g., it may include a gun grip (magazine), barrel, trigger, safety, etc.), and the mounting prop can refer to the magazine of the virtual firearm. Optionally, the target virtual prop can also be a virtual artillery piece (e.g., a mortar, howitzer, etc.), where the main prop can refer to the gun barrel (which may include a barrel, breech, breechblock, and muzzle, etc.), and the mounting prop can be a shell.
[0097] In other embodiments, the target virtual prop may refer to a virtual bow and arrow, the main prop may refer to the bow of the virtual bow and arrow, and the assembly prop may refer to the arrow. Alternatively, the target virtual prop may also be a virtual slingshot, where the main prop may refer to the bow of the virtual slingshot (including the bow frame, rubber band, and pouch), and the assembly prop may refer to the projectile of the virtual slingshot; the main prop may refer to a virtual scabbard, and the assembly prop may refer to a virtual sword, with the virtual scabbard and virtual sword forming the target virtual prop; if the target virtual prop is a virtual knife, then the main prop may refer to the scabbard, and the assembly prop may refer to the knife; if the target virtual prop is a virtual dagger, then the main prop may refer to the scabbard, and the assembly prop may refer to the dagger.
[0098] The control method for virtual props provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings. See also Figure 1 The diagram shows a flowchart of a virtual prop control method provided in this embodiment of the present disclosure. The method includes steps S101 to S103, wherein:
[0099] S101, in response to the assembly event being triggered, a spline corresponding to the main prop is obtained, the spline including a plurality of spline points set at intervals; the assembly event is used to indicate that the assembly prop is assembled onto the main prop.
[0100] Here, responding to the assembly event being triggered can mean detecting a collision between the main item and the assembly item. Specifically, this can be detected using a collision box in the game engine. The main function of the game collision box is to perform collision detection and response to determine whether a collision occurs between virtual objects (or virtual items) in the game. In this embodiment, if a collision is detected between the main item and the assembly item, it can be determined that the assembly event has been triggered, and if the assembly event is detected, the assembly item can be assembled onto the corresponding main item.
[0101] For example, please see Figure 2 This is a schematic diagram illustrating the target virtual props provided in some embodiments of this disclosure. For example... Figure 2As shown, taking a virtual firearm as an example, the collision detection box can perform collision detection on the magazine 11 on the main body 10 of the virtual firearm and the virtual magazine 12 that is separate from the main body 10 of the virtual firearm. If a collision is detected between the virtual magazine 12 and the magazine 11, an assembly event is considered to be triggered. Specifically, a preset area can be set at the bottom of the magazine 11. If the top of the virtual magazine 12 collides with the bottom of the magazine 11, a collision event is considered to be triggered.
[0102] It is understood that in virtual scenes, splines are typically used to define and control the paths and trajectories of virtual objects. Therefore, corresponding splines can be pre-set for each virtual prop, thereby pre-setting the motion trajectory of the virtual object. The spline comprises multiple spline points spaced at intervals, where the distances between each spline point can be the same or different. The spline can be a Bezier spline or a B-spline, and is not limited here.
[0103] Here, each main prop has a corresponding spline. For example, the spline corresponding to the main prop 'a' of virtual prop A is L1, and the spline corresponding to the main prop 'b' of virtual prop B is L2. The splines of different main props can be the same or different, which is not limited here. Since one main prop can correspond to multiple attachment props (for example, a virtual gun body can correspond to multiple magazines), the trajectories of these multiple attachment props attached to the main prop are the same.
[0104] For example, if the target virtual prop is a virtual firearm or a virtual artillery, the corresponding spline can refer to the preset trajectory of a magazine being loaded into the virtual firearm or a shell being loaded into the virtual artillery; if the target virtual prop is a virtual bow and arrow, the corresponding spline can refer to the preset trajectory of an arrow being drawn on the bow; if the target virtual prop is a slingshot, the corresponding spline can refer to the preset trajectory of a projectile being drawn on the slingshot; if the target virtual prop is a virtual sword, the corresponding spline can refer to the preset trajectory of a sword being inserted into its scabbard.
[0105] After detecting an assembly event, to ensure that the assembly tool can be successfully assembled onto the main tool, it is first necessary to check whether the assembly tool can be assembled. Only if it is determined that the assembly tool can be assembled should subsequent steps be executed. Specifically, before obtaining the spline corresponding to the main tool, it can be determined whether the assembly tool meets preset assembly conditions. If the assembly tool meets the preset assembly conditions, the spline corresponding to the main tool is obtained. If it is determined that the assembly tool does not meet the preset assembly conditions, subsequent steps are not executed. This avoids invalid acquisition of splines.
[0106] The determination of whether the assembly prop meets the preset assembly conditions can refer to determining whether the assembly prop can be assembled to the main prop. Specifically, it can be determined whether the main prop is currently equipped with other assembly props of the same type as the assembly prop. If so, it is determined that the assembly prop does not meet the preset assembly conditions; if not, it is determined that the assembly prop meets the preset assembly conditions.
[0107] Here, other assembly props of the same type as the assembly props refer to other assembly props that can also be assembled onto the main props and have the same function as the assembly props.
[0108] For example, if the target virtual prop is a virtual firearm and the mounting prop is a virtual magazine, if it is determined that the firearm body is currently equipped with other virtual magazines of the same type as the virtual magazine, then the mounting prop is considered to not meet the preset mounting conditions. If it is determined that the firearm body is not currently equipped with other virtual magazines of the same type as the virtual magazine, then the mounting prop is considered to meet the preset mounting conditions.
[0109] It should be understood that if the main weapon is currently equipped with other attachments of a different type than the attachment being assembled, it will not affect the assembly process of the attachment. For example, if the attachment is a virtual magazine, other attachments of a different type could be scopes, suppressors, muzzle devices, grips, stocks, and side-mounted sights. If the main weapon is currently equipped with any one or more of these other attachments, the assembly process of the virtual magazine will not be affected, and subsequent steps can proceed normally.
[0110] S102, determine the target spline point that is closest to the assembly tool from the plurality of spline points, and determine the target spline point as the starting point for the movement of the assembly tool.
[0111] It should be understood that after obtaining the spline corresponding to the main prop, in order to minimize the deviation between the starting point of the assembled prop's movement and the spline, the target spline point closest to the assembled prop can be determined from multiple spline points, and the target spline point can be determined as the starting point of the assembled prop's movement. In this way, visual effects of misalignment or sudden position changes can be avoided when the assembled prop begins to move.
[0112] Specifically, the distance between the assembly tool and each spline point can be determined, and the minimum distance can be determined from them. The spline point corresponding to the minimum distance can be determined as the target spline point.
[0113] For example, please see Figure 3 This is a schematic diagram of spline lines provided in some embodiments of this disclosure. Figure 3As shown, the spline 20 is a pre-planned assembly trajectory, and the spline 20 includes multiple spline points.
[0114] S103, control the assembly tool to move based on the starting point and assemble it onto the main tool according to the movement trajectory indicated by the spline.
[0115] It is understood that after determining the starting point of the assembly prop, the assembly prop can be controlled to move based on the starting point, and the assembly prop can be controlled to be assembled onto the main prop according to the movement trajectory indicated by the spline. In this way, players can feel the experience of controlling the assembly prop during the assembly process, which helps to enhance the player's immersion and game experience.
[0116] It should be noted that during the assembly of props, the spline will not be displayed on the game screen in the actual game scene.
[0117] In some implementations, when the assembly tool moves to the end of the spline, an assembly completion event is executed, wherein the assembly completion event may also include at least one of the following: playing a preset animation, playing a preset audio, or stopping the playback of assembly audio.
[0118] It is understandable that executing an assembly completion event after assembly is completed can immediately inform players that the assembly process is finished, allowing them to continue playing the game and thus improving their gaming experience.
[0119] The preset audio can be a voice broadcast or a prompt tone, and there is no limitation on it.
[0120] Here, the preset animation and preset audio can be pre-set, and the corresponding assembly completion event can be the same or different for different virtual props, which is not limited here.
[0121] Optionally, during the assembly process of the props, there may be assembly audio. For example, the assembly audio could be the friction sound simulating the assembly prop rubbing against the main prop. Once the assembly is complete, the assembly audio can be stopped.
[0122] It should be understood that there will be virtual objects corresponding to players in the virtual world. During VR games, players can control virtual props in the virtual world through control devices (such as gamepads) in the real world. For example, the player holds a gamepad in the real world, while the virtual object in the virtual world holds an assembly prop and a main prop. By moving the gamepad, the player can control the virtual object to assemble the assembly prop onto the main prop.
[0123] Based on the above analysis, it is clear that during the assembly process, the assembly prop needs to be assembled according to its control information. Specifically, regarding step S103, when controlling the assembly prop to move based on the starting point and assemble onto the main prop according to the movement trajectory indicated by the spline, please refer to [link to relevant documentation]. Figure 4 It may include the following S1031~S1033:
[0124] S1031, acquire the control information of the assembly tool, and determine the simulated position information of the simulated insertion point based on the control information of the assembly tool.
[0125] The simulated insertion point refers to the insertion point set for the assembly prop. It should be noted that the simulated insertion point refers to a point in the virtual world, rather than a point that actually exists on the assembly prop.
[0126] The control information for the assembled props can be obtained by coordinate transformation of the actual control information of the player's real-world control device. This control information may include position information, direction information, displacement information, and posture information.
[0127] For example, the real control information of the player's real control device in the real world coordinate system can be obtained, and the real control information can be converted into the control information of the assembled prop based on the transformation relationship between the real world coordinate system and the virtual world coordinate system. For example, if the player moves the handle held in his left hand forward, the magazine held in the left hand of the virtual object corresponding to the player will also move forward, and the position information of the assembled prop in the virtual world coordinate system can be determined.
[0128] Here, since the assembly prop is already attached to the main prop, in order to make the final effect appear as if the virtual object's hand is pushing the assembly prop, it is necessary to determine the imaginary position of the assembly prop attached to the virtual object's hand (that is, the simulated position information of the simulated insertion point). In other words, the simulated position information of the simulated insertion point is the position information of the virtual object's hand when it holds the assembly prop.
[0129] Optionally, when acquiring the control information of the assembly prop and determining the simulated position information of the simulated insertion point based on the control information of the assembly prop, the position information of the simulated gripping point and the position information of the simulated insertion point can be acquired, and the simulated position information of the simulated insertion point can be determined based on the position information of the simulated gripping point, the position information of the simulated insertion point, and the control information of the assembly prop.
[0130] It should be understood that in this embodiment, a simulated gripping point is needed as an intermediate quantity for position conversion so that the simulated insertion point and the control information of the assembly tool can be associated.
[0131] For example, please see Figure 5 This is a schematic diagram of simulated insertion points and simulated gripping points provided in some embodiments of this disclosure. Figure 5 As shown, the assembly prop 50 is provided with a simulated insertion point 51 and a virtual gripping point 52.
[0132] The position information of the simulated insertion point 51 is the position information of the simulated insertion point 51 in the virtual world coordinate system AttachOrigin->World, the position information of the virtual gripping point 52 is World->GripSlot(HandController), and the control information of the assembly prop is HandController->World. By multiplying the position information of the simulated gripping point, the inverse matrix of the position information of the simulated insertion point, and the control information of the assembly prop, the simulated position information of the simulated insertion point 51 can be obtained.
[0133] Here, the A->B symbol represents A relative to object B in the coordinate system. The positional information of the simulated insertion point and simulated gripping point will change as the control information of the assembly prop changes.
[0134] It should be noted that the position information of the simulated insertion point 51 is different from the simulated position information of the simulated insertion point 51. That is, the position information of the simulated insertion point 51 only represents the position information of the simulated insertion point 51 in the virtual world coordinate system, while the simulated position information of the simulated insertion point 51 represents the position information of the simulated insertion point 51 when the equipment prop is attached to the hand of the virtual object in the virtual world coordinate system.
[0135] S1032, based on the position information of each spline point on the spline, the simulated position information of the simulated insertion point is adjusted to obtain the adjusted position information corresponding to the simulated position information.
[0136] Here, since the simulated position information of the simulated insertion point will also change during the assembly process of the assembly prop, in order for the assembly prop to move according to the trajectory indicated by the spline, it is necessary to adjust the simulated position information of the simulated insertion point based on the position information of each spline point on the spline, so as to obtain the adjusted position information corresponding to the simulated position information.
[0137] Specifically, the distance between the simulated insertion point and each spline point can be determined based on the simulated position information of the insertion point and the position information of each spline point. The position information of the spline point with the smallest distance is then determined as the adjusted position information. For example, if the spline points include S1, S2, S3, and S4, and the simulated insertion point is A, then the distances between the simulated insertion point A and S1, S2, S3, and S4 are determined respectively. If the distance between A and S2 is the smallest, then the simulated position information of the insertion point A is adjusted to the position information of the spline point S2.
[0138] S1033, control the assembly tool to move according to the adjusted position information based on the starting point of movement.
[0139] It can be understood that after obtaining the adjustment position information corresponding to the simulated position information, the assembly prop can be controlled to move according to the adjustment position information based on the starting point of movement, so that the movement trajectory of the assembly prop is the trajectory indicated by the spline.
[0140] Optionally, since the aforementioned embodiments all use the simulated insertion point as a reference to determine the movement trajectory, and the simulated insertion point is only a pre-set point, not a real point on the assembly prop, in order to make the assembly process of the assembly prop smoother, the center point of the assembly prop can be controlled to move based on the movement starting point according to the adjustment position information.
[0141] Based on the above considerations, after determining the adjustment position information, the position information of the center point of the assembly prop can be determined based on the relative position of the center point with respect to the simulated insertion point and the simulated position information of the simulated insertion point (which is also the adjustment position information). This allows the center point of the assembly prop to move according to the position information of the center point based on the starting point of the movement. In this way, the assembly prop can be assembled according to the trajectory indicated by the spline, which can improve the smoothness of the assembly and thus enhance the immersive experience of prop assembly.
[0142] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0143] Based on the same inventive concept, this disclosure also provides a virtual prop control device corresponding to the virtual prop control method. Since the principle of the device in this disclosure for solving the problem is similar to the virtual prop control method described above in this disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0144] Reference Figure 6 The diagram shows a control device for a virtual prop provided in some embodiments of this disclosure. The device is applied to a target virtual prop, which includes a main prop and assembly props detachable from the main prop. The device 600 includes:
[0145] The acquisition module 610 is used to acquire a spline corresponding to the main prop in response to the assembly event being triggered. The spline includes a plurality of spline points set at intervals. The assembly event is used to indicate that the assembly prop is assembled onto the main prop.
[0146] The determining module 620 is used to determine the target spline point that is closest to the assembly prop from the plurality of spline points, and to determine the target spline point as the starting point for the movement of the assembly prop;
[0147] The control module 630 is used to control the assembly prop to move based on the starting point and to be assembled onto the main prop according to the movement trajectory indicated by the spline.
[0148] Reference Figure 7 The diagram shown is a schematic of a control device for virtual props provided in other embodiments of this disclosure. The device 600 further includes a judgment module 640, which is used for:
[0149] Determine whether the assembly tool meets the preset assembly conditions;
[0150] The acquisition module 610 is specifically used for:
[0151] If the assembly tool meets the preset assembly conditions, obtain the spline line corresponding to the main tool.
[0152] In one possible implementation, the assembly tool is provided with simulated insertion points; the control module 630 is specifically used for:
[0153] The control information of the assembly tool is obtained, and the simulated position information of the simulated insertion point is determined based on the control information of the assembly tool.
[0154] Based on the position information of each spline point on the spline, the simulated position information of the simulated insertion point is adjusted to obtain the adjusted position information corresponding to the simulated position information;
[0155] The assembly tool is controlled to move based on the starting point and according to the adjusted position information.
[0156] In one possible implementation, the assembly tool is provided with simulated gripping points; the control module 630 is specifically used for:
[0157] Obtain the position information of the simulated gripping point and the position information of the simulated insertion point;
[0158] Based on the position information of the simulated gripping point, the position information of the simulated insertion point, and the control information of the assembly tool, the simulated position information of the simulated insertion point is determined.
[0159] In one possible implementation, the control module 630 is specifically used for:
[0160] Compare the target location with the points on the spline, and find the point on the spline with the smallest distance.
[0161] Based on the position information of each spline point on the spline and the simulated position information of the simulated insertion point, the distance between the simulated insertion point and each spline point is determined, and the position information of the spline point corresponding to the minimum distance is determined as the adjustment position information.
[0162] In one possible implementation, the control module 630 is specifically used for:
[0163] Based on the adjusted position information and the relative position of the center point of the assembly prop with respect to the simulated insertion point, the position information of the center point of the assembly prop is determined.
[0164] The center point of the assembly tool is controlled to move based on the starting point and according to the position information of the center point of the assembly tool.
[0165] In one possible implementation, the main prop is the main body of a firearm, and the mounting prop is a magazine; the acquisition module 610 is specifically used for:
[0166] If a collision between the magazine and the main body of the firearm is detected, the assembly event is determined to have been detected.
[0167] In one possible implementation, the control module 630 is further configured to:
[0168] An assembly completion event is executed when the assembly tool moves to the end point of the spline; the assembly completion event includes at least one of the following:
[0169] Play preset animation, play preset audio, stop playing assembly audio.
[0170] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.
[0171] Based on the same technical concept, this disclosure also provides an electronic device. (See also...) Figure 8 The diagram shown is a structural schematic of an electronic device 800 provided in an embodiment of this disclosure, including a processor 801, a memory 802, and a bus 803. The memory 802 is used to store execution instructions and includes a main memory 8021 and an external memory 8022. The main memory 8021, also called internal memory, is used to temporarily store computational data in the processor 801, as well as data exchanged with external memory 8022 such as a hard disk. The processor 801 exchanges data with the external memory 8022 through the main memory 8021.
[0172] In this embodiment, the memory 802 is specifically used to store application code that executes the solution of this application, and its execution is controlled by the processor 801. That is, when the electronic device 800 is running, the processor 801 communicates with the memory 802 through the bus 803, so that the processor 801 executes the application code stored in the memory 802, and then executes the method described in any of the foregoing embodiments.
[0173] The memory 802 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0174] Processor 801 may be an integrated circuit chip with signal processing capabilities. The aforementioned processor 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.
[0175] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 800. In other embodiments of this application, the electronic device 800 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0176] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of controlling the virtual props in the above method embodiments. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0177] This disclosure also provides a computer program product carrying program code. The program code includes instructions that can be used to execute the steps of controlling virtual props in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.
[0178] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0179] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.
[0180] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0181] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0182] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion 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 an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.
[0183] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure 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, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such 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 this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.
Claims
1. A method for controlling virtual props, characterized in that, Applied to a target virtual item, the target virtual item comprising a main item and assembly items detachable from the main item, the method comprising: In response to the assembly event being triggered, a spline line corresponding to the main prop is obtained, the spline line including a plurality of spline line points set at intervals; the assembly event is used to indicate that the assembly prop is assembled onto the main prop. From the plurality of spline points, determine the target spline point that is closest to the assembly prop, and determine the target spline point as the starting point for the movement of the assembly prop; The assembly tool is controlled to move based on the starting point and is assembled onto the main tool according to the movement trajectory indicated by the spline.
2. The method according to claim 1, characterized in that, Before obtaining the spline corresponding to the main prop, the method further includes: Determine whether the assembly tool meets the preset assembly conditions; The step of obtaining the spline corresponding to the main prop includes: If the assembly tool meets the preset assembly conditions, obtain the spline line corresponding to the main tool.
3. The method according to claim 1, characterized in that, The assembly tool is provided with simulated insertion points; controlling the assembly tool to move based on the starting point and assemble it onto the main tool according to the movement trajectory indicated by the spline includes: The control information of the assembly tool is obtained, and the simulated position information of the simulated insertion point is determined based on the control information of the assembly tool. Based on the position information of each spline point on the spline, the simulated position information of the simulated insertion point is adjusted to obtain the adjusted position information corresponding to the simulated position information; The assembly tool is controlled to move based on the starting point and according to the adjusted position information.
4. The method according to claim 3, characterized in that, The assembly tool is equipped with simulated gripping points; The step of determining the simulated position information of the simulated insertion point based on the control information of the assembly tool includes: Obtain the position information of the simulated gripping point and the position information of the simulated insertion point; Based on the position information of the simulated gripping point, the position information of the simulated insertion point, and the control information of the assembly tool, the simulated position information of the simulated insertion point is determined.
5. The method according to claim 3, characterized in that, The step of adjusting the simulated position information of the simulated insertion point based on the position information of each spline point on the spline to obtain adjusted position information corresponding to the simulated position information includes: Based on the position information of each spline point on the spline and the simulated position information of the simulated insertion point, the distance between the simulated insertion point and each spline point is determined, and the position information of the spline point corresponding to the minimum distance is determined as the adjustment position information.
6. The method according to claim 3, characterized in that, The control of moving the assembly tool based on the starting point according to the adjusted position information includes: Based on the adjustment position information and the relative position of the center point of the assembly prop with respect to the simulated insertion point, the position information of the center point of the assembly prop is determined. The center point of the assembly tool is controlled to move based on the starting point and according to the position information of the center point of the assembly tool.
7. The method according to any one of claims 1-6, characterized in that, The main prop is the main body of the firearm, and the mounting prop is the magazine; If a collision between the magazine and the main body of the firearm is detected, the assembly event is determined to have been detected.
8. The method according to any one of claims 1-6, characterized in that, The method further includes: An assembly completion event is executed when the assembly tool moves to the end point of the spline; the assembly completion event includes at least one of the following: Play preset animation, play preset audio, stop playing assembly audio.
9. A control device for virtual props, characterized in that, Applied to a target virtual prop, the target virtual prop including a main prop and assembly props detachable from the main prop, the device includes: The acquisition module is used to acquire a spline corresponding to the main prop in response to the assembly event being triggered. The spline includes a plurality of spline points set at intervals. The assembly event is used to indicate that the assembly prop is assembled onto the main prop. The determination module is used to determine the target spline point that is closest to the assembly prop from the plurality of spline points, and to determine the target spline point as the starting point for the movement of the assembly prop; The control module is used to control the assembly prop to move based on the starting point and to assemble it onto the main prop according to the movement trajectory indicated by the spline.
10. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the virtual prop control method as described in any one of claims 1 to 8 are performed.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the virtual prop control method as described in any one of claims 1 to 8.