Virtual item control method, device, equipment, storage medium and program product

By introducing real-time swing and inertial swing mechanisms into virtual props, the problem of insufficient authenticity of virtual props movement is solved, and the realistic nature and user experience of the game are improved.

CN114288651BActive Publication Date: 2024-12-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210006518.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-05
Publication Date
2024-12-17
Estimated Expiration
2042-01-05

AI Technical Summary

Technical Problem

In the prior art, the movement of virtual props during the rotation of viewing angle is poor, and the swing direction does not conform to the motion characteristics of the actual object.

Method used

By controlling the virtual props to swing in real time during the rotation of the viewing angle, ensure that their direction is biased from the viewing angle of the virtual object, simulate the lag effect, and swing inertia according to the target viewing angle after the viewing angle is stopped, simulating the inertial motion of the object stopping motion.

Benefits of technology

It improves the authenticity of the movement of virtual props during the rotation of perspective, and enhances the realistic nature and user experience of the game.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114288651B_ABST
    Figure CN114288651B_ABST
Patent Text Reader

Abstract

The present application discloses a control method, device, equipment, storage medium and program product for virtual props, and relates to the field of computer technology. The method comprises: in response to a perspective rotation operation, controlling a virtual object to rotate the perspective, and the virtual object holds a virtual prop; in the process of the virtual object rotating the perspective, controlling the virtual prop to swing in the direction of the real-time perspective of the virtual object, wherein there is a deviation between the real-time prop orientation of the virtual prop and the real-time perspective direction of the virtual object; in response to the perspective rotation operation stopping, controlling the virtual prop to swing inertially in the target perspective direction of the virtual object, the target perspective direction is the perspective direction when the virtual object stops rotating the perspective, and the prop orientation of the virtual prop when the inertially swinging stops is consistent with the target perspective direction. The method provided by the present application can improve the authenticity of the virtual prop following the perspective movement process during the rotation of the perspective, which helps to improve the realism of the game.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a control method, device, equipment, storage medium and program product of a virtual prop. Background Art

[0002] In the game, the user can control the rotation of the virtual object's perspective. During the rotation of the virtual object's perspective, the virtual props held by the virtual object move along with the virtual object's perspective.

[0003] In the related art, when the virtual object's perspective rotates, the virtual prop moves synchronously with the virtual object's perspective, and after the perspective stops rotating, the virtual prop swings in a fixed direction. However, when a person holds a real object and moves it, it does not move synchronously with the person's perspective, and after the object stops moving, the object swings in a different direction.

[0004] It can be seen that in the related art, during the rotation of the virtual object perspective, the movement process of the virtual props is less realistic. Summary of the invention

[0005] The embodiments of the present application provide a control method, device, equipment, storage medium and program product for virtual props, which can improve the authenticity of the virtual props following the movement of the view during the rotation of the view, and help improve the realism of the game. The technical solution is as follows:

[0006] On the one hand, an embodiment of the present application provides a method for controlling a virtual prop, the method comprising:

[0007] In response to the view angle rotation operation, controlling the virtual object to rotate the view angle, wherein the virtual object holds a virtual prop;

[0008] During the process of rotating the viewing angle of the virtual object, controlling the virtual prop to swing toward the real-time viewing angle of the virtual object, wherein there is a deviation between the real-time prop orientation of the virtual prop and the real-time viewing angle of the virtual object;

[0009] In response to the view rotation operation stopping, the virtual prop is controlled to swing inertially according to the target view direction of the virtual object, the target view direction is the view direction when the virtual object stops rotating the view, and the prop orientation of the virtual prop when the inertially swinging stops is consistent with the target view direction.

[0010] On the other hand, an embodiment of the present application provides a control device for a virtual prop, the device comprising:

[0011] A view angle rotation module, used for controlling a virtual object to rotate its view angle in response to a view angle rotation operation, wherein the virtual object holds a virtual prop;

[0012] A first control module is used to control the virtual prop to swing toward the real-time viewing direction of the virtual object during the process of the virtual object rotating the viewing angle, wherein there is a deviation between the real-time prop orientation of the virtual prop and the real-time viewing direction of the virtual object;

[0013] The second control module is used to control the virtual prop to swing inertially according to the target viewing direction of the virtual object in response to the view rotation operation stopping, wherein the target viewing direction is the viewing direction when the virtual object stops rotating the view, and the prop orientation of the virtual prop when the inertially swinging stops is consistent with the target viewing direction.

[0014] On the other hand, an embodiment of the present application provides a computer device, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the control method of the virtual props as described in the above aspects.

[0015] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, a code set or an instruction set is stored in the computer-readable storage medium, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the control method of the virtual props as described in the above aspects.

[0016] On the other hand, an embodiment of the present application provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the control method of the virtual props provided in the above aspect.

[0017] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:

[0018] In the embodiment of the present application, in the process of controlling the rotation of the perspective of the virtual object, the virtual prop held by the virtual object can be controlled to swing in the direction of the real-time perspective of the virtual object, and in the swinging process, there is a deviation between the real-time prop orientation of the virtual prop and the real-time perspective direction of the virtual object, that is, the virtual prop and the perspective of the virtual object do not move synchronously, thereby achieving a lag effect in the movement of the virtual prop, and after the virtual object stops rotating its perspective, the virtual prop is controlled to swing inertially in the direction of the target perspective, simulating the inertial movement of the object when it stops moving, thereby improving the authenticity of the virtual prop following the perspective movement process during the rotation of the perspective, which helps to improve the realism of the game. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A schematic diagram showing an implementation environment provided by an exemplary embodiment of the present application is shown;

[0020] Figure 2 A flowchart showing a method for controlling a virtual prop provided by an exemplary embodiment of the present application is shown;

[0021] Figure 3 A schematic diagram of an interface for a virtual object viewing angle rotation process provided by an exemplary embodiment of the present application is shown;

[0022] Figure 4 A schematic top view of a virtual prop performing inertial swing provided by an exemplary embodiment of the present application is shown;

[0023] Figure 5 A flowchart showing a method for controlling a virtual prop provided by another exemplary embodiment of the present application is shown;

[0024] Figure 6 A schematic diagram showing a three-dimensional rotation angle provided by an exemplary embodiment of the present application is shown;

[0025] Figure 7 A vector diagram of a real-time viewing direction and a real-time prop orientation provided by an exemplary embodiment of the present application is shown;

[0026] Figure 8 A schematic diagram showing a virtual prop provided by an exemplary embodiment of the present application swinging around a virtual axis;

[0027] Fig. 9 A flowchart showing a method for controlling a virtual prop provided by another exemplary embodiment of the present application is shown;

[0028] Fig.10 A flowchart showing a method for controlling a virtual prop provided by another exemplary embodiment of the present application is shown;

[0029] Fig.11 is a structural block diagram of a virtual object control device provided by an exemplary embodiment of the present application;

[0030] Fig.12 A schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION

[0031] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0032] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.

[0033] First, the nouns involved in the embodiments of the present application are introduced:

[0034] Virtual environment: is a virtual environment displayed (or provided) when an application is running on a terminal. The virtual environment can be a simulation of the real world, a semi-simulation and semi-fictitious environment, or a purely fictitious environment. The virtual environment can be any one of a two-dimensional virtual environment, a 2.5-dimensional virtual environment, and a three-dimensional virtual environment, and this application does not limit this. The following embodiments are described by taking a three-dimensional virtual environment as an example.

[0035] Virtual object: refers to an active object in a virtual environment. The active object can be a virtual person, a virtual animal, an animated character, etc., such as a person or an animal displayed in a three-dimensional virtual environment. Optionally, the virtual object is a three-dimensional model created based on animation skeleton technology. Each virtual object has its own shape and volume in the three-dimensional virtual environment and occupies a part of the space in the three-dimensional virtual environment.

[0036] Virtual props: refers to props that virtual objects can use in virtual environments, including virtual props that can change the attribute values ​​of other virtual objects, supply props, defensive props, virtual props displayed by the hands when virtual objects release skills, and parts of the virtual object's body, such as hands and legs. Among them, virtual props that can change the attribute values ​​of other virtual objects include long-distance virtual props, close-range virtual props, and throwing virtual props.

[0037] Please refer to Figure 1 , which shows a schematic diagram of an implementation environment provided by an embodiment of the present application. The implementation environment may include: a first terminal 110, a server 120 and a second terminal 130.

[0038] The first terminal 110 runs an application 111 that supports a virtual environment, and the application 111 can be a multiplayer online battle program. When the first terminal runs the application 111, the user interface of the application 111 is displayed on the screen of the first terminal 110. The application 111 can be any one of a multiplayer online tactical competitive (MOBA) game, a battle royale shooting game, and a simulation game (SLG). In this embodiment, the application 111 is an example of a first-person shooting (FPS) game. The first terminal 110 is a terminal used by a first user 112, and the first user 112 uses the first terminal 110 to control a first virtual object located in a virtual environment to perform activities. The first virtual object can be called the main control virtual object of the first user 112. The activities of the first virtual object include, but are not limited to: adjusting body posture, crawling, walking, running, riding, flying, jumping, driving, picking up, shooting, attacking, throwing, and releasing skills. Schematically, the first virtual object is a first virtual character, such as a simulated character or an anime character.

[0039] The second terminal 130 runs an application 131 that supports a virtual environment, and the application 131 may be a multiplayer online battle program. When the second terminal 130 runs the application 131, the user interface of the application 131 is displayed on the screen of the second terminal 130. The client may be any one of a MOBA game, a battle royale shooting game, and an SLG game. In this embodiment, the application 131 is an FPS game as an example. The second terminal 130 is a terminal used by a second user 132. The second user 132 uses the second terminal 130 to control a second virtual object in a virtual environment to perform activities. The second virtual object may be referred to as a master virtual character of the second user 132. Schematically, the second virtual object is a second virtual character, such as a simulated character or an anime character.

[0040] Optionally, the first virtual object and the second virtual object are in the same virtual world. Optionally, the first virtual object and the second virtual object may belong to the same camp, the same team, the same organization, have a friend relationship, or have temporary communication permissions. Optionally, the first virtual object and the second virtual object may belong to different camps, different teams, different organizations, or have a hostile relationship.

[0041] Optionally, the applications running on the first terminal 110 and the second terminal 130 are the same, or the applications running on the two terminals are the same type of applications on different operating system platforms (Android or IOS). The first terminal 110 may refer to one of a plurality of terminals, and the second terminal 130 may refer to another of a plurality of terminals. This embodiment is only illustrated by taking the first terminal 110 and the second terminal 130 as examples. The device types of the first terminal 110 and the second terminal 130 are the same or different, and the device types include at least one of: a smart phone, a tablet computer, an e-book reader, a Moving Picture Experts Group Audio Layer III (MP3) player, a Moving Picture Experts Group Audio Layer IV (MP4) player, a laptop portable computer, and a desktop computer.

[0042] Figure 1 Only two terminals are shown, but in different embodiments, there are multiple other terminals that can access the server 120. Optionally, there are one or more terminals corresponding to the developer, on which a development and editing platform for an application supporting a virtual environment is installed. The developer can edit and update the application on the terminal, and transmit the updated application installation package to the server 120 via a wired or wireless network. The first terminal 110 and the second terminal 130 can download the application installation package from the server 120 to update the application.

[0043] The first terminal 110 , the second terminal 130 and other terminals are connected to the server 120 via a wireless network or a wired network.

[0044] The server 120 includes at least one of a single server, a server cluster consisting of multiple servers, a cloud computing platform, and a virtualization center. The server 120 is used to provide background services for applications that support virtual environments. Optionally, the server 120 undertakes the main computing work and the terminal undertakes the secondary computing work; or, the server 120 undertakes the secondary computing work and the terminal undertakes the main computing work; or, the server 120 and the terminal adopt a distributed computing architecture for collaborative computing.

[0045] In an illustrative example, the server 120 includes a memory 121, a processor 122, a user account database 123, a battle service module 124, and a user-oriented input / output interface (I / O interface) 125. The processor 122 is used to load instructions stored in the server 120 and process data in the user account database 123 and the battle service module 124; the user account database 123 is used to store data of user accounts used by the first terminal 110, the second terminal 130 and other terminals, such as the user account's avatar, the user account's nickname, the user account's combat power index, and the service area where the user account is located; the battle service module 124 is used to provide multiple battle rooms for users to fight, such as 1V1 battle, 3V3 battle, 5V5 battle, etc.; the user-oriented I / O interface 125 is used to establish communication and exchange data with the first terminal 110 and / or the second terminal 130 through a wireless network or a wired network.

[0046] The method provided in this embodiment can be used to Figure 1 In the first terminal 110 or the second terminal 130 in the implementation environment shown or other terminals in the implementation environment, for the convenience of description, the method will be schematically described below by taking the method applied to a computer device as an example.

[0047] Please refer to Figure 2 , which shows a flowchart of a virtual prop control method provided by an exemplary embodiment of the present application. This embodiment is described by taking the method used in a computer device as an example, and the method includes the following steps:

[0048] Step 201, in response to a view angle rotation operation, controlling a virtual object to rotate the view angle, and the virtual object holds a virtual prop.

[0049] In a possible implementation, the perspective rotation operation refers to an operation of changing the perspective of the virtual object. The perspective rotation operation may be a triggering operation of a perspective rotation control or a rotation operation of a virtual environment screen. When the computer device receives the perspective rotation operation, the virtual object is controlled to rotate the perspective. When the virtual object rotates the perspective, the virtual prop held by the virtual object moves in the direction of the perspective rotation.

[0050] Optionally, the viewing angle rotation operation may be a rotation in any direction, such as rotating the viewing angle to the left, rotating the viewing angle to the right, rotating the viewing angle upward, or rotating the viewing angle downward, etc.

[0051] Optionally, the virtual props held by the virtual object may be virtual firearms, throwing props, or melee attack props, etc.

[0052] When the virtual object does not hold a virtual prop, the object held by the virtual object may be a limb of the virtual object, such as an arm of the virtual object.

[0053] Indicatively, Figure 3 As shown, a view rotation control 301 is displayed in the virtual environment screen, and the user can change the view by triggering the view rotation control 301 .

[0054] Step 202 : during the process of the virtual object rotating its viewing angle, controlling the virtual prop to swing toward the real-time viewing angle of the virtual object, wherein there is a deviation between the real-time prop orientation of the virtual prop and the real-time viewing angle of the virtual object.

[0055] When the virtual object rotates its viewing angle, the computer device will control the virtual props to move with the viewing angle. During the movement, the virtual props will swing in the direction of the real-time viewing angle of the virtual object, thereby simulating the effect of a slight shaking during the movement of the object.

[0056] By controlling the virtual props to swing toward the real-time viewing direction of the virtual object, a deviation exists between the real-time prop direction and the real-time viewing direction, thereby achieving a hysteresis effect of the movement of the virtual props and improving the simulation authenticity.

[0057] Indicatively, Figure 3 As shown, when the virtual object rotates its viewing angle upward, at a certain moment, the real-time viewing angle direction of the virtual object is 302 , while the real-time prop direction is 303 , there is a deviation between the two, and the virtual prop swings toward the real-time viewing angle direction 302 .

[0058] Step 203, in response to the view rotation operation stopping, controlling the virtual prop to swing inertially according to the target view direction of the virtual object, the target view direction is the view direction when the virtual object stops rotating the view, and the prop orientation of the virtual prop when the inertially swinging stops is consistent with the target view direction.

[0059] Optionally, when the triggering operation of the view rotation control ends, or the rotation operation of the virtual environment screen ends, it is determined that the view rotation operation stops. When the computer device determines that the view rotation operation stops, it determines the target view direction of the virtual object.

[0060] Among them, inertial swing refers to the small shaking of the virtual props in the target viewing direction. When the viewing direction is different, the direction of inertial swing is also different. For example, when the viewing angle is rotated left and right, after the viewing angle stops rotating, the virtual props will perform inertial swing in the left and right direction; when the viewing angle is rotated up and down, after the viewing angle stops rotating, the virtual props will perform inertial swing in the up and down direction.

[0061] When the virtual prop stops its inertial swing, the prop orientation of the virtual prop will stop in the target viewing direction, that is, the prop orientation is consistent with the target viewing direction after the inertial swing stops.

[0062] Indicatively, Figure 4 As shown, when the virtual object stops rotating the viewing angle and the target viewing angle direction is 401 , the virtual prop performs an inertial swing according to the target viewing angle direction 401 , and after the inertial swing ends, the prop orientation of the virtual prop is consistent with the target viewing angle direction 401 .

[0063] To sum up, in the embodiment of the present application, in the process of controlling the rotation of the perspective of the virtual object, the virtual props held by the virtual object can be controlled to swing in the direction of the real-time perspective of the virtual object, and in the swinging process, there is a deviation between the real-time prop orientation of the virtual props and the real-time perspective direction of the virtual object, that is, the perspective of the virtual props and the virtual object do not move synchronously, thereby achieving a lag effect in the movement of the virtual props, and after the virtual object stops rotating its perspective, the virtual props are controlled to swing inertially in the direction of the target perspective, simulating the inertial motion of the object when it stops moving, thereby improving the authenticity of the virtual props following the perspective movement process during the rotation of the perspective, which helps to improve the realism of the game.

[0064] In the embodiment of the present application, a spring model is introduced, and the viewing direction of the virtual object and the prop orientation of the virtual prop are used as the two ends of the spring model, so as to achieve the hysteresis effect of the prop movement during the viewing angle rotation process and the inertial swing effect of the prop movement stopping after the viewing angle rotation stops. The following will be described with exemplary embodiments.

[0065] Please refer to Figure 5 , which shows a flow chart of a method for controlling a virtual prop provided by another exemplary embodiment of the present application. This embodiment is described by taking the method used in a computer device as an example, and the method includes the following steps:

[0066] Step 501, in response to a view angle rotation operation, controlling a virtual object to rotate the view angle, and the virtual object holds a virtual prop.

[0067] The implementation of this step can refer to the above step 201, which will not be described in detail in this embodiment.

[0068] Step 502, based on the real-time viewing angle direction and the prop orientation of the previous frame, the real-time prop orientation is determined, where the prop orientation of the previous frame is the prop orientation of the virtual prop in the previous frame image.

[0069] In a possible implementation, the virtual prop is controlled to swing by updating the swing parameters frame by frame. The real-time viewing angle direction is different from the real-time prop orientation, and the real-time prop orientation of the virtual prop in each frame is determined based on the real-time viewing angle direction of the current frame and the prop orientation of the virtual prop in the previous frame. The prop orientation of the previous frame is the prop orientation of the virtual prop in the previous frame image, and the prop orientation of the previous frame is the prop orientation of the virtual prop in the previous frame after the swing based on the swing parameters of the previous frame. That is, the prop orientation of the virtual prop is updated by iterative updating, and the swing of the virtual prop is controlled based on the prop orientation of the virtual prop.

[0070] Optionally, based on the real-time viewing angle direction and the prop orientation of the previous frame, determining the real-time prop orientation may include the following steps:

[0071] Step 502a, determining the real-time prop swing speed of the virtual prop based on the real-time viewing angle direction, the prop orientation of the previous frame, and the prop swing speed of the previous frame.

[0072] In this embodiment, a spring model is introduced, and the spring model affects the swinging process of the virtual prop, so that the real-time prop orientation of the virtual prop is different from the real-time view direction, thereby simulating the effect of the virtual prop moving lagging during the view movement process. In a possible implementation, the real-time prop orientation is determined by the spring model, and the swing parameters of the virtual prop are determined according to the real-time prop orientation. In this process, the computer device first determines the real-time prop swing speed of the virtual prop in the current frame, and then obtains the direction change amount based on the real-time prop swing speed and the frame length, and the direction change amount is the difference between the real-time prop orientation and the prop orientation of the previous frame.

[0073] Optionally, determining the real-time prop swing speed may include the following steps:

[0074] Step 1: Determine the spring model corresponding to the virtual prop, where the spring model includes the elastic coefficient and the resistance coefficient of the virtual prop during the swinging process.

[0075] Optionally, the spring model is used to simulate the force on the virtual prop during the swinging process. The spring model includes the elastic coefficient and the resistance coefficient corresponding to the virtual prop. The elastic coefficient and the resistance coefficient are used to control the swinging amplitude of the virtual prop during the swinging process.

[0076] In order to improve the simulation of different swinging conditions of different real objects during the motion process, in one possible implementation, different spring models are set for different virtual props, so that when different virtual props are held during the rotation of the virtual object, different virtual props have different swinging effects, thereby improving the simulation realism.

[0077] In the process of determining the real-time prop swing speed corresponding to the virtual prop, the computer device may determine the spring model of the virtual prop currently held by the virtual object from among the pre-stored spring models corresponding to different virtual props.

[0078] Step 2: Input the real-time viewing direction, the prop orientation in the previous frame, and the prop swing speed in the previous frame into the spring model to obtain the real-time elastic force and real-time resistance of the virtual prop.

[0079] After obtaining the spring model, the computer device can determine the real-time elastic force and real-time resistance of the virtual prop in the current frame based on the spring model.

[0080] In a possible implementation, the real-time elastic force can be determined based on the real-time viewing direction, the prop orientation of the previous frame, and the elastic coefficient. That is, the elastic force on the virtual prop is determined by multiplying the deformation amount by the elastic coefficient in the following manner:

[0081]

[0082] in, It indicates the real-time viewing direction. It means the direction of the prop in the previous frame, and Stiffness is the elastic coefficient.

[0083] The real-time viewing direction and the prop orientation of the previous frame are both two-dimensional vectors. The computer device can obtain the three-dimensional rotation amount Rotation corresponding to the real-time viewing direction and the prop orientation of the previous frame, wherein the three-dimensional rotation amount Rotation includes the pitch angle pitch, the yaw angle yaw and the roll angle roll. Schematically, as Figure 6 As shown, the pitch angle pitch is the rotation angle around the x-axis, the yaw angle yaw is the rotation angle around the y-axis, and the roll angle roll is the rotation angle around the z-axis.

[0084] However, in the actual swinging process of the virtual prop, there is only swinging in pitch and yaw, so it is only necessary to obtain the yaw component and the pitch component and represent them with a two-dimensional vector.

[0085] Among them, the real-time resistance is used to simulate the air resistance during the movement of the virtual props. Therefore, the real-time resistance can be determined by the prop swing speed and resistance coefficient of the previous frame. The method is as follows:

[0086]

[0087] in, It is the swing speed of the prop in the previous frame, and Damping is the drag coefficient.

[0088] Among them, the prop swing speed is also a two-dimensional vector with direction.

[0089] Step 3: Based on the real-time elastic force and the real-time resistance, determine the real-time swing acceleration of the virtual prop.

[0090] After obtaining the real-time elastic force and the real-time resistance, the real-time force acting on the virtual prop can be obtained based on the real-time elastic force and the real-time resistance, wherein the real-time force acting on the virtual prop is:

[0091]

[0092] After the real-time force on the virtual prop is determined, the real-time swing acceleration is determined according to the real-time force. Optionally, the mass of the virtual prop is set to 1, so the real-time swing acceleration is the real-time force.

[0093] Step 4: Determine the real-time prop swing speed based on the prop swing speed of the previous frame and the real-time swing acceleration.

[0094] After the computer device determines the real-time swing acceleration, it can use the real-time swing acceleration and frame length to determine the speed change between the prop swing speed of the previous frame and the real-time prop swing acceleration of the virtual prop in the current frame, thereby obtaining the real-time prop swing speed based on the speed change.

[0095] Optionally, the real-time prop swing speed is determined by:

[0096]

[0097] in, is the real-time prop swing speed, is the swing speed of the prop in the previous frame, DeltaTime is the frame duration, Real-time force.

[0098] In a possible implementation, the frame duration is a fixed duration, which can be determined according to the frame rate corresponding to the current picture. For example, when the frame rate is 60, the frame duration can be determined to be 1 / 60s.

[0099] In another possible implementation, the frame duration is the real-time frame duration, that is, the current frame duration, so that the real-time prop swing speed of the virtual props in the current frame is determined according to the real duration corresponding to each frame. In the process of displaying the picture, there may be a freeze in the picture. If the picture freezes, it is easy to cause the real-time frame duration of the current frame to be too long, affecting the real-time prop swing speed and the value of the real-time prop orientation of the current frame. And because the real-time prop orientation is updated frame by frame, it also affects the determination of the subsequent virtual prop orientation, thereby affecting the virtual prop swing process. Therefore, in order to reduce the impact of freezes on the swing of virtual props, in this embodiment, the minimum number of updates within one second is set, so as to determine the duration threshold according to the number. When the acquired real-time frame duration exceeds the duration threshold, the duration threshold can be determined as the frame duration.

[0100] Optionally, the minimum number of updates within one second can be determined according to the frame rate. For example, when the frame rate is 60, the minimum number of updates within one second can be set to 60, and the duration threshold is 1 / 60s. If the real-time frame duration of the current frame is greater than 1 / 60s, 1 / 60s is determined as the frame duration. If the real-time frame duration of the current frame is less than 1 / 60s, the real-time frame duration can be determined as the frame duration.

[0101] Step 502b, determining the direction change amount based on the real-time prop swing speed and frame duration.

[0102] After the computer device obtains the real-time prop swing speed, the direction change can be obtained based on the product of the real-time prop swing speed and the frame length. The direction change is the difference between the prop direction of the previous frame and the real-time prop direction.

[0103] Step 502c, based on the prop orientation and orientation change amount of the previous frame, determine the real-time prop orientation.

[0104] After the direction change is determined, the real-time prop direction can be obtained based on the direction change and the prop direction of the previous frame. The calculation method is as follows:

[0105]

[0106] in, This is the real-time prop orientation. is the prop orientation of the previous frame, is the direction change.

[0107] Step 503: Determine the swing parameter of the virtual prop based on the real-time direction deviation between the real-time prop orientation and the real-time viewing angle direction.

[0108] The swing parameter is used to indicate the amplitude of the swing of the virtual prop. The computer device finally controls the virtual prop to swing in the direction of the real-time viewing angle based on the swing parameter.

[0109] In a possible implementation, the computer device determines the swing parameter by a real-time direction deviation between the real-time prop orientation and the real-time viewing angle direction. The real-time direction deviation may be:

[0110]

[0111] in, That means real-time direction deviation. is the real-time viewing direction, The real-time prop orientation.

[0112] Indicatively, Figure 7 As shown, for and That is, the real-time view direction and the real-time direction deviation are used to control the virtual props to swing to the real-time prop direction.

[0113] The real-time direction deviation is the deviation between the real-time viewing direction and the real-time prop orientation. If the swing of the virtual prop is directly controlled based on the real-time direction deviation, the virtual prop may be offset too much, resulting in poor simulation effect. Therefore, the swing parameter can be determined according to the real-time direction deviation, and the swing of the virtual prop can be controlled based on the swing parameter. This method may include the following steps:

[0114] Step 503a: determining a candidate direction deviation based on the real-time direction deviation and the deviation threshold, where the deviation threshold is the maximum deviation value between the viewing direction of the virtual object and the prop orientation of the virtual prop.

[0115] Therefore, in this embodiment, a deviation threshold is set to control the swing amplitude of the virtual props to avoid excessive swing. The deviation threshold is the maximum deviation value between the viewing angle direction of the virtual object and the prop orientation of the virtual props, to avoid excessive deviation between the real-time prop orientation of the virtual props and the real-time viewing angle direction.

[0116] In a possible implementation, one of the real-time direction deviation and the deviation threshold is selected as the candidate direction deviation.

[0117] Optionally, when the real-time direction deviation is less than the deviation threshold, the real-time direction deviation is determined as a candidate direction deviation.

[0118] Optionally, when the real-time direction deviation is greater than the deviation threshold, the deviation threshold is determined as the candidate direction deviation.

[0119] After the deviation threshold is determined as the candidate direction deviation, the real-time prop orientation needs to be updated based on the candidate direction deviation. The updated real-time prop orientation is:

[0120]

[0121] in, This is the updated real-time prop orientation. is the candidate direction deviation.

[0122] Step 503b, interpolating the candidate direction deviations to obtain the target direction deviation.

[0123] In this embodiment, the swing parameters are updated frame by frame to control the swing of the virtual props frame by frame. Therefore, if the swing parameters between two frames differ too much, the swing amplitude of the virtual props will be relatively abrupt. Therefore, in order to make the swing process of the virtual props smooth, in this embodiment, after obtaining the candidate direction deviation, the candidate direction deviation is also interpolated to obtain the target direction deviation. The interpolation process may include the following process.

[0124] Step 1: Get the target direction deviation of the previous frame and the interpolation speed corresponding to the virtual props.

[0125] In order to avoid a large difference in the swing parameters between two frames, in a possible implementation, an interpolation process is performed in the interval between the target direction deviation of the previous frame and the candidate direction deviation determined in the current frame.

[0126] Optionally, interpolation is performed through interpolation speed and frame duration. The interpolation speed is used to control the size of the interpolation. When the interpolation speed is larger, the difference between the target direction deviation determined by the current frame and the target direction deviation of the previous frame is larger. Correspondingly, the difference between the swing parameters of the current frame and the swing parameters of the previous frame is larger, so that the swing amplitude of the virtual prop jumps larger, that is, the swing effect is more shaky.

[0127] Step 2: Based on the interpolation speed, the target direction deviation of the previous frame and the candidate direction deviation are interpolated to obtain the target direction deviation.

[0128] In a possible implementation, the interpolation processing is performed according to the interpolation speed as follows:

[0129]

[0130] in, Indicates the target direction deviation, Indicates the target direction deviation of the previous frame, It represents the candidate direction deviation, and speed represents the interpolation speed.

[0131] Step 503c, adjusting the target direction deviation based on the swing coefficient to obtain the swing parameter of the virtual prop, and the swing coefficient is used to control the overall prop swing amplitude of the virtual prop.

[0132] In this embodiment, the overall swing amplitude of the virtual prop is controlled by setting the swing coefficient. Different virtual props may correspond to different swing coefficients. Optionally, the swing coefficient is positively correlated with the overall swing amplitude.

[0133] After determining the target direction deviation of the virtual prop, the computer device further adjusts the target direction deviation through the swing coefficient, thereby obtaining the swing parameter of the virtual prop.

[0134] Optionally, the swing parameter can be: Among them, alpha is the swing coefficient.

[0135] Step 504: Based on the swing parameter, the virtual prop is controlled to swing toward the real-time viewing angle.

[0136] In a possible implementation, based on the swing parameter, the virtual prop is controlled to swing in the direction of the real-time viewing angle in the current frame, and in the process of determining the swing parameter in the next frame, the swing parameter of the next frame is determined based on the prop direction after the swing of the virtual prop in the current frame and the real-time viewing angle direction of the next frame. That is, the virtual prop is controlled to swing in the direction of the real-time viewing angle by updating the swing parameter in each frame.

[0137] The process of determining the current frame swing parameter is schematically described below.

[0138] When the elastic coefficient Stiffness of the virtual prop is 200 and the resistance coefficient Damping is 10, if the current viewing direction is {Pitch=21.7033615,Yaw=197.361603,Roll=0.00000000}, determine the real-time viewing direction of the current frame is (197.36, 21.70), and accordingly, the prop orientation of the previous frame is obtained When the prop swing speed in the previous frame is (-168.05, 16.34) and (1.56, 76.38), the process of determining the real-time prop orientation in the current frame is as follows:

[0139] Substituting the above values ​​into the following formula, we can obtain the real-time force of the virtual prop as (1066.4, 308.2).

[0140]

[0141] It should be noted that in the process of calculating the difference between the real-time viewing direction and the prop direction of the previous frame, the shortest distance needs to be calculated. That is, when the difference between 197.36 and -168.05 is 365.41, the shortest distance needs to be determined. The shortest distance is the difference between 365.41 and modulo 360, which is 5.41.

[0142] After the real-time force is obtained, the real-time prop swing speed can be obtained based on the frame length 1 / 60s and the prop swing speed of the previous frame (1.56, 76.38). That is, by substituting it into the following formula, the real-time prop swing speed can be obtained as (19.33, 81.52).

[0143]

[0144] After that, the real-time prop swing speed and the prop swing direction of the previous frame can be used to obtain the real-time prop direction, which can be substituted into the following formula to obtain the real-time prop direction is (-167.73, 17.70).

[0145]

[0146] The real-time direction deviation is obtained by using the real-time prop orientation and the real-time viewing direction, which can be substituted into the following formula to obtain the real-time direction deviation as (5.09, 4.00).

[0147]

[0148] The deviation threshold corresponding to the virtual prop is 5, so the candidate direction deviation is determined to be (5.00, 4.00).

[0149] After obtaining the candidate direction deviation, the real-time prop orientation needs to be updated based on the candidate direction deviation. The updated real-time prop orientation is (-167.64, 17.70).

