CN111151003B - Virtual object control method and device - Google Patents

Virtual object control method and device Download PDF

Info

Publication number
CN111151003B
CN111151003B CN201911421337.9A CN201911421337A CN111151003B CN 111151003 B CN111151003 B CN 111151003B CN 201911421337 A CN201911421337 A CN 201911421337A CN 111151003 B CN111151003 B CN 111151003B
Authority
CN
China
Prior art keywords
virtual object
speed
current
determining
virtual
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911421337.9A
Other languages
Chinese (zh)
Other versions
CN111151003A (en
Inventor
谢昭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN201911421337.9A priority Critical patent/CN111151003B/en
Publication of CN111151003A publication Critical patent/CN111151003A/en
Application granted granted Critical
Publication of CN111151003B publication Critical patent/CN111151003B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/40Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment
    • A63F13/42Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle
    • A63F13/428Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle involving motion or position input signals, e.g. signals representing the rotation of an input controller or a player's arm motions sensed by accelerometers or gyroscopes
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/40Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment
    • A63F13/42Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle
    • A63F13/426Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle involving on-screen location information, e.g. screen coordinates of an area at which the player is aiming with a light gun
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/55Controlling game characters or game objects based on the game progress
    • A63F13/57Simulating properties, behaviour or motion of objects in the game world, e.g. computing tyre load in a car race game
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/10Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by input arrangements for converting player-generated signals into game device control signals
    • A63F2300/1068Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by input arrangements for converting player-generated signals into game device control signals being specially adapted to detect the point of contact of the player on a surface, e.g. floor mat, touch pad
    • A63F2300/1075Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by input arrangements for converting player-generated signals into game device control signals being specially adapted to detect the point of contact of the player on a surface, e.g. floor mat, touch pad using a touch screen
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program
    • A63F2300/64Methods for processing data by generating or executing the game program for computing dynamical parameters of game objects, e.g. motion determination or computation of frictional forces for a virtual car

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Human Computer Interaction (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention discloses a control method and device for a virtual object. Wherein the method comprises the following steps: responding to touch operation acted on the virtual control, determining an operation direction of the touch operation, and acquiring current state information of the virtual object in a game scene, wherein the current state information comprises: current direction of movement and current speed; determining an included angle between the operation direction and the current moving direction; determining target state information of the virtual object according to the included angle and the current state information, wherein the target state information comprises: a target moving direction and a target speed; and controlling the virtual object to move according to the target state information. The invention solves the technical problem of overhigh computing resource consumed by controlling the virtual object in the game in the prior art.

Description

Virtual object control method and device
Technical Field
The present invention relates to the field of computers, and in particular, to a method and apparatus for controlling a virtual object.
Background
In a virtual scene of a game, movement of a virtual character is often involved, and movement of the virtual character is involved in various physical solutions. At present, some roles in the PC-side game, such as four-wheel drive vehicles, role climbing and the like, need to pay more computing resources for physical calculation, and on a mobile platform, calculation and simulation similar to those of four-wheel vehicles exist, which are modes of applying corresponding input to a physical system, and the physical system calculates to obtain corresponding simulation results.
The above-mentioned manner of controlling movement of the virtual character is very difficult for the terminal, especially for the mobile terminal, to perform a great deal of complex object understanding due to the function limitation, and the number of virtual objects simultaneously stored in one combat is small due to the huge consumption of the object understanding calculation and the limited computational resources capable of supporting the calculation.
Aiming at the problem of excessive consumption of computing resources for controlling virtual objects in games in the prior art, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a control method and a device for a virtual object, which at least solve the technical problem that the computing resources consumed by controlling the virtual object in a game are too high in the prior art.
According to an aspect of an embodiment of the present invention, there is provided a control method of a virtual object, including: responding to touch operation acted on the virtual control, determining an operation direction of the touch operation, and acquiring current state information of the virtual object in a game scene, wherein the current state information comprises: current direction of movement and current speed; determining an included angle between the operation direction and the current moving direction; determining target state information of the virtual object according to the included angle and the current state information, wherein the target state information comprises: a target moving direction and a target speed; and controlling the virtual object to move according to the target state information.
Optionally, determining target state information of the virtual object according to the included angle and the current state information includes: determining a target moving direction according to the included angle and the current moving direction; and determining a target speed according to the current speed.
Optionally, determining the target moving direction according to the included angle and the current moving direction includes: if the included angle is smaller than a first preset angle, determining that the target moving direction is the same as the current moving direction; if the included angle is larger than or equal to a second preset angle, determining that the target moving direction is opposite to the current moving direction, wherein the second preset angle is larger than the first preset angle; and if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, determining that the target moving direction deviates from the current moving direction.
Optionally, the virtual object is in a first virtual scene, the virtual object in the first virtual scene includes a virtual character and a virtual carrier, wherein the virtual carrier is a horse, and the determining the target moving direction according to the included angle and the current moving direction includes: if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, determining that the target moving direction of the virtual object is adjusted from the current moving direction to the operation direction in the turning movement process of the virtual object.
Optionally, if the included angle is greater than or equal to the first preset angle and less than the second preset angle, determining the target speed according to the current speed includes: determining the centripetal speed of the virtual object when turning according to the preset steering angular speed and the preset steering radius of the virtual object, wherein the steering radius is determined according to the operation direction of touch operation; and superposing the current speed and the centripetal speed of the virtual object to obtain the target speed.
Optionally, the virtual object moves on the ice in a second virtual scene, and determining the target speed according to the current speed includes: if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, controlling the virtual object to decelerate according to the fourth acceleration from the current speed to obtain the first speed; acquiring a control speed generated by operating the virtual control, and accelerating according to a fifth acceleration on the basis of the control speed to obtain a second speed, wherein the direction of the control speed is the same as the operation direction; and superposing the first speed and the second speed to obtain the target speed.
Optionally, if the included angle is greater than or equal to the first preset angle and less than the second preset angle, determining the target moving direction according to the current moving direction and the operation direction includes: the target moving direction is determined to be the same as the direction of the target speed.
Optionally, determining the target speed according to the current speed when the included angle is smaller than the first preset angle includes: in the process of operating the virtual control, if the current speed is smaller than the preset maximum speed, accelerating according to the first acceleration on the basis of the current speed to obtain a target speed, and if the current speed of the virtual object reaches the maximum speed, determining the maximum speed as the target speed; and under the condition that the operation of the virtual control is stopped, the target speed is obtained by decelerating according to the second acceleration on the basis of the current speed.
Optionally, determining the target speed according to the current speed when the included angle is greater than or equal to a second preset angle includes: decelerating to zero according to a third acceleration on the basis of the current speed; and determining a preset speed opposite to the current moving direction as a target speed.
According to an aspect of an embodiment of the present invention, there is provided a control method of a virtual object, including: responding to touch operation acted on the virtual control, determining an operation direction of the touch operation, and acquiring current state information of the virtual object in a game scene, wherein the current state information comprises: current direction of movement and current speed; determining an included angle between the operation direction and the current moving direction of the virtual object; and determining a moving mode of the virtual object in the game scene according to the included angle, and controlling the virtual object to move in the moving mode according to the current state information.
Optionally, determining a movement mode of the virtual object in the game scene according to the included angle includes: if the included angle is smaller than a first preset angle, determining that the moving mode is a forward mode; if the included angle is larger than or equal to a second preset angle, determining that the moving mode is a reversing mode; if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, determining that the mode is a turning mode.
Optionally, the moving mode is a forward mode, and the virtual object is controlled to move in the moving mode according to the current state information, including: in the process of operating the virtual control, if the current speed of the virtual object is smaller than the preset maximum speed, controlling the virtual object to move in an accelerating way according to the first acceleration, and if the current speed of the virtual object reaches the maximum speed, controlling the virtual object to keep moving at the maximum speed; and controlling the virtual object to move in a decelerating manner according to the second acceleration under the condition that the operation of the virtual control is stopped.
Optionally, the moving mode is a reverse mode, and the virtual object is controlled to move in the moving mode according to the current state information, including: decelerating to zero according to a third acceleration on the basis of the current speed; and controlling the virtual object to move in the opposite direction of the current moving direction according to the preset speed.
Optionally, the virtual object is in a first virtual scene, the virtual object in the first virtual scene includes a virtual character and a virtual carrier, wherein the virtual carrier is a horse, the moving mode is a turning mode, and the virtual object is controlled to move in the moving mode according to the current state information, including: determining the centripetal speed of the virtual object when turning according to the preset steering angular speed and the preset steering radius of the virtual object, wherein the steering radius is determined according to the operation direction of touch operation; and superposing the current moving speed and the centripetal speed of the virtual object to obtain the moving speed of the virtual object when the virtual object turns.
Optionally, the virtual object in the second virtual scene moves on the ice, the moving mode is a turning mode, and the virtual object is controlled to move in the moving mode according to the current state information, including: controlling the virtual object to be decelerated according to the fourth acceleration from the current speed to obtain a first speed; acquiring a control speed generated by operating the virtual control, and accelerating according to a fifth acceleration on the basis of the control speed to obtain a second speed, wherein the direction of the control speed is the same as the operation direction; and superposing the first speed and the second speed to obtain the moving speed of the virtual object when turning.
According to an aspect of an embodiment of the present invention, there is provided a control apparatus for a virtual object, including: the first determining module is used for responding to touch operation acted on the virtual control, determining an operation direction of the touch operation and acquiring current state information of the virtual object in the game scene, wherein the current state information comprises: current direction of movement and current speed; the second determining module is used for determining an included angle between the operation direction and the current moving direction; the acquisition module is used for determining target state information of the virtual object according to the included angle and the current state information, wherein the target state information comprises: a target moving direction and a target speed; and the control module is used for controlling the virtual object to move according to the target state information.
According to an aspect of an embodiment of the present invention, there is provided a storage medium, the storage medium including a stored program, wherein when the program runs, a device on which the storage medium is controlled to execute the above-described control method for a virtual object.
According to an aspect of an embodiment of the present invention, there is provided a processor, configured to execute a program, where the program executes the above-mentioned control method of a virtual object.
In the embodiment of the invention, in response to touch operation acting on a virtual control, an operation direction of the touch operation is determined, and current state information of a virtual object in a game scene is acquired, wherein the current state information comprises: current direction of movement and current speed; determining an included angle between the operation direction and the current moving direction; determining target state information of the virtual object according to the included angle and the current state information, wherein the target state information comprises: a target moving direction and a target speed; and controlling the virtual object to move according to the target state information. According to the scheme, the virtual object is modeled as a whole, only key parameters (the current moving direction, the current speed and the included angle) with high performance correlation are introduced, other complex interaction solutions are ignored, so that the consumption of computing resources can be reduced, the technical problem that the computing resources consumed by controlling the virtual object in the game in the prior art are too high is solved, and a plurality of virtual objects can exist on the mobile terminal at the same time.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
FIG. 1 is a flow chart of a method of controlling a virtual object according to an embodiment of the present application;
FIG. 2 is a schematic illustration of an included angle determination according to an embodiment of the present application;
FIG. 3 is a schematic illustration of a virtual object turning in a first virtual scene according to an embodiment of the present application;
FIG. 4 is a schematic diagram of controlling virtual object steering in a second scenario according to an embodiment of the present application;
FIG. 5 is a flow chart of another method of controlling a virtual object according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a control device for a virtual object according to an embodiment of the present application; and
fig. 7 is a schematic diagram of a control device for a virtual object according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
One embodiment
According to an embodiment of the present invention, there is provided an embodiment of a control method of a virtual object, it being noted that the steps shown in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be performed in an order different from that herein.
Fig. 1 is a flowchart of a control method of a virtual object according to an embodiment of the present application, as shown in fig. 1, the method includes the following steps:
step S102, in response to the touch operation on the virtual control, determining the operation direction of the touch operation, and obtaining the current state information of the virtual object in the game scene, wherein the current state information comprises: current direction of movement and current speed.
Specifically, the virtual control may be a virtual rocker, which is used for controlling the motion state of the virtual object in the game scene. In an alternative embodiment, taking a game running on the mobile terminal as an example, the virtual control may be disposed at the lower left corner or the lower right corner of the graphical user interface corresponding to the game, so as to facilitate the user to operate the game.
The process of operating the virtual control may be a process of moving the virtual control from the origin center position to other positions through a touch operation on the terminal device, and a direction pointing to the other positions from the origin center position is an operation direction of the touch operation. And in the process of operating the virtual control, acquiring the operation direction of touch operation and the current state information of the virtual object in the game scene in real time so as to control the virtual object.
The current moving direction of the virtual object is used for representing the moving direction of the virtual object, and the current speed of the virtual object is used for representing the moving speed of the virtual object in the game scene. The virtual object further includes a direction, which is used to represent a direction in which the virtual object faces, and the direction of the virtual object may be the same as or different from the moving direction of the virtual object. For example, the virtual object is oriented in the same direction as it moves forward, but is oriented in a different direction as it moves backward.
In an alternative embodiment, taking a game running on a mobile terminal as an example, the device detects touch operation on the virtual control in real time. When the touch operation on the virtual object is detected, the operation direction of the touch operation and the current state information of the virtual object are obtained.
Step S104, determining an included angle between the operation direction and the current moving direction.
Specifically, on the basis of determining the operation direction, the included angle between the virtual object and the current moving direction of the virtual object can be determined.
Fig. 2 is a schematic diagram for determining an included angle according to an embodiment of the present application, and, with reference to fig. 2, arrow P1 is used to represent a current moving direction of a virtual object, and arrow P2 is used to represent an operation direction of a touch operation. The included angle between the arrow P1 and the arrow P2 is the included angle between the operation direction and the current moving direction.
In an alternative embodiment, the angle of the current moving direction relative to the 0-angle coordinate axis in the world coordinate system in the game scene and the angle of the operating direction relative to the 0-angle coordinate axis in the world coordinate system may be determined separately, and then the difference between the two angles is obtained, that is, the included angle.
In another alternative embodiment, the current moving direction of the virtual object may be taken as a direction of 0 degrees, and after the touch operation for controlling the virtual control is detected, an angle of the operation direction of the touch operation with respect to the current moving direction of the virtual object is determined, where the angle is the above included angle.
Step S106, determining target state information of the virtual object according to the included angle and the current state information, wherein the target state information comprises: a target movement direction and a target speed.
After determining the included angle between the operation direction and the current moving direction, the control intention of the virtual object can be determined, and then the target state of the virtual object is determined.
In an alternative embodiment, the target moving direction may be determined according to an included angle, for example, if the included angle is greater than a preset angle value, it is determined that the virtual object needs to be controlled to turn, the current moving direction is changed to obtain the target moving direction, and if the included angle is less than the preset value, it is determined that the virtual object needs to be controlled to advance, the current moving direction is maintained, and the current moving direction is taken as the target moving direction.
In an alternative embodiment, the target speed may be obtained in combination with the current speed on the basis of the target movement direction. For example, in the case where the target moving direction is the same as the current moving direction, acceleration may be performed according to the current speed until the touch operation is stopped; in the case where the target moving direction is different from the current moving direction, the target speed may be obtained by superimposing the current speed and a new speed generated by the touch operation.
Step S108, the virtual object is controlled to move according to the target state information.
And controlling the virtual object to move according to the target state information of the virtual object, namely controlling the virtual object to enable the virtual object to reach the target state recorded in the target state information. The target state information comprises the target moving direction and the target speed, so the scheme is used for controlling the virtual object to achieve the target moving direction and the target speed in the target state information, and the movement control of the virtual object is realized.
As can be seen from the above, in the embodiments of the present application, in response to a touch operation applied to a virtual control, an operation direction of the touch operation is determined, and current state information of a virtual object in a game scene is obtained, where the current state information includes: current direction of movement and current speed; determining an included angle between the operation direction and the current moving direction; determining target state information of the virtual object according to the included angle and the current state information, wherein the target state information comprises: a target moving direction and a target speed; and controlling the virtual object to move according to the target state information. According to the scheme, the virtual object is modeled as a whole, only key parameters (the current moving direction, the current speed and the included angle) with high performance correlation are introduced, other complex interaction solutions are ignored, so that the consumption of computing resources can be reduced, the technical problem that the computing resources consumed by controlling the virtual object in the game in the prior art are too high is solved, and a plurality of virtual objects can exist on the mobile terminal at the same time.
As the virtual object to be resolved is stepped up, the consumption of its use is also increasing. In addition to these resolving costs, more costs are put on rendering and logic processing, and typically more than 10% of the resolving costs are allocated to the mobile platform, and the processor is too stressed.
As an alternative embodiment, determining target state information of the virtual object according to the included angle and the current state information includes: determining a target moving direction according to the included angle and the current moving direction; and determining a target speed according to the current speed.
Whether the current moving direction is changed or not can be determined according to the included angle, so that whether the target moving direction is the same as the current moving direction or not is determined, acceleration, deceleration or speed superposition can be performed on the basis of the current speed, and the target speed is obtained. The following is a detailed description.
As an alternative embodiment, determining the target movement direction according to the included angle and the current movement direction includes: if the included angle is smaller than a first preset angle, determining that the target moving direction is the same as the current moving direction; if the included angle is larger than or equal to a second preset angle, determining that the target moving direction is opposite to the current moving direction, wherein the second preset angle is larger than the first preset angle, and the second preset angle is larger than the first preset angle; and if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, determining that the target moving direction deviates from the current moving direction.
The direction of operation of the virtual control is used to reflect the direction in which the virtual object is required to move. In the above scheme, if the included angle is smaller than the first preset angle, determining that the target moving direction is the same as the current moving direction, that is, determining that the moving mode of the virtual object is forward; if the included angle is larger than a second preset value, determining that the target moving direction is opposite to the current moving direction (but the direction of the virtual object can be unchanged), and determining a reversing mode of the moving mode of the virtual object; if the included angle is larger than the first angle and the angle and smaller than the second preset angle, the target moving direction is determined to be changed on the basis of the current moving direction, and the moving mode of the virtual object is determined to be a turning mode.
When the virtual object is expected to move forward in the game scene, touch operation in the same operation direction as the current movement direction (the included angle is 0 degrees) can be performed on the virtual control, but because a certain error exists in the touch operation, the operation direction of the touch operation is difficult to be completely the same as the current movement direction of the virtual object, and therefore touch operation of determining that the included angle of the touch operation and the virtual control is smaller than a first preset angle is used for controlling the virtual object to move forward. Likewise, when the virtual object is expected to retreat, touch operation in an operation direction opposite to the current moving direction (the included angle is 180 °) can be performed on the virtual control, but because a certain error exists in the touch operation, the touch operation with the included angle larger than the second preset angle is determined to be used for controlling the virtual object to retreat. When the included angle is greater than or equal to the first preset angle and smaller than the second preset angle, it can be determined that the control intention of the virtual object is turning movement, so that the current movement direction needs to be changed.
In an alternative embodiment, as shown in fig. 2, the area formed by the upper dashed line in fig. 2 is an area with an included angle smaller than the first preset angle, and the touch operation in the area with the operation direction is used to control the virtual object to advance, where the corresponding target moving direction is unchanged, for example, P2; the area formed by the lower dotted line is an area with an included angle larger than or equal to a second preset angle, and the touch operation of which the operation direction falls in the area is used for controlling the virtual object to retreat, and the corresponding target moving direction is unchanged, such as P3; the area formed by the upper left broken line and the lower left broken line, and the area formed by the upper right broken line and the lower right broken line are the areas with the included angle larger than or equal to the first preset angle and smaller than the second preset angle, and the touch operation with the operation direction falling in the areas is used for controlling the virtual object to turn, such as P4.
As an optional embodiment, the virtual object is in a first virtual scene, where the virtual object in the first virtual scene includes a virtual character and a virtual carrier, the virtual carrier is a horse, and determining the target moving direction according to the included angle and the current moving direction includes: if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, determining that the target moving direction of the virtual object is adjusted from the current moving direction to the operation direction in the turning movement process of the virtual object.
The virtual objects in the first virtual scene include virtual characters and virtual carriers, and in an alternative embodiment, the virtual characters may be horses, and the first virtual scene is a scene in which the virtual characters move on horse in the game.
And if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, determining to control the virtual object to turn. Because the virtual object of the virtual scene comprises the virtual carrier, the virtual object can be controlled to turn according to a certain radian without direct turning. In the process of turning the virtual object, the moving direction of the virtual object continuously changes until the virtual object completely turns to the operation direction pointed by the touch operation. However, in this process, if the virtual control is released, it is difficult for the virtual object to be completely turned to the operation direction, and only the moving direction of the virtual object when the virtual control is released may be stagnant. When a touch operation for controlling the virtual object to turn is received, the moving direction of the virtual object changes in the turning process, and the virtual object is turned from the current moving direction to the operation direction of the touch operation.
As an alternative embodiment, if the included angle is greater than or equal to the first preset angle and less than the second preset angle, determining the target speed according to the current speed includes: determining the centripetal speed of the virtual object when turning according to the preset steering angular speed and the preset steering radius of the virtual object, wherein the steering radius is determined according to the operation direction of touch operation; and superposing the current speed and the centripetal speed of the virtual object to obtain the target speed.
Specifically, the steering angular velocity is a preset designated velocity, and the steering radius and the angle of the turn show an inverse proportion relation, that is, the larger the angle of the turn is, the smaller the steering radius is.
Fig. 3 is a schematic diagram of a virtual object turning in a first virtual scene according to an embodiment of the present application, and in conjunction with fig. 3, a point 0 is a position of the virtual object in a turning process, v0 is a current speed of the virtual object, v1 is a centripetal speed, where v1=w×r, w represents a preset steering angular speed, and r is a steering radius. And superposing v0 and v1 to obtain v2, namely the target speed of the virtual object.
As an alternative embodiment, the virtual object in the second virtual scene moves on the ice surface, and the determining the target speed according to the current speed includes: if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, controlling the virtual object to decelerate according to the fourth acceleration from the current speed to obtain the first speed; acquiring a control speed generated by operating the virtual control, and accelerating according to a fifth acceleration on the basis of the control speed to obtain a second speed, wherein the direction of the control speed is the same as the operation direction; and superposing the first speed and the second speed to obtain the target speed.
Specifically, the second virtual scene may be a game scene in which a virtual object moves on an ice surface. The virtual object may include only the virtual character and not the virtual vehicle, so that steering may be directly performed under the condition that the included angle is greater than or equal to the first preset angle and less than the second preset angle.
In the above scheme, the control virtual object decelerates on the basis of the current speed, and accelerates the control speed in the operation direction of the touch operation, so as to realize the steering of the virtual object, wherein the control speed is zero at the beginning. Fig. 4 is a schematic diagram of controlling the steering of the virtual object in the second scenario according to the embodiment of the present application, and in combination with fig. 4, v11 is the current speed of the virtual object at a certain moment in the steering process, it is decelerated according to the fourth acceleration, v12 is the speed of the same moment in the operation direction, it accelerates according to the fifth acceleration, v11 and v12 are overlapped to obtain v13, and v13 is the target speed of the virtual object at the moment. With the increase of time, v11 is reduced to 0, and v12 is increased to a preset maximum speed, so that the steering control of the virtual object is realized.
As an alternative embodiment, if the included angle is greater than or equal to the first preset angle and less than the second preset angle, determining the target moving direction according to the current moving direction and the operation direction includes: the target moving direction is determined to be the same as the direction of the target speed.
In the second virtual scene, the virtual object may include only the virtual character and not the virtual vehicle, so that the target moving direction is easy to change, and the target moving direction is consistent with the target speed, and the target object is oriented in the same direction as the operation direction.
As an optional embodiment, determining the target speed according to the current speed when the included angle is smaller than the first preset angle includes: in the process of operating the virtual control, if the current speed is smaller than the preset maximum speed, accelerating according to the first acceleration on the basis of the current speed to obtain a target speed, and if the current speed of the virtual object reaches the maximum speed, determining the maximum speed as the target speed; and under the condition that the operation of the virtual control is stopped, the target speed is obtained by decelerating according to the second acceleration on the basis of the current speed.
And under the condition that the included angle is smaller than a first preset angle, determining to control the virtual object to advance. Specifically, the first acceleration and the second acceleration may be the same.
In an alternative embodiment, as shown in fig. 2, the operation direction of the touch operation is P1, and the current movement speed is less than the preset maximum speed, the virtual object accelerates to the maximum speed according to the first acceleration, and continues to move according to the maximum speed after reaching the maximum speed. And after stopping the touch operation of the virtual control, decelerating the virtual object according to the second acceleration until stopping.
As an optional embodiment, when the included angle is greater than or equal to a second preset angle, determining the target speed according to the current speed includes: decelerating to zero according to a third acceleration on the basis of the current speed; and determining a preset speed opposite to the current moving direction as a target speed.
Specifically, the magnitude relation between the third acceleration and the first and second accelerations is not specifically limited in this application. And controlling the virtual object to back up under the condition that the included angle is larger than or equal to a second preset angle.
When the virtual object is controlled to back up, firstly, the virtual object is controlled to be decelerated to be static, then the virtual object is backed up backwards according to a preset speed, and the moving direction of the virtual object is unchanged when the virtual object backs up.
One embodiment
According to an embodiment of the present invention, there is provided an embodiment of another control method for a virtual object, and fig. 5 is a flowchart of another control method for a virtual object according to an embodiment of the present application, as shown in fig. 5, and the method includes the following steps:
step S502, in response to the touch operation on the virtual control, determining an operation direction of the touch operation, and obtaining current state information of the virtual object in the game scene, wherein the current state information comprises: current direction of movement and current speed.
Specifically, the virtual control may be a virtual rocker, which is used for controlling the motion state of the virtual object in the game scene. In an alternative embodiment, taking a game running on the mobile terminal as an example, the virtual control may be disposed at the lower left corner or the lower right corner of the graphical user interface corresponding to the game, so as to facilitate the user to operate the game.
The process of operating the virtual control may be a process of moving the virtual control from the origin center position to other positions through a touch operation on the terminal device, and a direction pointing to the other positions from the origin center position is an operation direction of the touch operation. And in the process of operating the virtual control, acquiring the operation direction of touch operation and the current state information of the virtual object in the game scene in real time so as to control the virtual object.
The current moving direction of the virtual object is used for representing the moving direction of the virtual object, and the current speed of the virtual object is used for representing the moving speed of the virtual object in the game scene. The virtual object further includes a direction, which is used to represent a direction in which the virtual object faces, and the direction of the virtual object may be the same as or different from the moving direction of the virtual object. For example, the virtual object is oriented in the same direction as it moves forward, but is oriented in a different direction as it moves backward.
In an alternative embodiment, taking a game running on a mobile terminal as an example, the device detects touch operation on the virtual control in real time. When the touch operation on the virtual object is detected, the operation direction of the touch operation and the current state information of the virtual object are obtained.
In step S504, an angle between the operation direction and the current moving direction of the virtual object is determined.
Specifically, on the basis of determining the operation direction, the included angle between the virtual object and the current moving direction of the virtual object can be determined.
Fig. 2 is a schematic diagram for determining an included angle according to an embodiment of the present application, and, with reference to fig. 2, arrow P1 is used to represent a current moving direction of a virtual object, and arrow P2 is used to represent an operation direction of a touch operation. The included angle between the arrow P1 and the arrow P2 is the included angle between the operation direction and the current moving direction.
In an alternative embodiment, the angle of the current moving direction relative to the 0-angle coordinate axis in the world coordinate system in the game scene and the angle of the operating direction relative to the 0-angle coordinate axis in the world coordinate system may be determined separately, and then the difference between the two angles is obtained, that is, the included angle.
In another alternative embodiment, the current moving direction of the virtual object may be taken as a direction of 0 degrees, and after the touch operation for controlling the virtual control is detected, an angle of the operation direction of the touch operation with respect to the current moving direction of the virtual object is determined, where the angle is the above included angle.
Step S506, determining a moving mode of the virtual object in the game scene according to the included angle, and controlling the virtual object to move in the moving mode according to the current state information.
Specifically, the movement modes may include a forward movement mode, a backward movement mode and a turning mode, and according to the included angle, the movement mode of the virtual object in the game scene can be determined, that is, the control intention of the virtual object can be determined, and then other movement parameters of the virtual object in the corresponding movement mode can be determined.
In an alternative embodiment, the target moving direction may be determined according to an included angle, for example, if the included angle is greater than a preset angle value, it is determined that the virtual object needs to be controlled to turn, the current moving direction is changed to obtain the target moving direction, and if the included angle is less than the preset value, it is determined that the virtual object needs to be controlled to advance, the current moving direction is maintained, and the current moving direction is taken as the target moving direction.
In an alternative embodiment, the target speed may be obtained in combination with the current speed on the basis of the target movement direction. For example, in the case where the target moving direction is the same as the current moving direction, acceleration may be performed according to the current speed until the touch operation is stopped; in the case where the target moving direction is different from the current moving direction, the target speed may be obtained by superimposing the current speed and a new speed generated by the touch operation.
As can be seen from the above, in the embodiments of the present application, in response to a touch operation applied to a virtual control, an operation direction of the touch operation is determined, and current state information of a virtual object in a game scene is obtained, where the current state information includes: current direction of movement and current speed; determining an included angle between the operation direction and the current moving direction of the virtual object; and determining a moving mode of the virtual object in the game scene according to the included angle, and controlling the virtual object to move in the moving mode according to the current state information. According to the scheme, the virtual object is modeled as a whole, only key parameters (the current moving direction, the current speed and the included angle) with high performance correlation are introduced, other complex interaction solutions are ignored, so that the consumption of computing resources can be reduced, the technical problem that the computing resources consumed by controlling the virtual object in the game in the prior art are too high is solved, and a plurality of virtual objects can exist on the mobile terminal at the same time.
As the virtual object to be resolved is stepped up, the consumption of its use is also increasing. In addition to these resolving costs, more costs are put on rendering and logic processing, and typically more than 10% of the resolving costs are allocated to the mobile platform, and the processor is too stressed.
As an alternative embodiment, determining a movement pattern of the virtual object within the game scene according to the included angle includes: if the included angle is smaller than a first preset angle, determining that the moving mode is a forward mode; if the included angle is larger than or equal to a second preset angle, determining that the moving mode is a reversing mode; if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, determining that the mode is a turning mode.
The direction of operation of the virtual control is used to reflect the direction in which the virtual object is required to move. In the above scheme, if the included angle is smaller than the first preset angle, determining that the target moving direction is the same as the current moving direction, that is, determining that the moving mode of the virtual object is an advancing mode; if the included angle is larger than a second preset value, determining that the target moving direction is opposite to the current moving direction, and determining a reversing mode of the moving mode of the virtual object; if the included angle is larger than the first angle and the angle and smaller than the second preset angle, the target moving direction is determined to be changed on the basis of the current moving direction, and the moving mode of the virtual object is determined to be a turning mode.
When the virtual object is expected to move forward in the game scene, touch operation in the same operation direction as the current movement direction (the included angle is 0 degrees) can be performed on the virtual control, but because a certain error exists in the touch operation, the operation direction of the touch operation is difficult to be completely the same as the current movement direction of the virtual object, and therefore touch operation of determining that the included angle of the touch operation and the virtual control is smaller than a first preset angle is used for controlling the virtual object to move forward. Likewise, when the virtual object is expected to retreat, touch operation in an operation direction opposite to the current moving direction (the included angle is 180 °) can be performed on the virtual control, but because a certain error exists in the touch operation, the touch operation with the included angle larger than the second preset angle is determined to be used for controlling the virtual object to retreat. When the included angle is greater than or equal to the first preset angle and smaller than the second preset angle, it can be determined that the control intention of the virtual object is turning movement, so that the current movement direction needs to be changed.
In an alternative embodiment, as shown in fig. 2, the area formed by the upper dashed line in fig. 2 is an area with an included angle smaller than the first preset angle, and the touch operation in the area with the operation direction is used to control the virtual object to advance, where the corresponding target moving direction is unchanged, for example, P2; the area formed by the lower dotted line is an area with an included angle larger than or equal to a second preset angle, and the touch operation of which the operation direction falls in the area is used for controlling the virtual object to retreat, and the corresponding target moving direction is unchanged, such as P3; the area formed by the upper left broken line and the lower left broken line, and the area formed by the upper right broken line and the lower right broken line are the areas with the included angle larger than or equal to the first preset angle and smaller than the second preset angle, and the touch operation with the operation direction falling in the areas is used for controlling the virtual object to turn, such as P4.
As an alternative embodiment, the movement mode is a forward mode, and controlling the virtual object to move in the movement mode according to the current state information includes: in the process of operating the virtual control, if the current speed of the virtual object is smaller than the preset maximum speed, controlling the virtual object to move in an accelerating way according to the first acceleration, and if the current speed of the virtual object reaches the maximum speed, controlling the virtual object to keep moving at the maximum speed; and controlling the virtual object to move in a decelerating manner according to the second acceleration under the condition that the operation of the virtual control is stopped.
And under the condition that the included angle is smaller than a first preset angle, determining to control the virtual object to advance. Specifically, the first acceleration and the second acceleration may be the same.
In an alternative embodiment, as shown in fig. 2, the operation direction of the touch operation is P1, and the current movement speed is less than the preset maximum speed, the virtual object accelerates to the maximum speed according to the first acceleration, and continues to move according to the maximum speed after reaching the maximum speed. And after stopping the touch operation of the virtual control, decelerating the virtual object according to the second acceleration until stopping.
As an alternative embodiment, the moving mode is a reverse mode, and controlling the virtual object to move in the moving mode according to the current state information includes: decelerating to zero according to a third acceleration on the basis of the current speed; and controlling the virtual object to move in the opposite direction of the current moving direction according to the preset speed.
Specifically, the magnitude relation between the third acceleration and the first and second accelerations is not specifically limited in this application. And controlling the virtual object to back up under the condition that the included angle is larger than or equal to a second preset angle.
When the virtual object is controlled to back up, firstly, the virtual object is controlled to be decelerated to be static, then the virtual object is backed up backwards according to a preset speed, and the moving direction of the virtual object is unchanged when the virtual object backs up.
As an optional embodiment, the virtual object is in a first virtual scene, where the virtual object in the first virtual scene includes a virtual character and a virtual carrier, the virtual carrier is a horse, the moving mode is a turning mode, and the controlling the virtual object to move in the moving mode according to the current state information includes: determining the centripetal speed of the virtual object when turning according to the preset steering angular speed and the preset steering radius of the virtual object, wherein the steering radius is determined according to the operation direction of touch operation; and superposing the current moving speed and the centripetal speed of the virtual object to obtain the moving speed of the virtual object when the virtual object turns.
The virtual objects in the first virtual scene include virtual characters and virtual carriers, and in an alternative embodiment, the virtual characters may be horses, and the first virtual scene is a scene in which the virtual characters move on horse in the game. The steering angular velocity is a preset designated velocity, and the steering radius and the turning angle show an inverse proportion relation, namely, the larger the turning angle is, the smaller the steering radius is.
Fig. 3 is a schematic diagram of a virtual object turning in a first virtual scene according to an embodiment of the present application, and in conjunction with fig. 3, a point 0 is a position of the virtual object in a turning process, v0 is a current speed of the virtual object, v1 is a centripetal speed, where v1=w×r, w represents a preset steering angular speed, and r is a steering radius. And superposing v0 and v1 to obtain v2, namely the target speed of the virtual object.
As an optional embodiment, the virtual object in the second virtual scene moves on the ice, the moving mode is a turning mode, and the virtual object is controlled to move in the moving mode according to the current state information, including: controlling the virtual object to be decelerated according to the fourth acceleration from the current speed to obtain a first speed; acquiring a control speed generated by operating the virtual control, and accelerating according to a fifth acceleration on the basis of the control speed to obtain a second speed, wherein the direction of the control speed is the same as the operation direction; and superposing the first speed and the second speed to obtain the moving speed of the virtual object when turning.
The second virtual scene may be a game scene in which a virtual object moves on an ice surface. The virtual object may include only the virtual character and not the virtual vehicle, so that steering may be directly performed under the condition that the included angle is greater than or equal to the first preset angle and less than the second preset angle.
In the above scheme, the control virtual object decelerates on the basis of the current speed, and accelerates the control speed in the operation direction of the touch operation, so as to realize the steering of the virtual object, wherein the control speed is zero at the beginning. Fig. 4 is a schematic diagram of controlling the steering of the virtual object in the second scenario according to the embodiment of the present application, and in combination with fig. 4, v11 is the current speed of the virtual object at a certain moment in the steering process, it is decelerated according to the fourth acceleration, v12 is the speed of the same moment in the operation direction, it accelerates according to the fifth acceleration, v11 and v12 are overlapped to obtain v13, and v13 is the target speed of the virtual object at the moment. With the increase of time, v11 is reduced to 0, and v12 is increased to a preset maximum speed, so that the steering control of the virtual object is realized.
One embodiment
According to an embodiment of the present invention, there is provided a virtual object control apparatus for implementing the virtual object control method in embodiment 1, and fig. 6 is a schematic diagram of a virtual object control apparatus according to an embodiment of the present application, and in combination with fig. 6, the apparatus includes:
the first determining module 602 is configured to determine an operation direction of a touch operation in response to the touch operation acting on the virtual control, and obtain current state information of the virtual object in the game scene, where the current state information includes: current direction of movement and current speed.
A second determining module 604, configured to determine an angle between the operation direction and the current moving direction.
The obtaining module 606 is configured to determine target state information of the virtual object according to the included angle and the current state information, where the target state information includes: a target movement direction and a target speed.
The control module 608 is configured to control the virtual object to move according to the target state information.
As an alternative embodiment, the obtaining module includes: the first determining submodule is used for determining a target moving direction according to the included angle and the current moving direction; and a second determination sub-module for determining a target speed from the current speed.
As an alternative embodiment, the first determining submodule includes: the first determining unit is used for determining that the target moving direction is the same as the current moving direction if the included angle is smaller than a first preset angle; the second determining unit is used for determining that the target moving direction is opposite to the current moving direction if the included angle is larger than or equal to a second preset angle, wherein the second preset angle is larger than the first preset angle; and the third determining unit is used for determining that the target moving direction deviates from the current moving direction if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle.
As an optional embodiment, the virtual object is in a first virtual scene, where the virtual object in the first virtual scene includes a virtual character and a virtual carrier, and the virtual carrier is a horse, and the first determining submodule includes: and the fourth determining unit is used for determining that the target moving direction of the virtual object is converted from the current moving direction to the operation direction in the turning movement process of the virtual object if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle.
As an alternative embodiment, if the included angle is greater than or equal to the first preset angle and less than the second preset angle, the second determining submodule includes: a fifth determining unit, configured to determine a centripetal speed of the virtual object when turning according to a steering angular speed and a steering radius preset by the virtual object, where the steering radius is determined according to an operation direction of the touch operation; and the first superposition unit is used for superposing the current speed and the centripetal speed of the virtual object to obtain the target speed.
As an alternative embodiment, the virtual object is in a second virtual scene, the virtual object in the second virtual scene moving on the ice surface, the first control submodule comprising: the second deceleration control unit is used for controlling the virtual object to decelerate according to the fourth acceleration from the current speed to obtain the first speed if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle; the acquisition unit is used for acquiring a control speed generated by operating the virtual control, accelerating according to a fifth acceleration on the basis of the control speed and obtaining a second speed, wherein the direction of the control speed is the same as the operation direction; and the second superposition unit is used for superposing the first speed and the second speed to obtain the target speed.
As an alternative embodiment, if the included angle is greater than or equal to the first preset angle and less than the second preset angle, the first control submodule includes: and a sixth determining unit for determining that the target moving direction is the same as the direction of the target speed.
As an alternative embodiment, in case the included angle is smaller than the first preset angle, the second determining submodule includes: a seventh determining unit, configured to, in a process of operating the virtual control, if the current speed is less than a preset maximum speed, accelerate according to the first acceleration to obtain a target speed on the basis of the current speed, and if the current speed of the virtual object reaches the maximum speed, determine that the maximum speed is the target speed; and the eighth determining unit is used for obtaining the target speed according to the second acceleration deceleration on the basis of the current speed under the condition that the operation of the virtual control is stopped.
As an optional embodiment, in a case that the included angle is greater than or equal to a second preset angle, the second determining submodule includes: the first deceleration control unit is used for decelerating to zero according to the third acceleration on the basis of the current speed; and a ninth determining unit for determining a preset speed opposite to the current moving direction as a target speed.
One embodiment
According to an embodiment of the present invention, there is provided a virtual object control apparatus for implementing the virtual object control method in embodiment 2, and fig. 7 is a schematic diagram of a virtual object control apparatus according to an embodiment of the present application, and in combination with fig. 7, the apparatus includes:
the first determining module 702 is configured to determine an operation direction of a touch operation in response to the touch operation acting on the virtual control, and obtain current state information of the virtual object in the game scene, where the current state information includes: current direction of movement and current speed.
A second determining module 704, configured to determine an angle between the operation direction and the current moving direction of the virtual object.
The control module 706 is configured to determine a movement mode of the virtual object in the game scene according to the included angle, and control the virtual object to move in the movement mode according to the current state information.
As an alternative embodiment, the control module includes: the first determining submodule is used for determining that the moving mode is a forward mode if the included angle is smaller than a first preset angle; the second determining submodule is used for determining that the moving mode is a reversing mode if the included angle is larger than or equal to a second preset angle; and the third determining sub-module is used for determining that the mode is a turning mode if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle.
As an alternative embodiment, the movement mode is a forward mode, and the control module includes: the first control sub-module is used for controlling the virtual object to move in an accelerating way according to the first acceleration if the current speed of the virtual object is smaller than the preset maximum speed in the process of operating the virtual control, and controlling the virtual object to keep moving at the maximum speed if the current speed of the virtual object reaches the maximum speed; and the second control sub-module is used for controlling the virtual object to move in a decelerating manner according to the second acceleration under the condition that the operation of the virtual control is stopped.
As an alternative embodiment, the movement mode is a reverse mode, and the control module includes: the third control sub-module is used for decelerating to zero according to a third acceleration on the basis of the current speed; and the fourth control sub-module is used for controlling the virtual object to move in the opposite direction of the current moving direction according to the preset speed.
As an optional embodiment, the virtual object is in a first virtual scene, where the virtual object in the first virtual scene includes a virtual character and a virtual vehicle, the virtual vehicle is a horse, the movement mode is a turning mode, and the control module includes: a fourth determining submodule, configured to determine a centripetal speed of the virtual object when the virtual object turns according to a steering angular speed and a steering radius preset by the virtual object, where the steering radius is determined according to an operation direction of the touch operation; and the fifth control sub-module is used for superposing the current moving speed and the centripetal speed of the virtual object to obtain the moving speed of the virtual object when the virtual object turns.
As an alternative embodiment, the virtual object is in a second virtual scene, the virtual object in the second virtual scene moves on the ice surface, and the control module includes: the sixth control submodule is used for controlling the virtual object to be decelerated according to the fourth acceleration from the current speed to obtain the first speed; the acquisition sub-module is used for acquiring a control speed generated by operating the virtual control, accelerating according to a fifth acceleration on the basis of the control speed, and acquiring a second speed, wherein the direction of the control speed is the same as the operation direction; and the seventh control submodule is used for superposing the first speed and the second speed to obtain the moving speed of the virtual object when the virtual object turns.
One embodiment
According to an embodiment of the present invention, there is provided a storage medium including a stored program, wherein the device in which the storage medium is controlled to execute the control method of the virtual object of embodiment 1 or embodiment 2 when the program runs.
One embodiment
According to an embodiment of the present invention, there is provided a processor for running a program, wherein the program runs to execute the control method of the virtual object of embodiment 1 or embodiment 2.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology content may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, for example, may be a logic function division, and may be implemented in another manner, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (15)

1. A method for controlling a virtual object, comprising:
responding to touch operation acted on a virtual control, determining an operation direction of the touch operation, and acquiring current state information of the virtual object in a game scene, wherein the current state information comprises: current direction of movement and current speed;
determining an included angle between the operation direction and the current moving direction;
determining target state information of the virtual object according to the included angle and the current state information, wherein the target state information comprises: a target moving direction and a target speed;
controlling the virtual object to move according to the target state information;
wherein the determining the target state information of the virtual object according to the included angle and the current state information includes: determining the target moving direction according to the included angle and the current moving direction; and determining the target speed according to the current speed;
Responding to the virtual object in a first virtual scene, wherein the virtual object in the first virtual scene comprises a virtual character and a virtual carrier, the virtual carrier is a horse, and the determining the target moving direction according to the included angle and the current moving direction comprises the following steps: if the included angle is larger than or equal to a first preset angle and smaller than a second preset angle, determining that the target moving direction of the virtual object is adjusted from the current moving direction to the operation direction in the turning movement process of the virtual object;
responding to the virtual object moving on the ice surface in a second virtual scene, wherein the determining the target moving direction according to the included angle and the current moving direction comprises the following steps: and if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, determining that the target moving direction is the same as the target speed direction.
2. The method of claim 1, wherein determining the target movement direction from the included angle and the current movement direction comprises:
if the included angle is smaller than the first preset angle, determining that the target moving direction is the same as the current moving direction;
If the included angle is larger than or equal to the second preset angle, determining that the target moving direction is opposite to the current moving direction, wherein the second preset angle is larger than the first preset angle;
and if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, determining that the target moving direction deviates from the current moving direction.
3. The method of claim 1, wherein determining the target speed from the current speed if the included angle is greater than or equal to the first preset angle and less than the second preset angle comprises:
determining the centripetal speed of the virtual object when turning according to the preset steering angular speed and the preset steering radius of the virtual object, wherein the steering radius is determined according to the operation direction of the touch operation;
and superposing the current speed of the virtual object and the centripetal speed to obtain the target speed.
4. The method of claim 1, wherein the virtual object in the second virtual scene determining the target speed from the current speed comprises:
if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, controlling the virtual object to be decelerated from the current speed according to fourth acceleration, and obtaining a first speed;
Acquiring a control speed generated by operating the virtual control, and accelerating according to a fifth acceleration on the basis of the control speed to obtain a second speed, wherein the direction of the control speed is the same as the operation direction;
and superposing the first speed and the second speed to obtain the target speed.
5. The method of claim 1, wherein determining the target speed from the current speed if the included angle is less than the first preset angle comprises:
in the process of operating the virtual control, if the current speed is smaller than a preset maximum speed, accelerating according to a first acceleration on the basis of the current speed to obtain the target speed, and if the current speed of the virtual object reaches the maximum speed, determining the maximum speed as the target speed;
and under the condition that the operation of the virtual control is stopped, decelerating according to a second acceleration on the basis of the current speed to obtain the target speed.
6. The method of claim 5, wherein determining the target speed from the current speed if the included angle is greater than or equal to the second preset angle comprises:
Decelerating to zero according to a third acceleration on the basis of the current speed;
and determining a preset speed opposite to the current moving direction as the target speed.
7. A method for controlling a virtual object, comprising:
responding to touch operation acted on a virtual control, determining an operation direction of the touch operation, and acquiring current state information of the virtual object in a game scene, wherein the current state information comprises: current direction of movement and current speed;
determining an included angle between the operation direction and the current moving direction of the virtual object;
determining a moving mode of the virtual object in the game scene according to the included angle, and controlling the virtual object to move in the moving mode according to the current state information;
wherein controlling the virtual object to move in the movement mode according to the current state information includes: controlling the virtual object to move in the moving mode according to target state information determined by the included angle and the current state information, wherein the target state information comprises: the target moving direction and the target speed are determined by the following steps: determining the target moving direction according to the included angle and the current moving direction; and determining the target speed according to the current speed;
Responding to the virtual object in a first virtual scene, wherein the virtual object in the first virtual scene comprises a virtual character and a virtual carrier, the virtual carrier is a horse, and the determining the target moving direction according to the included angle and the current moving direction comprises the following steps: if the included angle is larger than or equal to a first preset angle and smaller than a second preset angle, determining that the target moving direction of the virtual object is adjusted from the current moving direction to the operation direction in the turning movement process of the virtual object;
responding to the virtual object moving on the ice surface in a second virtual scene, wherein the determining the target moving direction according to the included angle and the current moving direction comprises the following steps: and if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, determining that the target moving direction is the same as the target speed direction.
8. The method of claim 7, wherein determining a movement pattern of the virtual object within the game scene based on the included angle comprises:
if the included angle is smaller than the first preset angle, determining that the moving mode is a forward mode;
If the included angle is larger than or equal to the second preset angle, determining that the moving mode is a reversing mode;
and if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, determining that the mode is a turning mode.
9. The method of claim 8, wherein the movement mode is a forward mode, wherein controlling the virtual object to move in the movement mode according to the current state information comprises:
in the process of operating the virtual control, if the current speed of the virtual object is smaller than a preset maximum speed, controlling the virtual object to move in an accelerating way according to a first acceleration, and if the current speed of the virtual object reaches the maximum speed, controlling the virtual object to keep moving at the maximum speed;
and under the condition that the operation of the virtual control is stopped, controlling the virtual object to move in a decelerating manner according to the second acceleration.
10. The method of claim 8, wherein the movement mode is a reverse mode, wherein controlling the virtual object to move in the movement mode according to the current state information comprises:
Decelerating to zero according to a third acceleration on the basis of the current speed;
and controlling the virtual object to move in the opposite direction of the current moving direction according to a preset speed.
11. The method of claim 8, wherein the virtual object is in a first virtual scene and the movement pattern is a turning pattern, the controlling the virtual object to move in the movement pattern according to the current state information comprising:
determining the centripetal speed of the virtual object when turning according to the preset steering angular speed and the preset steering radius of the virtual object, wherein the steering radius is determined according to the operation direction of the touch operation;
and superposing the current moving speed of the virtual object and the centripetal speed to obtain the moving speed of the virtual object when the virtual object turns.
12. The method of claim 8, wherein the virtual object is in a second virtual scene and the movement pattern is a turning pattern, the controlling the virtual object to move in the movement pattern according to the current state information comprising:
controlling the virtual object to be decelerated according to fourth acceleration from the current speed to obtain first speed;
Acquiring a control speed generated by operating the virtual control, and accelerating according to a fifth acceleration on the basis of the control speed to obtain a second speed, wherein the direction of the control speed is the same as the operation direction;
and superposing the first speed and the second speed to obtain the moving speed of the virtual object when turning.
13. A control apparatus for a virtual object, comprising:
the first determining module is used for responding to touch operation acted on the virtual control, determining an operation direction of the touch operation and obtaining current state information of the virtual object in a game scene, wherein the current state information comprises: current direction of movement and current speed;
the second determining module is used for determining an included angle between the operation direction and the current moving direction;
the acquisition module is used for determining target state information of the virtual object according to the included angle and the current state information, wherein the target state information comprises: a target moving direction and a target speed;
the control module is used for controlling the virtual object to move according to the target state information;
the acquisition module is also used for determining the target moving direction according to the included angle and the current moving direction; and determining the target speed according to the current speed;
In response to the virtual object being in a first virtual scene, the virtual object in the first virtual scene includes a virtual character and a virtual vehicle, wherein the virtual vehicle is a horse, and the obtaining module is further configured to determine the target moving direction according to the included angle and the current moving direction by: if the included angle is larger than or equal to a first preset angle and smaller than a second preset angle, determining that the target moving direction of the virtual object is adjusted from the current moving direction to the operation direction in the turning movement process of the virtual object;
in response to the virtual object moving on the ice surface in a second virtual scene, the acquisition module is further configured to determine the target movement direction according to the included angle and the current movement direction by: and if the included angle is larger than or equal to the first preset angle and smaller than the second preset angle, determining that the target moving direction is the same as the target speed direction.
14. A storage medium comprising a stored program, wherein the program, when run, controls a device in which the storage medium is located to perform the method of controlling a virtual object according to any one of claims 1 to 12.
15. A processor, characterized in that the processor is configured to run a program, wherein the program runs to execute the control method of a virtual object according to any one of claims 1 to 12.
CN201911421337.9A 2019-12-31 2019-12-31 Virtual object control method and device Active CN111151003B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911421337.9A CN111151003B (en) 2019-12-31 2019-12-31 Virtual object control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911421337.9A CN111151003B (en) 2019-12-31 2019-12-31 Virtual object control method and device

Publications (2)

Publication Number Publication Date
CN111151003A CN111151003A (en) 2020-05-15
CN111151003B true CN111151003B (en) 2023-04-25

Family

ID=70560664

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911421337.9A Active CN111151003B (en) 2019-12-31 2019-12-31 Virtual object control method and device

Country Status (1)

Country Link
CN (1) CN111151003B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112148622B (en) * 2020-10-15 2022-02-25 腾讯科技(深圳)有限公司 Control method and device of virtual prop, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108654085A (en) * 2018-05-18 2018-10-16 网易(杭州)网络有限公司 Game virtual object control method and device, electronic equipment, storage medium
CN110064193A (en) * 2019-04-29 2019-07-30 网易(杭州)网络有限公司 Manipulation control method, device and the mobile terminal of virtual objects in game
CN110548286A (en) * 2019-09-29 2019-12-10 网易(杭州)网络有限公司 Method and device for locking virtual object in game and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108654085A (en) * 2018-05-18 2018-10-16 网易(杭州)网络有限公司 Game virtual object control method and device, electronic equipment, storage medium
CN110064193A (en) * 2019-04-29 2019-07-30 网易(杭州)网络有限公司 Manipulation control method, device and the mobile terminal of virtual objects in game
CN110548286A (en) * 2019-09-29 2019-12-10 网易(杭州)网络有限公司 Method and device for locking virtual object in game and electronic equipment

Also Published As

Publication number Publication date
CN111151003A (en) 2020-05-15

Similar Documents

Publication Publication Date Title
US10290153B2 (en) Dynamic haptic retargeting
KR102120240B1 (en) Method and apparatus for determining spatial position of control object
CN106780674B (en) Lens moving method and device
CN107198884B (en) Method for efficiently loading game scenes
CN111151003B (en) Virtual object control method and device
CN113820144A (en) Test method, device, system and equipment for automatically driving vehicle
JP2014130589A (en) Methods and systems for generation and execution of mini- application of computer application served by cloud computing system
CN108434733B (en) Speed control method and device for game object
CN111494963A (en) Vehicle-mounted game method, system, device, computer equipment and storage medium
CN111773720A (en) Virtual object control method and device, storage medium and electronic device
CN113996060A (en) Display picture adjusting method and device, storage medium and electronic equipment
CN112190930B (en) Game role control method and device
CN108837504A (en) Information processing method, device, equipment and storage medium in race games
CN113521742A (en) Virtual object moving method, device and storage medium
CN111389004A (en) Control method of virtual role, storage medium and processor
CN108837508B (en) Method and device for controlling carrier in game
CN108553893A (en) The control method and device of Vehicular turn in car race game
CN104881230A (en) Method and equipment for performing man-machine interaction on touch control terminal
CN115591226B (en) Service processing method, device, equipment and medium
CN110930488B (en) Fish behavior simulation method, device, equipment and storage medium
KR20230085934A (en) Picture display method and apparatus, device, storage medium, and program product in a virtual scene
CN108693990A (en) A kind of terminal touch screen exchange method and device
CN108351717B (en) Method, device and terminal for selecting interface elements
CN116483096B (en) Vehicle formation control method, system, cloud platform and storage medium
CN108635838A (en) Direction-controlling method and device, storage medium, processor and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant