Virtual character control method and device, storage medium and electronic device
By adopting continuous multiple rotations and smooth rotation functions during the rotation of AI virtual characters, combined with the design of the animation logic layer, the problem of insufficient anthropomorphic performance of AI virtual characters and insufficient steering is solved, and a more realistic behavioral performance is achieved.
Patent Information
- Application Number
- CN202111307100.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-05
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2041-11-05
AI Technical Summary
The existing AI virtual character performance based on behavior tree logic control is not anthropomorphic enough, the shift is not real enough, and the lack of attention to animation performance leads to mechanical behavior.
By using continuous rotation of the virtual character, the smooth rotation function and animation logic layer design is combined with the design of the AI virtual character to smoothly turn and simulate the behavior of real players.
It improves the authenticity and anthropomorphism of the AI virtual character turn, makes its behavioral performance closer to real players, and solves the problem of insufficient anthropomorphism and insufficient turning.
Smart Images

Figure CN114011071B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a method and device for controlling a virtual character, a storage medium and an electronic device. Background Art
[0002] Currently, most AI (Artificial Intelligence) virtual characters based on behavior tree logic control are independent of the character animation itself. Instead, they control the characters based on the behavior tree logic above the character logic, and call the character's interface to perform specific behaviors. Virtual characters controlled based on behavior tree logic will behave mechanically like robots.
[0003] Since traditional AI design only focuses on the logical control of the behavior tree and not the animation performance of the AI, when the behavior tree decides to let the AI turn, it often turns instantly, resulting in technical problems such as the AI virtual character's performance is not humanized enough and the turning is not realistic enough.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a method and device for controlling a virtual character, a storage medium, and an electronic device, so as to at least solve the technical problem in the related art that when AI controls a virtual character, the performance is not humanized enough and the turning is not realistic enough.
[0006] According to one aspect of an embodiment of the present invention, a method for controlling a virtual character is provided, comprising: displaying a virtual scene where a first virtual character is located and the first virtual character, wherein the first virtual character is a character not controlled by a player; during the movement of the first virtual character, displaying a rotation process of the first virtual character from a first direction to a second direction; during the rotation process of the first virtual character, controlling the first virtual character to continuously rotate multiple times starting from the first direction until it rotates to the second direction.
[0007] According to another aspect of an embodiment of the present invention, a method for controlling a virtual character is provided, comprising: displaying a virtual scene where a first virtual character is located and the first virtual character, wherein the first virtual character is a character not controlled by a player; during the movement of the first virtual character, obtaining a target turning instruction, wherein the target turning instruction is used to instruct the first virtual character to turn from a first direction to a second direction; in response to the target turning instruction, during the movement of the first virtual character, controlling the first virtual character to continuously turn multiple times starting from the first direction until it turns to the second direction.
[0008] According to another aspect of an embodiment of the present invention, a control device for a virtual character is provided, comprising: a first display module, used to display a virtual scene where a first virtual character is located and the first virtual character, wherein the first virtual character is a character not controlled by a player; a second display module, used to display a rotation process of the first virtual character from a first direction to a second direction during the movement of the first virtual character; and a first control module, used to control the first virtual character to rotate continuously multiple times starting from the first direction until it rotates to the second direction during the rotation process of the first virtual character.
[0009] Optionally, the device is used to control the first virtual character to rotate continuously multiple times starting from the first direction until it rotates to the second direction during the rotation of the first virtual character in the following manner: during the rotation of the first virtual character, when a smooth rotation function corresponding to the first virtual character is turned on, the first virtual character is controlled to rotate continuously multiple times starting from the first direction until it rotates to the second direction, wherein the smooth rotation function is used to control the first virtual character to rotate smoothly after being turned on.
[0010] Optionally, the device is further used to: display the first virtual character facing a target virtual character, wherein the target virtual character is a character controlled by a player; and during the movement of the first virtual character, control the first virtual character to always face the target virtual character.
[0011] Optionally, the device is used to control the orientation of the first virtual character to always align with the target virtual character during the movement of the first virtual character in the following manner: during the movement of the first virtual character, the lower body of the first virtual character is controlled to move along the target movement direction, and the upper body of the first virtual character is controlled to always align with the target virtual character.
[0012] Optionally, the device is used to control the direction of the first virtual character to always align with the target virtual character during the movement of the first virtual character in the following manner: when the first virtual character holds a virtual attack prop and the first virtual character moves, the crosshairs of the virtual attack prop held by the first virtual character are controlled to always align with the target virtual character; or when the first virtual character does not hold a virtual attack prop and the first virtual character moves, the direction of the first virtual character is controlled to always align with the target virtual character.
[0013] Optionally, the first control module includes: a first control unit, used to control the first virtual character to rotate continuously N times starting from the first direction until it rotates to the second direction during the rotation of the first virtual character, wherein, in at least the first N-1 rotations of the N rotations, the rotation angle of the first virtual character is the same each time, and N is a positive integer greater than or equal to 2.
[0014] Optionally, the first control module includes: a second control unit, used to control the first virtual character to rotate continuously N times starting from the first direction until it rotates to the second direction during the rotation of the first virtual character, wherein the time interval between each two adjacent rotations of the N rotations is less than or equal to a preset duration, and the time interval is used to enable the first virtual character to rotate smoothly from the first direction to the second direction, and N is a positive integer greater than or equal to 2.
[0015] According to another aspect of an embodiment of the present invention, a control device for a virtual character is further provided, comprising: a third display module, used to display a virtual scene where a first virtual character is located and the first virtual character, wherein the first virtual character is a character not controlled by a player; an acquisition module, used to acquire a target turning instruction during the movement of the first virtual character, wherein the target turning instruction is used to instruct the first virtual character to turn from a first direction to a second direction; and a second control module, used to respond to the target turning instruction and, during the movement of the first virtual character, control the first virtual character to continuously turn multiple times starting from the first direction until it turns to the second direction.
[0016] Optionally, the device is used to obtain a target turning instruction during the movement of the first virtual character in the following manner: during the movement of the first virtual character, obtain the target turning instruction sent by the non-player character controller; the device is used to respond to the target turning instruction in the following manner, and during the movement of the first virtual character, control the first virtual character to make multiple continuous rotations starting from the first direction until it rotates to the second direction: in response to the target turning instruction, determine whether a smooth rotation function corresponding to the first virtual character is turned on, wherein the smooth rotation function is used to control the first virtual character to make smooth rotation after being turned on; when it is determined that the smooth rotation function corresponding to the first virtual character is turned on, during the movement of the first virtual character, control the first virtual character to make multiple continuous rotations starting from the first direction until it rotates to the second direction.
[0017] Optionally, the device is also used to: obtain a target aiming instruction, wherein the target aiming instruction is used to indicate that during the movement of the first virtual character, the first virtual character should always be oriented toward a target virtual character, and the target virtual character is a player-controlled character; in response to the target aiming instruction, during the movement of the first virtual character, the first virtual character's orientation is controlled to always be oriented toward the target virtual character.
[0018] Optionally, the device is used to respond to the target aiming instruction in the following manner, and control the orientation of the first virtual character to always align with the target virtual character during the movement of the first virtual character: in response to the target aiming instruction, during the movement of the first virtual character, control the lower body of the first virtual character to move along the target movement direction, and control the orientation of the upper body of the first virtual character to always align with the target virtual character.
[0019] Optionally, the device is used to respond to the target aiming instruction in the following manner to control the orientation of the first virtual character to always align with the target virtual character during the movement of the first virtual character: when the first virtual character holds a virtual attack prop, in response to the target aiming instruction, during the movement of the first virtual character, the crosshairs of the virtual attack prop held by the first virtual character are controlled to always align with the target virtual character; or when the first virtual character does not hold a virtual attack prop, in response to the target aiming instruction, during the movement of the first virtual character, the orientation of the first virtual character is controlled to always align with the target virtual character.
[0020] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned virtual character control method when running.
[0021] According to another aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions 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, so that the computer device executes the control method of the virtual character as described above.
[0022] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the virtual character control method through the computer program.
[0023] In an embodiment of the present invention, a virtual scene where a first virtual character is located and the first virtual character are displayed, wherein the first virtual character is a character not controlled by a player; during the movement of the first virtual character, a rotation process of the first virtual character from a first direction to a second direction is displayed; during the rotation process of the first virtual character, the first virtual character is controlled to continuously rotate multiple times from the first direction until it rotates to the second direction. During the movement of the first virtual character, the first virtual character is rotated multiple times in succession according to a target turning instruction, so that the AI virtual character designed based on the behavior tree is more like a real player, and the purpose of enabling the AI virtual character to turn smoothly and perform behavioral actions close to those of a real player is achieved, thereby achieving the technical effect of optimizing the behavioral performance of the AI-controlled virtual character and making the AI-controlled virtual character more anthropomorphic, thereby solving the technical problem that the performance of the AI-controlled virtual character is not anthropomorphic enough and the turning is not realistic enough when the AI controls the virtual character in the related art. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0025] Figure 1 is a schematic diagram of an application environment of an optional virtual character control method according to an embodiment of the present invention;
[0026] Figure 2 is a flow chart of an optional method for controlling a virtual character according to an embodiment of the present invention;
[0027] Figure 3 is a schematic diagram of an optional method for controlling a virtual character according to an embodiment of the present invention;
[0028] Figure 4 is a schematic diagram of another optional method for controlling a virtual character according to an embodiment of the present invention;
[0029] Figure 5 is a schematic diagram of another optional method for controlling a virtual character according to an embodiment of the present invention;
[0030] Figure 6 is a schematic diagram of another optional method for controlling a virtual character according to an embodiment of the present invention;
[0031] Figure 7 is a schematic diagram of another optional method for controlling a virtual character according to an embodiment of the present invention;
[0032] Figure 8 is a schematic diagram of another optional method for controlling a virtual character according to an embodiment of the present invention;
[0033] Fig. 9 is a schematic diagram of another optional method for controlling a virtual character according to an embodiment of the present invention;
[0034] Fig.10 is a schematic diagram of another optional method for controlling a virtual character according to an embodiment of the present invention;
[0035] Fig.11 is a schematic diagram of another optional method for controlling a virtual character according to an embodiment of the present invention;
[0036] Fig.12 is a schematic diagram of another optional method for controlling a virtual character according to an embodiment of the present invention;
[0037] Fig.13 is a schematic diagram of another optional method for controlling a virtual character according to an embodiment of the present invention;
[0038] Fig.14 is a schematic structural diagram of an optional virtual character control device according to an embodiment of the present invention;
[0039] Fig.15 is a schematic structural diagram of an optional virtual character control product according to an embodiment of the present invention;
[0040] Fig.16 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0042] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0043] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretation:
[0044] Aim-Offset: A type of animation blending space, a tool technology used to blend different animations between the upper and lower body of a character, for example, allowing a character to aim while walking.
[0045] The present invention will be described below in conjunction with embodiments:
[0046] According to one aspect of an embodiment of the present invention, a method for controlling a virtual character is provided. Optionally, in this embodiment, the method for controlling a virtual character can be applied to: Figure 1 In the hardware environment composed of the server 101 and the terminal device 103 shown in FIG. Figure 1 As shown, the server 101 is connected to the terminal 103 through a network, and can be used to provide services for the terminal device or the application installed on the terminal device. The application can be a video application, an instant messaging application, a browser application, an educational application, a game application, etc. A database 105 can be set on the server or independently of the server to provide data storage services for the server 101, for example, a game data storage server. The above network can include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication. The terminal device 103 can be a terminal configured with an application, and can include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV and other computer devices. The above server can be a single server, or a server cluster composed of multiple servers, or a cloud server.
[0047] Combination Figure 1 As shown, the above-mentioned virtual character control method can be implemented in the terminal device 103 through the following steps:
[0048] S1, displaying a virtual scene where a first virtual character is located and the first virtual character on the terminal device 103, wherein the first virtual character is a character not controlled by a player;
[0049] S2, during the movement of the first virtual character, displaying on the terminal device 103 a process of the first virtual character rotating from a first direction to a second direction;
[0050] S3, during the rotation of the first virtual character, controlling the first virtual character on the terminal device 103 to rotate multiple times continuously starting from the first direction until rotating to the second direction.
[0051] Optionally, in this embodiment, the control method of the virtual character can also be implemented by a server, for example, Figure 1 It is implemented in the server 101 shown; or it is implemented by the user terminal and the server together.
[0052] The above is only an example and is not specifically limited in this embodiment.
[0053] Optionally, as an optional implementation, as Figure 2 As shown, the control method of the above virtual character includes:
[0054] S202, displaying a virtual scene where a first virtual character is located and the first virtual character, wherein the first virtual character is a character not controlled by a player;
[0055] S204, during the movement of the first virtual character, displaying the rotation process of the first virtual character from the first direction to the second direction;
[0056] S206, during the rotation of the first virtual character, controlling the first virtual character to rotate continuously multiple times starting from the first direction until rotating to a second direction.
[0057] Optionally, as an optional implementation, the above virtual character control method further includes:
[0058] S1, displaying a virtual scene where a first virtual character is located and the first virtual character, wherein the first virtual character is a character not controlled by a player;
[0059] S2, during the movement of the first virtual character, obtaining a target turning instruction, wherein the target turning instruction is used to instruct the first virtual character to turn from a first direction to a second direction;
[0060] S3, in response to the target turning instruction, during the movement of the first virtual character, controlling the first virtual character to continuously turn multiple times starting from the first direction until it turns to the second direction.
[0061] Optionally, in this embodiment, the above-mentioned game applications include but are not limited to MOBA game applications, shooting applications and other one or more types of game applications, among which MOBA (full English name: Multiplayer Online Battle Arena, abbreviation: MOBA, Chinese translation: Multiplayer Online Tactical Competitive Game), also known as Action Real-Time Strategy (abbreviation: Action RTS, ARTS) action real-time strategy game, can be run on terminal devices (for example, mobile terminals, PC terminals).
[0062] Optionally, in this embodiment, the above-mentioned virtual scenes may include but are not limited to MOBA game scenes, shooting game scenes, etc.
[0063] Taking the shooting game scene as an example, it can include but is not limited to first-person shooting games, third-person shooting games, and all other games that use hot weapons for long-range attacks.
[0064] First-person shooting game (FPS) is a branch of action game (ACT). As the name suggests, the first-person shooting game is a shooting game played from the player's subjective perspective.
[0065] Third-person shooting games (TPS) are also a type of shooting game. The difference from first-person shooting games is that the virtual control objects operated by the player are visible in the game display interface. The above-mentioned games may include but are not limited to first-person shooting games, third-person shooting games, and shooting games that can switch between first-person and third-person perspectives, etc. Figure 3 is a schematic diagram of another method for controlling a virtual character according to an embodiment of the present invention. Figure 3 As shown, the game display interface can be divided into a first-person display interface 301 and a third-person display interface 303, and includes but is not limited to a display interface for switching between the first-person and third-person perspectives using a perspective switching button. The first virtual character can be displayed by Figure 3 The object moves in the direction shown.
[0066] It should be noted that the rotation process of the above-mentioned first virtual character from the first direction to the second direction may include but is not limited to being achieved by obtaining a target turning instruction, and the above-mentioned target turning instruction may include but is not limited to a turning instruction sent by an AI controller for a target game application, rather than a turning instruction sent by a player.
[0067] Optionally, in this embodiment, the first virtual character is a non-player-controlled character, and may include but is not limited to a virtual character preset by the system and controlled by an AI controller (AI Controller).
[0068] For example, Figure 4 is a schematic diagram of another method for controlling a virtual character according to an embodiment of the present invention. Figure 4 As shown, in the prior art, when AI controls a virtual character to perform a behavior, it may include but is not limited to controlling the AIController through a behavior tree logic, adding a node in the behavior tree logic, and the node is used to interact with the animation logic layer for data. Before controlling the character through the AIController, the operation to be performed by the virtual character may be adaptively adjusted in the animation logic layer to execute the corresponding character logic, such as the behavior logic of the virtual character such as "move", "jump", and "attack".
[0069] and Figure 5 is a schematic diagram of another method for controlling a virtual character according to an embodiment of the present invention. Figure 5 As shown, in this embodiment, when AI controls a virtual character to perform a behavior, it may include but is not limited to controlling the AIController through the behavior tree logic, and controlling the character through the AIController to execute the corresponding character logic, such as the behavior logic of the virtual character such as "move", "jump", "attack", etc.
[0070] Specifically, taking the virtual character moving and turning as an example, in terms of animation logic, the EnableSmoothRotation node is designed to allow the AIcontroller to smoothly turn to the direction of the character's movement when the AI controls the movement of the virtual character. When used with the behavior tree, it can be turned on when needed and turned off when not needed.
[0071] Optionally, in the present embodiment, the above-mentioned rotation process of the first virtual character from the first direction to the second direction is used to instruct the first virtual character to rotate from the first direction to the second direction. Specifically, it may include but is not limited to instructing the first virtual character to rotate from the first direction to the second direction according to the angle threshold allowed for rotation configured in the virtual scene. For example, it may include but is not limited to configuring the angle threshold to be greater than 0° and less than 360°. When the first direction is that the virtual character is displayed in the virtual scene at 45° sideways, when the second direction indicates that the virtual character turns from -45° to 0°, the AI controls the first virtual character to rotate to face the virtual character controlled by the player.
[0072] For example, Figure 6 is a schematic diagram of another method for controlling a virtual character according to an embodiment of the present invention. Figure 6 As shown, in the prior art, during the process of AI controlling the movement of a virtual character, if the virtual character needs to rotate, it is directly rotated from a first direction to a second direction by a corresponding angle.
[0073] For example, Figure 7 is a schematic diagram of another method for controlling a virtual character according to an embodiment of the present invention. Figure 7 As shown, in this embodiment, during the process of AI controlling the movement of the virtual character, if the virtual character needs to rotate, it first rotates from the first direction to the third direction, then rotates from the third direction to the fourth direction, until the animation is displayed that the virtual character rotates smoothly, and finally rotates to the second direction, that is, the sum of the angle of rotation from the first direction to the third direction, the angle of rotation from the third direction to the fourth direction, and the angle of rotation from the fourth direction to the second direction is equal to Figure 6 The corresponding angles of rotation from the first direction to the second direction are the same, and the third direction and the fourth direction are merely examples, and may specifically include but are not limited to directions obtained by more rotations.
[0074] The above is only an example, and this embodiment does not make any specific limitation.
[0075] Optionally, in this embodiment, the process of moving the first virtual character may include but is not limited to the server generating a control instruction to move the first virtual character after receiving a request to move the first virtual character, so as to control the movement of the first virtual character.
[0076] Optionally, in this embodiment, the controlling the first virtual character to rotate multiple times continuously from the first direction until rotating to the second direction may be implemented, but not limited to, by an interpolation method. For example, the EnableSmoothRotation node of the behavior tree logic executes the following logic:
[0077] For example, Figure 8is a schematic diagram of another method for controlling a virtual character according to an embodiment of the present invention. Figure 8 As shown, including but not limited to the following steps:
[0078] S1, receiving the event stream (e.g., the operation instructions for controlling the movement of the virtual character in the behavior tree logic);
[0079] S2, determine whether the EnableSmoothRotation node is used;
[0080] S3, if the judgment result is yes, setting the rotation parameters (for example, including but not limited to Yaw parameter, Roll parameter, Pitch parameter, etc.) to False;
[0081] S4, configure the rotation parameter to True, and execute step S7;
[0082] S5, if the judgment result is no, configure the above rotation parameter to True;
[0083] S6, configure the rotation parameter to False, and execute step S7;
[0084] S7, Finish Execute event ends.
[0085] The above Yaw is a way of expressing rotation in Euler angles. Euler angles are the simplest way of expressing rotation. In form, it is a three-dimensional vector, whose values represent the rotation angles of the object around the three axes (x-axis, y-axis, and z-axis) of the coordinate system. Yaw is the angle of rotation around the z-axis.
[0086] Through this embodiment, a virtual scene where a first virtual character is located and the first virtual character located in the virtual scene are displayed, wherein the first virtual character is a player-controlled character and the first virtual character is a non-player-controlled character. During the movement of the first virtual character, a target turning instruction is obtained, wherein the target turning instruction is used to instruct the first virtual character to turn from a first direction to a second direction. In response to the target turning instruction, during the movement of the first virtual character, the first virtual character is controlled to turn continuously multiple times from the first direction until it turns to the second direction. During the movement of the first virtual character, the first virtual character is turned continuously multiple times according to the target turning instruction, so that the AI virtual character designed based on the behavior tree is more like a real player, and the purpose of enabling the AI virtual character to turn smoothly and make behavioral actions close to those of a real player is achieved, thereby achieving the technical effect of optimizing the behavioral performance of the AI-controlled virtual character and making the AI-controlled virtual character more anthropomorphic, thereby solving the technical problem that the performance of the AI-controlled virtual character is not anthropomorphic enough and the turning is not real enough when the AI controls the virtual character in the related art.
[0087] As an optional solution, during the movement of the first virtual character, controlling the first virtual character to rotate continuously multiple times from the first direction until rotating to the second direction includes:
[0088] During the rotation of the first virtual character, the first virtual character is controlled to rotate continuously N times starting from a first direction until it rotates to a second direction, wherein in at least the first N-1 rotations of the N rotations, the rotation angle of each rotation of the first virtual character is the same, and N is a positive integer greater than or equal to 2.
[0089] Optionally, in this embodiment, the above-mentioned N can be flexibly configured according to the angle between the first direction and the second direction and the model size of the virtual character. For example, the above-mentioned N is configured to be positively correlated with the model size of the above-mentioned virtual character. When the model of the virtual character is larger, the above-mentioned N is larger. Of course, it can also be uniformly configured according to the angle between the first direction and the second direction.
[0090] For example, Fig. 9 is a schematic diagram of another method for controlling a virtual character according to an embodiment of the present invention. Fig. 9 As shown, including but not limited to the following steps:
[0091] Virtual scene 902 is an example of the first virtual character turning from a first direction to a second direction during movement in the prior art, wherein the first virtual character moves eastward before turning, and after receiving a turning instruction to turn to move northward, the first virtual character turns directly from the eastward direction to the northward direction.
[0092] Virtual scene 904 is an example of the first virtual character in this embodiment rotating from a first direction to a second direction during movement, wherein the first virtual character moves eastward before turning, and after receiving a rotation instruction to turn to the north, the virtual character is interpolated and rotated so that the virtual character rotates smoothly and continuously N times from the east direction to the north direction.
[0093] Optionally, in this embodiment, the rotation angle of each rotation of the above-mentioned first virtual character may include but is not limited to being configured by the system, or, determined according to the angle value between the first direction and the second direction, may be configured to have the same rotation angle each time, or, the rotation angle of each rotation may be gradually increased or decreased in a progressive relationship.
[0094] As an optional solution, during the movement of the first virtual character, controlling the first virtual character to rotate continuously multiple times from the first direction until rotating to the second direction includes:
[0095] During the rotation of the first virtual character, the first virtual character is controlled to rotate continuously N times starting from the first direction until it rotates to the second direction, wherein the time interval between each two adjacent rotations in the N rotations is less than or equal to a preset time length, and the time interval is used to enable the first virtual character to rotate smoothly from the first direction to the second direction.
[0096] Optionally, in this embodiment, the time interval between each two adjacent rotations in the above-mentioned multiple rotations is less than or equal to a preset duration, which may include but is not limited to enabling the rotation process of the virtual character to be displayed smoothly in a virtual scene, that is, the time interval is used to enable the first virtual character to rotate smoothly from a first direction to a second direction.
[0097] For example, Fig.10 is a schematic diagram of another method for controlling a virtual character according to an embodiment of the present invention. Fig.10 As shown, including but not limited to the following steps:
[0098] S1, receiving a control message instructing the virtual character to turn and move;
[0099] S2, determine whether the node (smooth rotation function) is turned on;
[0100] S3, if the judgment result is yes, set the default value of the interpolation speed to 10, wherein the interpolation speed is the rotation angle of the first virtual character each time;
[0101] S4, determining whether the difference between the current rotation parameter value (for example, including but not limited to the Yaw parameter value, the Roll parameter value, the Pitch parameter value, etc.) of the AI virtual character and the target direction angle is greater than a default value;
[0102] S5, if the judgment result is yes, rotate towards the target direction, and the rotation angle is equal to the default value;
[0103] S6, when the judgment result of step S2 or step S4 is no, directly set the rotation parameter value of the AI virtual character to the rotation parameter value of the target direction (corresponding to the aforementioned second direction);
[0104] S7, end the process.
[0105] The above is only an example, and this embodiment does not make any specific limitation.
[0106] As an optional scheme, during the rotation process of the first virtual character, the first virtual character is controlled to rotate continuously for multiple times starting from the first direction until it rotates to the second direction, including: during the rotation process of the first virtual character, when the smooth rotation function corresponding to the first virtual character is turned on, the first virtual character is controlled to rotate continuously for multiple times starting from the first direction until it rotates to the second direction, wherein the smooth rotation function is used to control the first virtual character to rotate smoothly after being turned on.
[0107] As an optional solution, during the movement of the first virtual character, a target turning instruction is obtained, including: during the movement of the first virtual character, a target turning instruction sent by a non-player character controller is obtained; in response to the target turning instruction, during the movement of the first virtual character, the first virtual character is controlled to make a plurality of continuous rotations starting from a first direction until it is rotated to a second direction, including: in response to the target turning instruction, determining whether a smooth rotation function corresponding to the first virtual character is turned on, wherein the smooth rotation function is used to control the first virtual character to make a smooth rotation after being turned on; when it is determined that the smooth rotation function corresponding to the first virtual character is turned on, during the movement of the first virtual character, the first virtual character is controlled to make a plurality of continuous rotations starting from the first direction until it is rotated to the second direction.
[0108] Optionally, in this embodiment, the target turning instructions sent by the non-player character controller may include but are not limited to target turning instructions generated by the server or system according to the setting of the virtual scene. For example, the AI is configured to search for and attack the player within a predetermined range. When the player is found within the predetermined range, the AI moves toward the player and generates a target turning instruction to turn towards the player. Specifically, it may also include AI control methods in other scenarios.
[0109] Optionally, in this embodiment, whether the smooth rotation function corresponding to the first virtual character is turned on may include but is not limited to determining by judging whether the smooth rotation function corresponding to the first virtual character is turned on.
[0110] The above is only an example, and this embodiment does not make any specific limitation.
[0111] As an optional solution, the method further includes: displaying the first virtual character facing toward a target virtual character, wherein the target virtual character is a character controlled by a player; and during movement of the first virtual character, controlling the first virtual character to always face toward the target virtual character.
[0112] As an optional solution, the method also includes: obtaining a target aiming instruction, wherein the target aiming instruction is used to instruct that during the movement of the first virtual character, the first virtual character is always directed toward a target virtual character, where the target virtual character is a player-controlled character; in response to the target aiming instruction, during the movement of the first virtual character, the first virtual character is controlled to always be directed toward the target virtual character.
[0113] Optionally, in this embodiment, the target aiming instruction is used to instruct the first virtual character to keep aiming at a target virtual character during its movement. The target virtual character may include but is not limited to a player-controlled character, and of course, may also be the direction of a virtual object or virtual area.
[0114] For example, Fig.11 is a schematic diagram of another method for controlling a virtual character according to an embodiment of the present invention. Fig.11 As shown, in response to the target aiming instruction, during the movement of the first virtual character, controlling the direction of the first virtual character to always aim at the target virtual character may include but is not limited to the following contents:
[0115] When the first virtual character moves from right to left, the aiming direction of the first virtual character is controlled to always aim at the enemy (corresponding to the aforementioned target virtual character).
[0116] As an optional solution, during the movement of the first virtual character, the first virtual character is controlled to always be oriented towards the target virtual character, including: during the movement of the first virtual character, the lower body of the first virtual character is controlled to move along the target moving direction, and the upper body of the first virtual character is controlled to always be oriented towards the target virtual character.
[0117] As an optional scheme, in response to a target aiming instruction, during the movement of the first virtual character, the first virtual character is controlled to always be oriented towards the target virtual character, including: in response to a target aiming instruction, during the movement of the first virtual character, the lower body of the first virtual character is controlled to move along the target movement direction, and the upper body of the first virtual character is controlled to always be oriented towards the target virtual character.
[0118] Optionally, in this embodiment, it may include but is not limited to adding an AI preview animation system SetFocus Service (set aiming function) node in the above-mentioned behavior tree logic to achieve response to the target aiming instruction, during the movement of the first virtual character, controlling the first virtual character to move along the target movement direction, during the movement process, controlling the upper body and lower body of the first virtual character to move along the target movement direction at the same time and controlling the direction of the upper body of the first virtual character to always align with the target virtual character.
[0119] Specifically: from the animation logic layer, let the behavior tree logic call Aim-Offset, so as to smoothly let the AI upper body aim at the target. It also needs to be used in conjunction with the behavior tree and mounted at the required node position. When this node is mounted on a branch of the behavior tree logic, it can be achieved that the upper body calls the Aim-offset of the animation system, and the lower body integrates the Blendspace of the character's eight-direction movement, so that the upper body always points the gun at the enemy and the lower body moves horizontally.
[0120] Optionally, in this embodiment, Fig.12 is a schematic diagram of another method for controlling a virtual character according to an embodiment of the present invention. Fig.12 As shown, in response to the target turning instruction, determining whether the smooth rotation function corresponding to the first virtual character is turned on, when it is determined that the smooth rotation function corresponding to the first virtual character is turned on, during the movement of the first virtual character, controlling the first virtual character to continuously rotate multiple times from the first direction until rotating to the second direction may include but is not limited to the following steps:
[0121] S1, when a tick event is responded to (corresponding to the aforementioned acquisition of the target turning instruction sent by the non-player character controller);
[0122] S2, obtaining InterSpeed (the default value of the rotation speed, i.e., the aforementioned interpolation speed or the rotation angle of each rotation of the first virtual character);
[0123] S3, judging that the distance to the target direction is less than InterSpeed;
[0124] S4, if the result of the judgment is yes, directly lock the direction of the virtual character (corresponding to the above until it rotates to the second direction);
[0125] S5, when the result of the judgment in step S3 is negative, rotate toward the target direction (second direction) by an angle, where the angle value = InterSpeed.
[0126] S6, judging whether to leave the EnableSmoothRotation node, and returning to step S2 if the judgment result is no;
[0127] S7, when the judgment result is yes, clear setFocus (end the current process, at this time, the above nodes can be closed or not at the same time according to actual needs).
[0128] The above is only an example, and this embodiment does not make any specific limitation.
[0129] As an optional scheme, during the movement of the first virtual character, the direction of the first virtual character is controlled to always be aimed at the target virtual character, including: when the first virtual character holds a virtual attack prop and the first virtual character moves, the crosshairs of the virtual attack prop held by the first virtual character are controlled to always be aimed at the target virtual character; or when the first virtual character does not hold a virtual attack prop and the first virtual character moves, the direction of the first virtual character is controlled to always be aimed at the target virtual character.
[0130] As an optional scheme, in response to a target aiming instruction, during the movement of the first virtual character, the first virtual character is controlled to always be directed toward the target virtual character, including: when the first virtual character holds a virtual attack prop, in response to the target aiming instruction, during the movement of the first virtual character, the crosshairs of the virtual attack prop held by the first virtual character are controlled to always be directed toward the target virtual character; or when the first virtual character does not hold a virtual attack prop, in response to the target aiming instruction, during the movement of the first virtual character, the first virtual character is controlled to always be directed toward the target virtual character.
[0131] Optionally, in this embodiment, the above-mentioned virtual attack props may include but are not limited to virtual guns, virtual throwing objects, virtual melee weapons, etc., and the above-mentioned control of the crosshairs of the virtual attack props held by the first virtual character to always aim at the target virtual character may include but are not limited to the upper body of the first virtual character and the virtual attack props facing the target virtual character.
[0132] The following is a further explanation of this application with reference to a specific complete example:
[0133] Before adopting this embodiment, because traditional AI design only focuses on the logical control of the behavior tree and pays less attention to the animation performance of the AI, when the behavior tree "decides to let the AI turn", it often turns instantly.
[0134] The cause of the above problem lies in the underlying mechanism of UE4's Movement Component. When receiving input operations from the AI Controller, the AI-controlled virtual character needs to interpolate the rotation to achieve smoothness. This not only allows the AI to avoid "right-angle" instantaneous turns when moving and turning, but also allows the AI to smoothly adjust the character's Aim-Offset during combat, so that it can turn around and shoot while walking or turn around and shoot while sliding.
[0135] This embodiment consists of two parts of technology: one is used to allow the AI to turn smoothly when moving and turning; the other is to call the Aim-offset of the animation system to allow the AI to pre-aim in a certain direction and move at the same time, that is, to integrate the standard movements of the upper body with the movements of the lower body.
[0136] AI's movement smooth steering
[0137] In terms of logic layer, based on the traditional "behavior tree controls AIcontroller -> AIcontroller controls character", an animation logic layer is added:
[0138] In terms of animation logic, two nodes are designed:
[0139] EnableSmoothRotation node:
[0140] When used for AI movement, it allows the AIcontroller to smoothly turn to the direction of the character's movement. It can be used with the behavior tree and can be turned on when needed and off when not needed.
[0141] When this node is enabled, the player character's Movement Component will be notified, and each time the player turns, an interpolated turn will be made instead of an instant turn.
[0142] AI preview animation system SetFocus Service node:
[0143] From the animation level, you can use the behavior tree to adjust the Aim-Offset to smoothly aim the AI's upper body at the target. This also needs to be used in conjunction with the behavior tree and mounted at the required position.
[0144] In this way, when this node is mounted on a branch of the behavior tree, the upper body can call the Aim-offset of the animation system, and the lower body can be integrated with the Blendspace of the character's eight-direction movement, so that the upper body always points the gun at the enemy and the lower body moves horizontally.
[0145] Fig.13 is a schematic diagram of another method for controlling a virtual character according to an embodiment of the present invention. Fig.13 As shown, the control method of the above virtual character may include but is not limited to the following steps:
[0146] S1, receiving a control message instructing the virtual character to turn and move;
[0147] S2, determine whether the SetFocus Service node is enabled;
[0148] S3, if the result of the judgment in step S2 is yes, the Aim-Offset in the animation system is mobilized to control the upper body of the AI virtual character to lock the direction to the target (corresponding to the aforementioned target virtual character);
[0149] S4, mobilize BlendSpace in the animation system, control the lower body of the character, and set the target (predetermined moving direction) as the moving direction;
[0150] S5, mixing the upper body animation with the lower body animation, and executing step S11;
[0151] S6, if the result of the judgment in step S2 is no, determine whether the EnableSmoothRotation node (smooth rotation function) is turned on;
[0152] S7, if the judgment result is yes, set the default value of the interpolation speed = 10;
[0153] S8, determining whether the difference between the current Yaw value of the AI virtual character and the target direction angle is greater than a default value;
[0154] S9, if the judgment result is yes, rotate towards the target direction, and the rotation angle is equal to the default value;
[0155] S10, when the judgment result of step S2 or step S4 is no, directly set the Yaw value of the AI virtual character to the Yaw value of the target direction (corresponding to the aforementioned second direction);
[0156] S11, determine whether to leave the node, if the determination result is no, return to step S2;
[0157] S12, when the result of the judgment in step S11 is yes, clear SetFocus.
[0158] Through this embodiment, AI can combine the animation blending space to smoothly turn and perform actions close to those of a real player.
[0159] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0160] According to another aspect of the embodiments of the present invention, a virtual character control device for implementing the above virtual character control method is also provided. Fig.14 As shown, the device comprises:
[0161] A first display module 1402, used to display a virtual scene where a first virtual character is located and the first virtual character located in the virtual scene, wherein the first virtual character is a player-controlled character and the first virtual character is a non-player-controlled character;
[0162] The second display module 1404 is used to obtain a target turning instruction during the movement of the first virtual character, wherein the target turning instruction is used to instruct the first virtual character to turn from a first direction to a second direction;
[0163] The first control module 1406 is configured to respond to the target turning instruction and control the first virtual character to continuously turn multiple times starting from the first direction until it turns to the second direction during the movement of the first virtual character.
[0164] According to another aspect of an embodiment of the present invention, a control device for a virtual character is provided, comprising: a first display module, used to display a virtual scene where a first virtual character is located and the first virtual character, wherein the first virtual character is a character not controlled by a player; a second display module, used to display a rotation process of the first virtual character from a first direction to a second direction during the movement of the first virtual character; and a first control module, used to control the first virtual character to rotate continuously multiple times starting from the first direction until it rotates to the second direction during the rotation process of the first virtual character.
[0165] As an optional solution, the device is used to control the first virtual character to rotate continuously multiple times starting from the first direction until it rotates to the second direction during the rotation of the first virtual character in the following manner: during the rotation of the first virtual character, when a smooth rotation function corresponding to the first virtual character is turned on, the first virtual character is controlled to rotate continuously multiple times starting from the first direction until it rotates to the second direction, wherein the smooth rotation function is used to control the first virtual character to rotate smoothly after being turned on.
[0166] As an optional solution, the device is also used to: display the first virtual character facing toward a target virtual character, wherein the target virtual character is a character controlled by a player; and during the movement of the first virtual character, control the first virtual character to always face the target virtual character.
[0167] As an optional solution, the device is used to control the orientation of the first virtual character to always align with the target virtual character during the movement of the first virtual character in the following manner: during the movement of the first virtual character, the lower body of the first virtual character is controlled to move along the target movement direction, and the upper body of the first virtual character is controlled to always align with the target virtual character.
[0168] As an optional solution, the device is used to control the direction of the first virtual character to always align with the target virtual character during the movement of the first virtual character in the following manner: when the first virtual character holds a virtual attack prop and the first virtual character moves, the crosshairs of the virtual attack prop held by the first virtual character are controlled to always align with the target virtual character; or when the first virtual character does not hold a virtual attack prop and the first virtual character moves, the direction of the first virtual character is controlled to always align with the target virtual character.
[0169] As an optional scheme, the first control module includes: a first control unit, used to control the first virtual character to rotate continuously N times starting from the first direction until it rotates to the second direction during the rotation of the first virtual character, wherein, in at least the first N-1 rotations of the N rotations, the rotation angle of the first virtual character is the same each time, and N is a positive integer greater than or equal to 2.
[0170] As an optional solution, the first control module includes: a second control unit, used to control the first virtual character to rotate continuously N times starting from the first direction until it rotates to the second direction during the rotation of the first virtual character, wherein the time interval between each two adjacent rotations of the N rotations is less than or equal to a preset duration, and the time interval is used to enable the first virtual character to rotate smoothly from the first direction to the second direction, and N is a positive integer greater than or equal to 2.
[0171] According to another aspect of an embodiment of the present invention, a control device for a virtual character is further provided, comprising: a third display module, used to display a virtual scene where a first virtual character is located and the first virtual character, wherein the first virtual character is a character not controlled by a player; an acquisition module, used to acquire a target turning instruction during the movement of the first virtual character, wherein the target turning instruction is used to instruct the first virtual character to turn from a first direction to a second direction; and a second control module, used to respond to the target turning instruction and, during the movement of the first virtual character, control the first virtual character to continuously turn multiple times starting from the first direction until it turns to the second direction.
[0172] As an optional scheme, the device is used to obtain a target turning instruction during the movement of the first virtual character in the following manner: during the movement of the first virtual character, obtain the target turning instruction sent by the non-player character controller; the device is used to respond to the target turning instruction in the following manner, and during the movement of the first virtual character, control the first virtual character to make multiple continuous rotations starting from the first direction until it turns to the second direction: in response to the target turning instruction, determine whether a smooth rotation function corresponding to the first virtual character is turned on, wherein the smooth rotation function is used to control the first virtual character to make smooth rotation after being turned on; when it is determined that the smooth rotation function corresponding to the first virtual character is turned on, during the movement of the first virtual character, control the first virtual character to make multiple continuous rotations starting from the first direction until it turns to the second direction.
[0173] As an optional solution, the device is also used to: obtain a target aiming instruction, wherein the target aiming instruction is used to indicate that during the movement of the first virtual character, the first virtual character should always be oriented toward a target virtual character, and the target virtual character is a player-controlled character; in response to the target aiming instruction, during the movement of the first virtual character, the first virtual character's orientation is controlled to always be oriented toward the target virtual character.
[0174] As an optional scheme, the device is used to respond to the target aiming instruction in the following manner, and control the first virtual character to always align with the target virtual character during the movement of the first virtual character: in response to the target aiming instruction, during the movement of the first virtual character, control the lower body of the first virtual character to move along the target movement direction, and control the upper body of the first virtual character to always align with the target virtual character.
[0175] As an optional scheme, the device is used to respond to the target aiming instruction in the following manner to control the first virtual character's direction to always align with the target virtual character during the movement of the first virtual character: when the first virtual character holds a virtual attack prop, in response to the target aiming instruction, during the movement of the first virtual character, the crosshairs of the virtual attack prop held by the first virtual character are controlled to always align with the target virtual character; or when the first virtual character does not hold a virtual attack prop, in response to the target aiming instruction, during the movement of the first virtual character, the direction of the first virtual character is controlled to always align with the target virtual character.
[0176] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 1509, and / or installed from a removable medium 1511. When the computer program is executed by the central processor 1501, various functions provided in the embodiments of the present application are executed.
[0177] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0178] Fig.15 The structure block diagram of a computer system for implementing an electronic device according to an embodiment of the present application is schematically shown.
[0179] It should be noted that Fig.15 The computer system 1500 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0180] like Fig.15 As shown, the computer system 1500 includes a central processing unit 1501 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 1502 (ROM) or the program loaded from the storage part 1508 to the random access memory 1503 (RAM). Various programs and data required for system operation are also stored in the random access memory 1503. The central processing unit 1501, the read-only memory 1502 and the random access memory 1503 are connected to each other through a bus 1504. The input / output interface 1505 (Input / Output interface, i.e., I / O interface) is also connected to the bus 1504.
[0181] The following components are connected to the input / output interface 1505: an input section 1506 including a keyboard, a mouse, etc.; an output section 1507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1508 including a hard disk, etc.; and a communication section 1509 including a network interface card such as a LAN card, a modem, etc. The communication section 1509 performs communication processing via a network such as the Internet. The drive 1150 is also connected to the input / output interface 1505 as needed. A removable medium 1511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1150 as needed so that a computer program read therefrom is installed into the storage section 1508 as needed.
[0182] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1509, and / or installed from the removable medium 1511. When the computer program is executed by the central processor 1501, various functions defined in the system of the present application are executed.
[0183] According to another aspect of the embodiments of the present invention, there is also provided an electronic device for implementing the above-mentioned virtual character control method. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a terminal device as an example. Fig.16 As shown, the electronic device includes a memory 1602 and a processor 1604. The memory 1602 stores a computer program, and the processor 1604 is configured to execute the steps in any of the above method embodiments through the computer program.
[0184] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0185] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0186] S1, displaying a virtual scene where a first virtual character is located and the first virtual character located in the virtual scene, wherein the first virtual character is a player-controlled character and the first virtual character is a non-player-controlled character;
[0187] S2, during the movement of the first virtual character, obtaining a target turning instruction, wherein the target turning instruction is used to instruct the first virtual character to turn from a first direction to a second direction;
[0188] S3, in response to the target turning instruction, during the movement of the first virtual character, controlling the first virtual character to continuously turn multiple times starting from the first direction until it turns to the second direction.
[0189] Alternatively, a person skilled in the art may understand that: Fig.16 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, and other terminal devices. Fig.16 The electronic device and the electronic equipment described above are not limited in structure. Fig.16 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig.16 Different configurations are shown.
[0190] Among them, the memory 1602 can be used to store software programs and modules, such as the program instructions / modules corresponding to the control method and device of the virtual character in the embodiment of the present invention. The processor 1604 executes various functional applications and data processing by running the software programs and modules stored in the memory 1602, that is, realizing the above-mentioned control method of the virtual character. The memory 1602 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1602 may further include a memory remotely arranged relative to the processor 1604, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 1602 can be specifically, but not limited to, used for information such as virtual scenes. As an example, such as Fig.16 As shown, the memory 1602 may include, but is not limited to, the display module 1402, the acquisition module 1404, and the control module 1406 in the control device of the virtual character. In addition, it may also include, but is not limited to, other module units in the control device of the virtual character, which will not be repeated in this example.
[0191] Optionally, the transmission device 1606 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 1606 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 1606 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0192] In addition, the electronic device further includes: a display 1608 for displaying the virtual scene; and a connection bus 1610 for connecting various module components in the electronic device.
[0193] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing device, such as a server, terminal and other electronic devices, may become a node in the blockchain system by joining the peer-to-peer network.
[0194] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the virtual character control method provided in various optional implementations of the above-mentioned virtual character control aspects.
[0195] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0196] S1, displaying a virtual scene where a first virtual character is located and the first virtual character located in the virtual scene, wherein the first virtual character is a player-controlled character and the first virtual character is a non-player-controlled character;
[0197] S2, during the movement of the first virtual character, obtaining a target turning instruction, wherein the target turning instruction is used to instruct the first virtual character to turn from a first direction to a second direction;
[0198] S3, in response to the target turning instruction, during the movement of the first virtual character, controlling the first virtual character to continuously turn multiple times starting from the first direction until it turns to the second direction.
[0199] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0200] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0201] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
[0202] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0203] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0204] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0205] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0206] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for controlling a virtual character, characterized in that: include: Displaying a virtual scene where a first virtual character is located and the first virtual character, wherein the first virtual character is a character not controlled by a player; In the process of the movement of the first virtual character, in response to receiving a control message instructing the first virtual character to turn and move, if the preview animation system node is turned on, the upper body of the first virtual character is controlled to lock the direction to the target virtual character; the lower body of the first virtual character is controlled to set the predetermined moving direction as the moving direction, and the animations corresponding to the upper body and the lower body are mixed and displayed; When the preview animation system node is not turned on and the node corresponding to the smooth rotation function is turned on, displaying the rotation process of the first virtual character from the first direction to the second direction; During the rotation of the first virtual character, setting an interpolation speed; When the difference between the angles of the first direction and the second direction is greater than the interpolation speed, the first virtual character is controlled to make multiple consecutive rotations starting from the first direction according to the interpolation speed until it rotates to the second direction, wherein the interpolation speed is used to indicate the rotation angle of each rotation in the multiple rotations, and the interpolation speed is configured to be positively correlated with the model size of the first virtual character.
2. The method according to claim 1, characterized in that When the preview animation system node is turned on, controlling the upper body of the first virtual character to lock the direction to the target virtual character includes: When the first virtual character holds a virtual attack prop and the first virtual character moves, the crosshair of the virtual attack prop held by the first virtual character is controlled to always aim at the target virtual character; or When the first virtual character does not hold a virtual attacking prop and the first virtual character is moving, the direction of the first virtual character is controlled to always be aligned with the target virtual character.
3. The method according to claim 1, characterized in that The step of controlling the first virtual character to rotate continuously multiple times from the first direction according to the interpolation speed until rotating to the second direction includes: During the rotation of the first virtual character, the first virtual character is controlled to rotate continuously N times starting from the first direction until it rotates to the second direction, wherein, in at least the first N-1 rotations of the N rotations, the rotation angle of the first virtual character is the same each time, and N is a positive integer greater than or equal to 2.
4. The method according to claim 1, characterized in that: The step of controlling the first virtual character to rotate continuously multiple times from the first direction according to the interpolation speed until rotating to the second direction includes: During the rotation of the first virtual character, the first virtual character is controlled to rotate continuously N times starting from the first direction until it rotates to the second direction, wherein the time interval between each two adjacent rotations in the N rotations is less than or equal to a preset duration, and the time interval is used to enable the first virtual character to rotate smoothly from the first direction to the second direction.
5. A method for controlling a virtual character, characterized in that: include: Displaying a virtual scene where a first virtual character is located and the first virtual character, wherein the first virtual character is a character not controlled by a player; In the process of the movement of the first virtual character, in response to receiving a control message instructing the first virtual character to turn and move, a target turning instruction is obtained, wherein the target turning instruction is used to instruct the first virtual character to turn from a first direction to a second direction, and in the case where the preview animation system node is turned on, the upper body of the first virtual character is controlled to lock the direction to the target virtual character; the lower body of the first virtual character is controlled, the predetermined moving direction is set as the moving direction, and the animations corresponding to the upper body and the lower body are mixed and displayed; In response to the target turning instruction, when the preview animation system node is not turned on and the node corresponding to the smooth rotation function is turned on, during the movement of the first virtual character, controlling the first virtual character to continuously rotate multiple times from the first direction until it rotates to the second direction; During the rotation of the first virtual character, setting an interpolation speed; When the difference between the angles of the first direction and the second direction is greater than the interpolation speed, the first virtual character is controlled to make multiple consecutive rotations starting from the first direction according to the interpolation speed until it rotates to the second direction, wherein the interpolation speed is used to indicate the rotation angle of each rotation in the multiple rotations, and the interpolation speed is configured to be positively correlated with the model size of the first virtual character.
6. The method according to claim 5, characterized in that When the preview animation system node is turned on, controlling the upper body of the first virtual character to lock the direction to the target virtual character includes: When the first virtual character holds a virtual attack prop, in response to a target aiming instruction, during the movement of the first virtual character, the crosshair of the virtual attack prop held by the first virtual character is controlled to always aim at the target virtual character; or When the first virtual character does not hold a virtual attacking prop, in response to a target aiming instruction, during the movement of the first virtual character, the direction of the first virtual character is controlled to always aim at the target virtual character.
7. A control device for a virtual character, characterized in that: include: A first display module, used for displaying a virtual scene where a first virtual character is located and the first virtual character, wherein the first virtual character is a character not controlled by a player; A second display module, used for displaying a rotation process of the first virtual character from a first direction to a second direction during the movement of the first virtual character; A first control module, used for controlling the first virtual character to rotate continuously multiple times starting from the first direction until rotating to the second direction during the rotation of the first virtual character; The device is also used for: in the process of the movement of the first virtual character, in response to receiving a control message instructing the first virtual character to turn and move, when the preview animation system node is turned on, controlling the upper body of the first virtual character to lock the direction to the target virtual character; controlling the lower body of the first virtual character, setting a predetermined moving direction as the moving direction, and mixing and displaying the animations corresponding to the upper body and the lower body; when the preview animation system node is not turned on and the node corresponding to the smooth rotation function is turned on, displaying the rotation process of the first virtual character from the first direction to the second direction; during the rotation process of the first virtual character, setting an interpolation speed; when the difference between the angles of the first direction and the second direction is greater than the interpolation speed, controlling the first virtual character to rotate continuously for multiple times starting from the first direction according to the interpolation speed until it rotates to the second direction, wherein the interpolation speed is used to indicate the rotation angle of each rotation in the multiple rotations, and the interpolation speed is configured to be positively correlated with the model size of the first virtual character.
8. The device according to claim 7, characterized in that The device is used to control the upper body of the first virtual character to lock the direction to the target virtual character in the following manner when the preview animation system node is turned on: When the first virtual character holds a virtual attack prop and the first virtual character moves, the crosshair of the virtual attack prop held by the first virtual character is controlled to always aim at the target virtual character; or When the first virtual character does not hold a virtual attacking prop and the first virtual character is moving, the direction of the first virtual character is controlled to always be aligned with the target virtual character.
9. The device according to claim 7, characterized in that The first control module is also used for: The first control unit is used to control the first virtual character to rotate continuously N times starting from the first direction until it rotates to the second direction during the rotation of the first virtual character, wherein in at least the first N-1 rotations of the N rotations, the rotation angle of each rotation of the first virtual character is the same, and N is a positive integer greater than or equal to 2.
10. The device according to claim 7, characterized in that The first control module is also used for: A second control unit is used to control the first virtual character to rotate continuously N times starting from the first direction until it rotates to the second direction during the rotation of the first virtual character, wherein the time interval between each two adjacent rotations of the N rotations is less than or equal to a preset time length, and the time interval is used to enable the first virtual character to rotate smoothly from the first direction to the second direction.
11. A control device for a virtual character, characterized in that: include: A third display module, used for displaying a virtual scene where a first virtual character is located and the first virtual character, wherein the first virtual character is a character not controlled by a player; An acquisition module, used for acquiring a target turning instruction during the movement of the first virtual character, wherein the target turning instruction is used for instructing the first virtual character to turn from a first direction to a second direction; A second control module is used for controlling the first virtual character to rotate continuously multiple times from the first direction until it rotates to the second direction in response to the target turning instruction during the movement of the first virtual character; The device is also used for: in the process of the movement of the first virtual character, in response to receiving a control message instructing the first virtual character to turn and move, when the preview animation system node is turned on, controlling the upper body of the first virtual character to lock the direction to the target virtual character; controlling the lower body of the first virtual character, setting a predetermined moving direction as the moving direction, and mixing and displaying the animations corresponding to the upper body and the lower body; when the preview animation system node is not turned on and the node corresponding to the smooth rotation function is turned on, displaying the rotation process of the first virtual character from the first direction to the second direction; during the rotation process of the first virtual character, setting an interpolation speed; when the difference between the angles of the first direction and the second direction is greater than the interpolation speed, controlling the first virtual character to rotate continuously for multiple times starting from the first direction according to the interpolation speed until it rotates to the second direction, wherein the interpolation speed is used to indicate the rotation angle of each rotation in the multiple rotations, and the interpolation speed is configured to be positively correlated with the model size of the first virtual character.
12. The device according to claim 11, characterized in that The device is used to control the upper body of the first virtual character to lock the direction to the target virtual character in the following manner when the preview animation system node is turned on: When the first virtual character holds a virtual attack prop, in response to a target aiming instruction, during the movement of the first virtual character, the crosshair of the virtual attack prop held by the first virtual character is controlled to always aim at the target virtual character; or When the first virtual character does not hold a virtual attacking prop, in response to a target aiming instruction, during the movement of the first virtual character, the direction of the first virtual character is controlled to always aim at the target virtual character.
13. The device according to claim 11, characterized in that The device is also used for: During the rotation of the first virtual character, the first virtual character is controlled to rotate continuously N times starting from the first direction until it rotates to the second direction, wherein, in at least the first N-1 rotations of the N rotations, the rotation angle of the first virtual character is the same each time, and N is a positive integer greater than or equal to 2.
14. The device according to claim 11, characterized in that The device is also used for: During the rotation of the first virtual character, the first virtual character is controlled to rotate continuously N times starting from the first direction until it rotates to the second direction, wherein the time interval between each two adjacent rotations in the N rotations is less than or equal to a preset duration, and the time interval is used to enable the first virtual character to rotate smoothly from the first direction to the second direction.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program can be executed by a terminal device or a computer to execute the method described in any one of claims 1 to 4 or 5 to 6.
16. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method described in any one of claims 1 to 4 or 5 to 6 are implemented.
17. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method described in any one of claims 1 to 4 or 5 to 6 through the computer program.