[0150] The target direction deviation of the virtual prop in the previous frame is (0.046, 1.34), which needs to be interpolated. The interpolation speed is 4. After interpolation, the target direction deviation is (0.376, 1.52).

[0151] Among them, the swing coefficient is 0.2. The swing coefficient is adjusted for the target direction deviation, and the swing parameter is (0.0752, 0.304). Converting it to a three-dimensional rotation value gives:

[0152] RotOffset={Pitch=0.304, Yaw=0.0752, Roll=0}

[0153] Step 505: in response to the view angle rotation operation stopping, obtain the real-time prop swing speed.

[0154] After the view rotation operation stops, the computer device controls the virtual prop to swing inertially according to the target view direction. In this process, the virtual prop is controlled to swing inertially based on the way of updating the swing parameters frame by frame.

[0155] The method of updating the swing parameters frame by frame may refer to the method of determining the swing parameters of the virtual props based on the real-time direction deviation between the real-time prop orientation and the real-time viewing angle in the above step.

[0156] After the view rotation operation stops, the real-time view direction will no longer change, that is, it stops at the target view direction, so that the swing parameter of the virtual prop is determined based on the direction deviation between the target view direction and the real-time prop orientation. After the view rotation operation stops, the real-time prop orientation of the virtual prop is determined in the same manner as in step 502, and will not be described in detail in this embodiment.

[0157] After the view rotation operation stops, in the process of updating the swing parameters frame by frame, the real-time prop swing speed is obtained based on the prop swing speed of the previous frame and the real-time force acting on the virtual prop.

[0158] Step 506: When the real-time prop swing speed is greater than the speed threshold, the virtual prop is controlled to swing inertially in the target viewing direction of the virtual object.

[0159] When the real-time prop swing speed of the virtual prop is less than a certain value, the virtual prop will continue to be in a slight shaking state. In order to avoid the virtual prop from continuing to swing slightly, a speed threshold is set in this embodiment. When the acquired real-time prop swing speed is greater than the speed threshold, the real-time prop orientation can continue to be determined according to the real-time prop swing speed, and the real-time direction deviation between the target viewing angle direction and the real-time prop orientation can be used to determine the swing parameters of the virtual prop, thereby controlling the virtual prop to swing inertially based on the swing parameters.

[0160] Step 507: When the real-time prop swing speed is less than the speed threshold, the virtual prop is controlled to stop inertial swing.

[0161] When the real-time prop swing speed is less than the speed threshold, it indicates that the virtual prop is shaking at a very small amplitude. At this time, the virtual prop can be controlled to stop the inertial swing, thereby optimizing the inertial swing process of the virtual prop and saving a certain performance overhead.

[0162] In this embodiment, a spring model is introduced to determine the real-time prop orientation of the virtual prop according to the force applied to the virtual prop, thereby determining the swing parameter frame by frame based on the deviation between the real-time prop orientation and the target viewing angle direction, and controlling the virtual prop to swing frame by frame, thereby achieving the hysteresis effect of the virtual prop movement during the viewing angle rotation process and the inertial swing effect of the virtual prop movement stopping after the viewing angle rotation stops. On the one hand, the swing effect of objects in the real world can be simulated to improve the authenticity of the game simulation; on the other hand, in the process of controlling the swing of the virtual prop, the computer calculates the swing parameter frame by frame, thereby controlling the virtual prop to swing based on the swing parameter, without the need to design a specific swing animation, which can save animation resources and memory usage during program operation.

[0163] In this embodiment, when the virtual prop is controlled to swing, the swing is performed with the virtual axis corresponding to the virtual prop as the center, and the axis positions of the virtual axes corresponding to different virtual props are different.

[0164] Optionally, when the virtual object rotates its viewing angle, the virtual prop is controlled to swing toward the real-time viewing angle with the virtual axis as the center.

[0165] Optionally, in response to the view rotation operation stopping, the virtual prop is controlled to swing inertially in the target view direction with the virtual axis as the center.

[0166] That is, after obtaining the swing parameters, the virtual prop is controlled to swing around the virtual axis based on the real-time viewing direction. Figure 8 As shown, based on the virtual axis 801 of the virtual prop, the virtual prop is swung to a position 802 .

[0167] When controlling the swing of a virtual prop, the skeleton animation corresponding to the virtual prop can be controlled to rotate around the virtual axis.

[0168] In a possible implementation, when the axis position of the virtual axis of the virtual prop is different, different swing effects are achieved.

[0169] When the first distance is smaller than the second distance, the swing amplitude of the head position of the virtual prop is smaller than the swing amplitude of the tail position of the virtual prop. The first distance is the distance between the head position of the virtual prop and the axis position, and the second distance is the distance between the tail position of the virtual prop and the axis position.

[0170] When the first distance is greater than the second distance, the swing amplitude of the head position of the virtual prop is greater than the swing amplitude of the tail position of the virtual prop.

[0171] Indicatively, when the virtual prop is a virtual firearm, when the virtual axis position is close to the virtual firearm head position, when swinging based on the virtual axis, the swing amplitude of the virtual firearm head is smaller than the swing amplitude of the virtual firearm tail. When the virtual axis position is close to the virtual firearm tail position, when swinging based on the virtual axis, the swing amplitude of the virtual firearm head is larger than the swing amplitude of the virtual firearm tail.

[0172] When setting the axis position of the virtual axis corresponding to different virtual props, it can be determined according to the swing requirements. If the swing amplitude of the head position of the virtual prop is required to be larger, the axis position of the virtual axis can be set near the tail position of the virtual prop; if the swing amplitude of the tail position of the virtual prop is required to be larger, the axis position of the virtual axis can be set near the head position of the virtual prop.

[0173] In addition to the axis position of the virtual axis, different virtual props correspond to different elastic coefficients, resistance coefficients, deviation thresholds, interpolation speeds, and swing coefficients, so that different virtual props have different swing effects and improve the simulation realism.

[0174] In a possible implementation, different parameters corresponding to the virtual props may be determined according to the swing effect requirements of the virtual props.

[0175] When the virtual object rotates its viewing angle, the swing of the virtual prop is controlled to simulate the swing of the real moving object. When the prop type corresponding to the virtual prop is a heavy prop, the swing amplitude of the virtual prop needs to be controlled within a smaller range. In this case, this can be achieved by changing the elastic coefficient and the resistance coefficient. The elastic coefficient is positively correlated with the swing amplitude. Therefore, when the swing amplitude of the virtual prop needs to be controlled to be smaller, a smaller elastic coefficient can be set, and the resistance coefficient needs to be adjusted accordingly during the adjustment of the elastic coefficient.

[0176] To further control the swing amplitude, the deviation threshold and the swing coefficient can be changed. The deviation threshold limits the orientation deviation of the virtual prop, and the swing coefficient adjusts the overall swing amplitude of the prop. The stability of the virtual prop can also be adjusted by adjusting the interpolation speed of the virtual prop. When the weight of the virtual prop is large, the swing amplitude of the virtual prop needs to be controlled to be smaller and the stability is higher. Therefore, a smaller deviation threshold, swing coefficient and interpolation speed can be set.

[0177] In the process of setting the axis position of the virtual axis of different virtual props, it can be determined according to the prop length and swing requirement of the virtual prop.

[0178] Indicatively, when the virtual item is a medium-sized virtual item, the parameters corresponding to the heavy-duty virtual item are shown in Table 1:

[0179] Table 1

[0180] Elastic coefficient 200 Drag coefficient 10 Deviation threshold 5 Swing coefficient 0.2 Interpolation speed 4 Virtual axis position X: 50.0; Y: 0.0; Z: 0.0

[0181] When the virtual props are micro virtual props, the corresponding parameters are shown in Table 2:

[0182] Table 2

[0183] Elastic coefficient 420 Drag coefficient 15 Deviation threshold 20 Swing coefficient 0.4 Interpolation speed 6 Virtual axis position X: 10.0; Y: 0.0; Z: 0.0

[0184] Among them, the weight of the medium-sized virtual prop is greater than that of the micro-sized virtual prop, and the swing amplitude of the medium-sized virtual prop needs to be smaller than that of the micro-sized virtual prop. The medium-sized virtual prop is more stable during movement than the micro-sized virtual prop. Therefore, the elasticity coefficient of the medium-sized virtual prop is smaller than that of the micro-sized virtual prop. The elasticity coefficient of the medium-sized virtual prop is 200, and the elasticity coefficient of the micro-sized virtual prop is 420. When the elasticity coefficient is large, the resistance coefficient also needs to be increased to avoid the virtual gun swinging for too long. Therefore, the resistance coefficient of the micro-sized virtual prop is 15, which is greater than the resistance coefficient of the medium-sized virtual prop of 10. And accordingly, the deviation threshold, swing coefficient and interpolation speed of the medium-sized virtual prop are all smaller than the deviation threshold, swing coefficient and interpolation speed of the micro-sized virtual prop.

[0185] In a possible implementation, when the swing amplitude of the virtual prop head position is set to be smaller than the swing amplitude of the virtual prop tail position, the virtual axis position can be close to the virtual prop head position. For example, when the virtual prop is a virtual firearm, the virtual axis position can be close to the gun head position. Combining the examples in Table 1 and Table 2, the prop length of a medium-sized virtual prop is 65cm, the origin is the virtual prop tail position, and the x-axis is the prop orientation. The virtual axis position can be set to be 15cm away from the virtual prop head position, that is, X is 50.

[0186] When the virtual prop is a heavy virtual prop, since the weight of the heavy virtual prop is greater than that of the medium virtual prop, the swing amplitude needs to be controlled to be smaller. Therefore, the parameters corresponding to the heavy virtual prop can be shown in Table 3:

[0187] Table 3

[0188] Elastic coefficient 300 Drag coefficient 20 Deviation threshold 3 Swing coefficient 0.2 Interpolation speed 4 Virtual axis position X: 60.0; Y: 0.0; Z: 0.0

[0189] When the virtual prop is a light virtual prop, its weight is less than that of an assault rifle and greater than that of a micro virtual prop. Its corresponding parameters are shown in Table 4:

[0190] Table 4

[0191] Elastic coefficient 280 Drag coefficient 12 Deviation threshold 5 Swing coefficient 0.2 Interpolation speed 6 Virtual axis position X: 60.0; Y: 0.0; Z: 0.0

[0192] In another possible implementation, when the virtual object does not hold a virtual prop, that is, has no hands, during the corresponding rotation of the virtual object, the hand position of the virtual object also swings in the direction of the real-time viewing angle, and after the viewing angle rotation operation stops, the hand position of the virtual object swings inertially in the direction of the target viewing angle. Schematically, the parameters corresponding to the hand position of the virtual object can be shown in Table 5:

[0193] Table 5

[0194] Elastic coefficient 200 Drag coefficient 10 Deviation threshold 20 Swing coefficient 0.2 Interpolation speed 6 Virtual axis position X: 0.0; Y: 0.0; Z: 0.0

[0195] After controlling the virtual object to rotate the viewing angle, the computer device first determines whether the current swing function is turned on. Only when the swing function is turned on can the virtual prop be controlled to swing. The following will be described with exemplary embodiments.

[0196] Please refer to Fig. 9 , which shows a flow chart of a method for controlling a virtual prop provided by another exemplary embodiment of the present application. This embodiment is described by taking the method used in a computer device as an example, and the method includes the following steps:

[0197] Step 901, in response to a view angle rotation operation, controlling a virtual object to rotate the view angle, and the virtual object holds a virtual prop.

[0198] The implementation of this step can refer to the above step 201, which will not be described in detail in this embodiment.

[0199] Step 902: When the virtual object is rotating its viewing angle and the swing function is turned on, the virtual prop is controlled to swing in the direction of the real-time viewing angle of the virtual object.

[0200] In a possible implementation, the computer device may determine whether the swing function is turned on according to the prop states of different virtual props.

[0201] When the virtual props are in use, the stability requirement of the virtual props is high. For example, when the virtual object is rotating the view angle, the virtual props are used to attack. At this time, the stability requirement of the virtual props is high. If the virtual props swing, it will affect the use of the virtual props. Therefore, when the virtual props are not in use, it is determined that the swing function is turned on. When the virtual props are in use, it is determined that the swing function is turned off.

[0202] In another possible implementation, whether the swing function is turned on can be determined based on the quality of the virtual environment picture. Since the user may use a low-quality mode to display the virtual environment picture, or the current computer device can only support a low-quality model. Under the low-quality model, the picture quality requirement is low, and there is no need to display the swing of the virtual props during the rotation of the view and the inertial swing process after the rotation of the view stops, thereby avoiding screen freezes. Therefore, when the virtual environment picture is of low quality, it is determined that the swing function is turned off, and when the virtual environment picture quality is of high quality, it is determined that the swing function is turned on.

[0203] Alternatively, in another possible implementation, a swing function on or off control may be provided, for example, in a screen setting interface or a virtual environment screen. When the computer device receives a user's on operation for the swing function control, it determines that the swing function is on, and when the computer device receives a user's off operation for the swing function control, it determines that the swing function is off.

[0204] During the process of the virtual object rotating the viewing angle, if the swing function is confirmed to be turned on, the required props can be controlled to swing in the direction of the real-time viewing angle of the virtual object.

[0205] Step 903: in response to the view rotation operation stopping, the virtual prop is controlled to swing inertially in the target view direction of the virtual object.

[0206] When the view rotation operation stops, the virtual prop is controlled to swing inertially in the target view direction of the virtual object.

[0207] Step 904, when the virtual object rotates its viewing angle and the swing function is not enabled, the virtual prop is controlled to rotate synchronously with the viewing angle of the virtual object, wherein during the synchronous rotation, the direction of the real-time prop is the same as the direction of the real-time viewing angle.

[0208] During the process of the virtual object rotating its viewing angle, if the swing function is not turned on, the virtual props are controlled to rotate synchronously with the viewing angle of the virtual object. During this process, the virtual props do not swing in the direction of the real-time viewing angle, and the real-time prop direction of the virtual props remains the same as the real-time viewing angle direction of the virtual object.

[0209] And if the swing function is not turned on, the virtual props will not have an inertial swing process after the view stops rotating.

[0210] In this embodiment, when the virtual props are in use, the swing function of the virtual props is turned off, thereby helping to improve the stability of the use of the virtual props. And when the current image quality is low, the swing function of the virtual props is turned off to avoid image freezes.

[0211] In a possible implementation, the control process of the virtual props can be as follows: Fig.10 As shown:

[0212] Step 1001, in response to a view angle rotation operation, controlling the virtual object to rotate the view angle.

[0213] Step 1002, determine whether the swing function is turned on, if so, execute step 1003, if not, execute step 1014.

[0214] Step 1003: determine the real-time force acting on the virtual prop based on the real-time viewing angle direction and the prop orientation of the previous frame.

[0215] Step 1004, determining the real-time prop swing speed based on the real-time force and the prop speed of the previous frame.

[0216] Step 1005 , determining whether the real-time prop swing speed is greater than a speed threshold, if so, executing step 1006 , if not, executing step 1012 .

[0217] Step 1006, determining the real-time prop orientation based on the real-time prop swing speed and the prop orientation of the previous frame.

[0218] Step 1007, determining the real-time direction deviation between the real-time prop direction and the real-time viewing direction.

[0219] Step 1008 : determining a candidate direction deviation based on the real-time direction deviation and the deviation threshold.

[0220] Step 1009: Update the real-time prop orientation based on the candidate orientation deviation.

[0221] Step 1010, interpolating the candidate direction deviations to obtain the target direction deviation.

[0222] Step 1011, adjusting the target direction deviation by the swing coefficient to obtain the swing parameter.

[0223] Step 1012: Based on the swing parameter, control the virtual prop to swing around the virtual axis.

[0224] Step 1013, controlling the virtual prop to stop swinging.

[0225] Step 1014, controlling the virtual props to rotate synchronously with the virtual object perspective.

[0226] Fig.11 is a structural block diagram of a control device for a virtual prop provided by an exemplary embodiment of the present application. Fig.11 As shown, the device comprises:

[0227] A view rotation module 1101 is used to control a virtual object to rotate its view in response to a view rotation operation, wherein the virtual object holds a virtual prop;

[0228] A first control module 1102 is used to control the virtual prop to swing toward the real-time viewing direction of the virtual object during the process of the virtual object rotating the viewing angle, wherein there is a deviation between the real-time prop orientation of the virtual prop and the real-time viewing direction of the virtual object;

[0229] The second control module 1103 is used to control the virtual prop to swing inertially according to the target viewing direction of the virtual object in response to the view rotation operation stopping, wherein the target viewing direction is the viewing direction when the virtual object stops rotating the view, and the prop orientation of the virtual prop when the inertially swinging stops is consistent with the target viewing direction.

[0230] Optionally, the first control module 1102 includes:

[0231] a parameter determination unit, configured to determine a swing parameter of the virtual prop based on a real-time direction deviation between the real-time prop orientation and the real-time viewing angle direction;

[0232] The first control unit is used to control the virtual prop to swing towards the real-time viewing angle based on the swing parameter.

[0233] Optionally, the swing parameter is determined frame by frame.

[0234] Optionally, the device further comprises:

[0235] The orientation determination module is used to determine the real-time prop orientation based on the real-time viewing angle direction and the prop orientation of the previous frame, where the prop orientation of the previous frame is the prop orientation of the virtual prop in the previous frame image.

[0236] Optionally, the orientation determination module includes:

[0237] A speed determination unit, configured to determine a real-time prop swing speed of the virtual prop based on the real-time viewing angle direction, the prop orientation of the previous frame, and the prop swing speed of the previous frame;

[0238] A change amount determination unit, used to determine the direction change amount based on the real-time prop swing speed and frame duration;

[0239] The orientation determining unit is used to determine the real-time prop orientation based on the prop orientation of the previous frame and the orientation change.

[0240] Optionally, the speed determination unit is further used to:

[0241] Determining a spring model corresponding to the virtual prop, wherein the spring model includes an elastic coefficient and a resistance coefficient of the virtual prop during the swinging process;

[0242] Input the real-time viewing angle direction, the prop orientation of the previous frame, and the prop swing speed of the previous frame into the spring model to obtain the real-time elastic force and real-time resistance of the virtual prop;

[0243] Determining a real-time swing acceleration of the virtual prop based on the real-time elastic force and the real-time resistance;

[0244] The real-time prop swing speed is determined based on the prop swing speed of the previous frame and the real-time swing acceleration.

[0245] Optionally, the parameter determination unit is further used to:

[0246] Determining a candidate direction deviation based on the real-time direction deviation and a deviation threshold, wherein the deviation threshold is a maximum deviation value between the viewing direction of the virtual object and the prop orientation of the virtual prop;

[0247] Performing interpolation processing on the candidate direction deviations to obtain a target direction deviation;

[0248] The target direction deviation is adjusted based on the swing coefficient to obtain the swing parameter of the virtual prop, and the swing coefficient is used to control the overall prop swing amplitude of the virtual prop.

[0249] Optionally, the parameter determination unit is further used to:

[0250] When the real-time direction deviation is less than the deviation threshold, determining the real-time direction deviation as the candidate direction deviation;

[0251] When the real-time direction deviation is greater than the deviation threshold, the deviation threshold is determined as the candidate direction deviation.

[0252] Optionally, the parameter determination unit is further used to:

[0253] Obtain the target direction deviation of the previous frame and the interpolation speed corresponding to the virtual prop;

[0254] Based on the interpolation speed, the interpolation process is performed on the target direction deviation of the previous frame and the candidate direction deviation to obtain the target direction deviation.

[0255] Optionally, the second control module 1103 includes:

[0256] A speed acquisition unit, configured to acquire a real-time prop swing speed in response to the view angle rotation operation stopping;

[0257] A second control unit is used to control the virtual prop to perform inertial swing according to the target viewing direction of the virtual object when the real-time prop swing speed is greater than a speed threshold;

[0258] The device also includes:

[0259] The stopping module is used to control the virtual prop to stop inertial swinging when the swinging speed of the real-time prop is less than the speed threshold.

[0260] Optionally, the first control module 1102 is further configured to:

[0261] Controlling the virtual prop to swing in the direction of the real-time viewing angle with the virtual axis as the center;

[0262] The second control module 1103 is further configured to:

[0263] The virtual prop is controlled to perform the inertial swing with the virtual axis as the center according to the target viewing direction, wherein the axis positions of the virtual axes corresponding to different virtual props are different.

[0264] Optionally, the axis position is determined according to a swing requirement of the virtual prop.

[0265] When the first distance is smaller than the second distance, the swing amplitude of the head position of the virtual prop is smaller than the swing amplitude of the tail position of the virtual prop, the first distance is the distance between the head position of the virtual prop and the axis position, and the second distance is the distance between the tail position of the virtual prop and the axis position;

[0266] When the first distance is greater than the second distance, the swing amplitude of the head position of the virtual prop is greater than the swing amplitude of the tail position of the virtual prop.

[0267] Optionally, the first control module 1102 is further configured to:

[0268] When the swing function is turned on, controlling the virtual prop to swing toward the real-time viewing direction of the virtual object;

[0269] The device also includes:

[0270] The synchronous movement module is used to control the virtual prop to rotate synchronously with the perspective of the virtual object when the swing function is not turned on, wherein during the synchronous rotation, the direction of the real-time prop is the same as the direction of the real-time perspective.

[0271] Optionally, the device further comprises:

[0272] A first determining module, configured to determine that the swing function is turned on when the virtual prop is in an unused state;

[0273] or,

[0274] The second determining module is used to determine whether the swing function is turned on when the image quality of the virtual environment is high quality.

[0275] In the embodiment of the present application, in the process of controlling the rotation of the perspective of the virtual object, the virtual prop held by the virtual object can be controlled to swing in the direction of the real-time perspective of the virtual object, and in the swinging process, there is a deviation between the real-time prop orientation of the virtual prop and the real-time perspective direction of the virtual object, that is, the virtual prop and the perspective of the virtual object do not move synchronously, thereby achieving a lag effect in the movement of the virtual prop, and after the virtual object stops rotating its perspective, the virtual prop is controlled to swing inertially in the direction of the target perspective, simulating the inertial movement of the object when it stops moving, thereby improving the authenticity of the virtual prop following the perspective movement process during the rotation of the perspective, which helps to improve the realism of the game.

[0276] Please refer to Fig.12 , which shows a schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application. Specifically, the computer device 1200 includes a central processing unit (CPU) 1201, a system memory 1204 including a random access memory 1202 and a read-only memory 1203, and a system bus 1205 connecting the system memory 1204 and the central processing unit 1201. The computer device 1200 also includes a basic input / output system (I / O system) 1206 that helps transmit information between various devices in the computer, and a large-capacity storage device 1207 for storing an operating system 1213, application programs 1214 and other program modules 1215.

[0277] The basic input / output system 1206 includes a display 1208 for displaying information and an input device 1209 such as a mouse and a keyboard for user inputting information. The display 1208 and the input device 1209 are connected to the central processing unit 1201 through an input / output controller 1210 connected to the system bus 1205. The basic input / output system 1206 may also include an input / output controller 1210 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1210 also provides output to a display screen, a printer, or other types of output devices.

[0278] The mass storage device 1207 is connected to the central processing unit 1201 through a mass storage controller (not shown) connected to the system bus 1205. The mass storage device 1207 and its associated computer readable media provide non-volatile storage for the computer device 1200. That is, the mass storage device 1207 may include a computer readable medium (not shown) such as a hard disk or drive.

[0279] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include random access memory (RAM), read-only memory (ROM), flash memory or other solid-state storage technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, cassette, tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 1204 and mass storage device 1207 can be collectively referred to as memory.

[0280] The memory stores one or more programs, and the one or more programs are configured to be executed by one or more central processing units 1201. The one or more programs contain instructions for implementing the above-mentioned methods. The central processing unit 1201 executes the one or more programs to implement the methods provided by the above-mentioned various method embodiments.

[0281] According to various embodiments of the present application, the computer device 1200 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 1200 can be connected to the network 1212 through the network interface unit 1211 connected to the system bus 1205, or the network interface unit 1211 can be used to connect to other types of networks or remote computer systems (not shown).

[0282] The memory also includes one or more programs, which are stored in the memory and include steps executed by a computer device in the method provided in the embodiment of the present application.

[0283] An embodiment of the present application also provides a computer-readable storage medium, which stores at least one instruction, at least one program, code set or instruction set. The at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the control method of the virtual props described in any of the above embodiments.

[0284] The embodiment of the present application provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the control method of the virtual props provided in the above aspect.

[0285] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer-readable storage medium, which can be a computer-readable storage medium contained in the memory in the above embodiments; or a computer-readable storage medium that exists independently and is not installed in the terminal. The computer-readable storage medium stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, the at least one program, the code set or instruction set is loaded and executed by the processor to implement the control method of the virtual props described in any of the above method embodiments.

[0286] Optionally, the computer readable storage medium may include: ROM, RAM, solid state drives (SSD) or optical disks, etc. Among them, RAM may include resistance random access memory (ReRAM) and dynamic random access memory (DRAM). The serial numbers of the above embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.

[0287] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0288] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for controlling a virtual prop, characterized in that: The method comprises: In response to the view angle rotation operation, controlling the virtual object to rotate the view angle, wherein the virtual object holds a virtual prop; During the process of rotating the viewing angle of the virtual object, controlling the virtual prop to swing toward the real-time viewing angle of the virtual object, wherein there is a deviation between the real-time prop orientation of the virtual prop and the real-time viewing angle of the virtual object; In response to the view rotation operation stopping, the real-time elastic force and real-time resistance of the virtual prop are determined based on the target view direction, the prop orientation of the previous frame, the prop swing speed of the previous frame, the elasticity coefficient and the resistance coefficient of the virtual prop during the swinging process, wherein the target view direction is the view direction when the virtual object stops rotating the view; based on the real-time elastic force and the real-time resistance, the real-time swing acceleration of the virtual prop is determined; based on the prop swing speed of the previous frame and the real-time swing acceleration, the real-time prop swing speed of the virtual prop is determined; based on the real-time prop swing speed, the prop orientation of the previous frame and the target view direction, the virtual prop is controlled to swing inertially toward the target view direction, and the prop orientation of the virtual prop when the inertially swinging stops is consistent with the target view direction.

2. The method according to claim 1, characterized in that The step of controlling the virtual prop to swing toward the real-time viewing direction of the virtual object includes: Determining a swing parameter of the virtual prop based on a real-time direction deviation between the real-time prop orientation and the real-time viewing angle direction; Based on the swing parameter, the virtual prop is controlled to swing toward the real-time viewing angle.

3. The method according to claim 2, characterized in that The swing parameters are determined frame by frame; Before determining the swing parameter of the virtual prop based on the real-time direction deviation between the real-time prop orientation and the real-time viewing angle direction, the method further includes: The real-time prop orientation is determined based on the real-time viewing angle direction and the prop orientation of the previous frame, where the prop orientation of the previous frame is the prop orientation of the virtual prop in the previous frame image.

4. The method according to claim 3, characterized in that The determining the real-time prop orientation based on the real-time viewing angle direction and the prop orientation of the previous frame includes: Determining a real-time prop swing speed of the virtual prop based on the real-time viewing angle direction, the prop orientation of the previous frame, and the prop swing speed of the previous frame; Determining a direction change based on the real-time prop swing speed and frame duration; The real-time prop orientation is determined based on the prop orientation of the previous frame and the orientation change.

5. The method according to claim 4, characterized in that The determining the real-time prop swing speed of the virtual prop based on the real-time viewing angle direction, the prop orientation of the previous frame, and the prop swing speed of the previous frame includes: Determining a spring model corresponding to the virtual prop, wherein the spring model includes an elastic coefficient and a resistance coefficient of the virtual prop during the swinging process; Input the real-time viewing angle direction, the prop orientation of the previous frame, and the prop swing speed of the previous frame into the spring model to obtain the real-time elastic force and real-time resistance of the virtual prop; Determining a real-time swing acceleration of the virtual prop based on the real-time elastic force and the real-time resistance; The real-time prop swing speed is determined based on the prop swing speed of the previous frame and the real-time swing acceleration.

6. The method according to claim 2, characterized in that The determining the swing parameter of the virtual prop based on the real-time direction deviation between the real-time prop orientation and the real-time viewing angle direction comprises: Determining a candidate direction deviation based on the real-time direction deviation and a deviation threshold, wherein the deviation threshold is a maximum deviation value between the viewing direction of the virtual object and the prop orientation of the virtual prop; Performing interpolation processing on the candidate direction deviations to obtain a target direction deviation; The target direction deviation is adjusted based on the swing coefficient to obtain the swing parameter of the virtual prop, and the swing coefficient is used to control the overall prop swing amplitude of the virtual prop.

7. The method according to claim 6, characterized in that The step of determining a candidate direction deviation based on the real-time direction deviation and the deviation threshold comprises: When the real-time direction deviation is less than the deviation threshold, determining the real-time direction deviation as the candidate direction deviation; When the real-time direction deviation is greater than the deviation threshold, the deviation threshold is determined as the candidate direction deviation.

8. The method according to claim 6, characterized in that The interpolation processing of the candidate direction deviation to obtain the target direction deviation includes: Obtain the target direction deviation of the previous frame and the interpolation speed corresponding to the virtual prop; Based on the interpolation speed, the interpolation process is performed on the target direction deviation of the previous frame and the candidate direction deviation to obtain the target direction deviation.

9. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: In response to the view angle rotation operation stopping, obtaining a real-time prop swing speed; When the real-time prop swing speed is greater than a speed threshold, controlling the virtual prop to swing inertially in the target viewing direction of the virtual object; The method further comprises: When the real-time prop swing speed is less than the speed threshold, the virtual prop is controlled to stop inertial swing.

10. The method according to any one of claims 1 to 8, characterized in that: The step of controlling the virtual prop to swing toward the real-time viewing direction of the virtual object includes: Controlling the virtual prop to swing in the direction of the real-time viewing angle with the virtual axis as the center; The controlling the virtual prop to swing inertially toward the target viewing angle direction includes: The virtual prop is controlled to perform the inertial swing with the virtual axis as the center according to the target viewing direction, wherein the axis positions of the virtual axes corresponding to different virtual props are different.

11. The method according to claim 10, characterized in that The axis position is determined according to the swing requirement of the virtual prop; When the first distance is smaller than the second distance, the swing amplitude of the head position of the virtual prop is smaller than the swing amplitude of the tail position of the virtual prop, the first distance is the distance between the head position of the virtual prop and the axis position, and the second distance is the distance between the tail position of the virtual prop and the axis position; When the first distance is greater than the second distance, the swing amplitude of the head position of the virtual prop is greater than the swing amplitude of the tail position of the virtual prop.

12. The method according to any one of claims 1 to 8, characterized in that: The step of controlling the virtual prop to swing toward the real-time viewing direction of the virtual object includes: When the swing function is turned on, controlling the virtual prop to swing toward the real-time viewing direction of the virtual object; The method further comprises: When the swing function is not enabled, the virtual prop is controlled to rotate synchronously with the viewing angle of the virtual object, wherein during the synchronous rotation, the direction of the real-time prop is the same as the direction of the real-time viewing angle.

13. The method according to claim 12, characterized in that The method further comprises: When the virtual item is in an unused state, determining that the swing function is turned on; or, When the image quality of the virtual environment is high quality, it is determined that the swing function is turned on.

14. A control device for a virtual item, characterized in that: The device comprises: A view angle rotation module, used for controlling a virtual object to rotate its view angle in response to a view angle rotation operation, wherein the virtual object holds a virtual prop; A first control module is used to control the virtual prop to swing toward the real-time viewing direction of the virtual object during the process of the virtual object rotating the viewing angle, wherein there is a deviation between the real-time prop orientation of the virtual prop and the real-time viewing direction of the virtual object; The second control module is used to determine the real-time elasticity and real-time resistance of the virtual prop in response to the cessation of the perspective rotation operation based on the target perspective direction, the prop orientation of the previous frame, the prop swing speed of the previous frame, the elasticity coefficient and the resistance coefficient of the virtual prop during the swinging process, wherein the target perspective direction is the perspective direction when the virtual object stops rotating the perspective; determine the real-time swing acceleration of the virtual prop based on the real-time elasticity and the real-time resistance; determine the real-time prop swing speed of the virtual prop based on the prop swing speed of the previous frame and the real-time swing acceleration; control the virtual prop to swing inertially toward the target perspective direction based on the real-time prop swing speed, the prop orientation of the previous frame and the target perspective direction, and the prop orientation of the virtual prop when the virtual prop stops the inertially swinging is consistent with the target perspective direction.

15. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the control method of the virtual props as described in any one of claims 1 to 13.

16. A computer-readable storage medium, characterized in that: The readable storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the control method of the virtual props as described in any one of claims 1 to 13.

17. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to implement the control method of a virtual item as described in any one of claims 1 to 13.