Virtual object switching method and device, storage medium, and electronic device
By determining the target area or ray based on the operation direction of the functional controls and the position information of the virtual objects in mobile games, the randomness problem of virtual object switching is solved, and the switching accuracy and gaming experience are improved.
Patent Information
- Application Number
- CN202210681910.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-15
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-06-15
AI Technical Summary
In the prior art, the virtual object switching process in mobile games is random, resulting in the locked hostile virtual object being different from the game player's expectations, reducing the accuracy of the switched hostile virtual object and thus reducing the game player's gaming experience.
By responding to the control operation on the function control, the operation direction is determined, and based on the position information of the currently locked virtual object, a target area or ray is established to determine the second virtual object to ensure the accuracy of the switching process.
The accuracy of virtual object switching is improved, switching to virtual objects outside the field of view is avoided, and the gaming experience of gamers is enhanced.
Smart Images

Figure CN114949842B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method and device for switching virtual objects, a computer-readable storage medium, and an electronic device. Background Art
[0002] With the popularity of mobile terminals, more and more mobile games have emerged. In mobile games, game players usually need to lock onto virtual hostile objects in order to attack the hostile virtual objects.
[0003] In the prior art, game players can first touch the lock control to lock a hostile virtual object, and then touch the lock control again to randomly switch to another hostile virtual object that appears in the game interface and lock the hostile virtual object. However, this process of switching hostile virtual objects is random, resulting in the locked hostile virtual object being different from the game player's expectations, and may even switch to a hostile virtual object outside the game player's field of view, thereby reducing the accuracy of the hostile virtual object switched to and reducing the game player's gaming experience.
[0004] In view of this, there is an urgent need in the art to develop a new method and device for switching virtual objects.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the Invention
[0006] The purpose of the present disclosure is to provide a virtual object switching method, a virtual object switching device, a computer-readable storage medium and an electronic device, thereby overcoming, at least to a certain extent, the problem of low accuracy of the switched virtual objects caused by related technologies.
[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by practice of the present disclosure.
[0008] According to a first aspect of an embodiment of the present invention, a method for switching virtual objects is provided, the method comprising: responding to a control operation acting on a function control, determining an operation direction corresponding to the control operation; wherein the function control is located on the graphical user interface; based on first position information of a currently locked first virtual object, determining a second virtual object according to the operation direction, wherein the currently locked first virtual object is a behavior target of the virtual character; and switching the currently locked first virtual object to the second virtual object.
[0009] In an exemplary embodiment of the present invention, the determining of the second virtual object based on the first position information of the currently locked first virtual object according to the operation direction includes: determining the first position information corresponding to the currently locked first virtual object, determining the target area based on the first position information and the operation direction; and determining all area objects in the target area to determine the second virtual object among all the area objects.
[0010] In an exemplary embodiment of the present invention, determining the second virtual object according to the operation direction based on the first position information of the currently locked first virtual object includes: using the first position information as an endpoint to establish a target ray consistent with the operation direction; determining all ray virtual objects on the target ray to determine the second virtual object among all the ray virtual objects.
[0011] In an exemplary embodiment of the present invention, the target area includes a fan-shaped area; determining the target area based on the first position information and the operation direction includes: taking the first position information as the endpoint to establish an area ray consistent with the operation direction; taking the first position information as the center of the circle, constructing the fan-shaped area with a central angle of a preset angle based on the area ray.
[0012] In an exemplary embodiment of the present invention, determining all area objects in the target area to determine a second virtual object among all the area objects includes: if there are area objects in the fan-shaped area, judging the number of the area objects to obtain a number judgment result; if the number judgment result is one, determining one of the area objects as the second virtual object; if the number judgment result is multiple, determining object position information corresponding to multiple area objects, and determining a second virtual object in the area object according to the position distance between the object position information and the first position information.
[0013] In an exemplary embodiment of the present invention, determining all area objects in the target area to determine the second virtual object among all the area objects includes: if there is no area object in the fan-shaped area, expanding the preset angle to update the fan-shaped area; judging whether there is the area object in the updated fan-shaped area to obtain an object judgment result; and determining the second virtual object in the fan-shaped area based on the judgment result.
[0014] In an exemplary embodiment of the present invention, if there is no area object in the fan-shaped area, the preset angle is expanded to update the fan-shaped area, including: increasing the preset angle according to a preset angle increment parameter to update the fan-shaped area.
[0015] In an exemplary embodiment of the present invention, the method further includes: if the incremented preset angle satisfies a preset angle condition, and the area object does not exist in the fan-shaped area corresponding to the incremented preset angle, changing the direction of the area ray from being consistent with the operation direction to being opposite to the operation direction to update the area ray.
[0016] In an exemplary embodiment of the present invention, the method further includes: obtaining the position direction of the currently locked virtual object relative to the virtual character, and determining the current attack direction corresponding to the virtual character; wherein the currently locked virtual object is the first virtual object or the second virtual object; based on the position direction, adjusting the current attack direction so that the adjusted current attack direction corresponds to the currently locked virtual object.
[0017] In an exemplary embodiment of the present invention, the method further includes: obtaining a shooting angle of a virtual camera corresponding to the virtual scene; in response to a movement operation acting on the currently locked virtual object, obtaining a movement direction corresponding to the movement operation; and adjusting the shooting angle according to the movement direction.
[0018] In an exemplary embodiment of the present invention, the method further includes: displaying a locking mark at a preset position corresponding to the currently locked virtual object.
[0019] In an exemplary embodiment of the present invention, before responding to a control operation on a functional control and determining an operation direction corresponding to the control operation, the method further includes: responding to a first touch operation on the functional control, determining screen position information corresponding to a graphical user interface; determining object position information of a hostile virtual object displayed in the graphical user interface, and calculating the object position information and the screen position information respectively to obtain a position calculation result; wherein, the hostile virtual object corresponds to a hostile virtual character; the hostile virtual character is a behavioral target of the virtual character; and according to the position calculation result, determining a first virtual object among the hostile virtual objects, and determining the first virtual object as the currently locked virtual object.
[0020] In an exemplary embodiment of the present invention, the screen position information includes position information corresponding to the center of the graphical user interface, crosshair position information, and character position information corresponding to the virtual character.
[0021] In an exemplary embodiment of the present invention, after determining the first virtual object as the currently locked virtual object, the method further includes: determining a target hostile virtual object displayed in the graphical user interface in response to the second touch operation acting on the function control; wherein the target hostile virtual object does not include the first virtual object; using one of the target hostile virtual objects as the second virtual object, and switching the currently locked first virtual object to the second virtual object.
[0022] In an exemplary embodiment of the present invention, the method further includes: in response to a third touch operation acting on the function control, cancelling the lock on the currently locked virtual object.
[0023] According to a second aspect of an embodiment of the present invention, a device for switching virtual objects is provided, the device comprising: a response module, configured to respond to a control operation acting on a functional control and determine an operation direction corresponding to the control operation; wherein the functional control is located on the graphical user interface; a determination module, configured to determine a second virtual object according to the operation direction based on first position information of a currently locked first virtual object, wherein the currently locked first virtual object is a behavior target of the virtual character; and a switching module, configured to switch the currently locked first virtual object to the second virtual object.
[0024] According to a third aspect of an embodiment of the present invention, there is provided an electronic device comprising: a processor and a memory; wherein the memory stores computer-readable instructions, which, when executed by the processor, implement the method for switching virtual objects of any of the above exemplary embodiments.
[0025] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for switching virtual objects in any of the above exemplary embodiments is implemented.
[0026] As can be seen from the above technical solutions, the virtual object switching method, virtual object switching device, computer storage medium, and electronic device in the exemplary embodiments of the present invention have at least the following advantages and positive effects:
[0027] In the method and apparatus provided by the exemplary embodiments of the present disclosure, on the one hand, based on the first position information of the currently locked first virtual object, the second virtual object is determined according to the operation direction, thereby avoiding the situation in the prior art where a virtual object is randomly locked, and avoiding the situation where the randomly locked virtual object is not the locked object expected by the user, thereby improving the user experience; on the other hand, the second virtual object is determined based on the first position information and the operation direction. Based on this, the second virtual object is related to the operation direction and the first position information, thereby improving the accuracy of the determined second virtual object, and avoiding the situation in the prior art where a virtual object may be switched to a virtual object outside the field of view of the virtual object.
[0028] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0030] Figure 1 A schematic diagram schematically illustrates a flow chart of a method for switching virtual objects in an embodiment of the present disclosure;
[0031] Figure 2 A schematic diagram schematically illustrates a graphical user interface in a method for switching virtual objects in an embodiment of the present disclosure;
[0032] Figure 3 A schematic diagram of a process for determining a first virtual object in a method for switching virtual objects in an embodiment of the present disclosure is shown;
[0033] Figure 4 A schematic diagram of a game interface in a method for switching virtual objects in an embodiment of the present disclosure is schematically shown;
[0034] Figure 5 A schematic diagram schematically illustrates a flow chart after determining the first virtual object as the currently locked virtual object in the method for switching virtual objects in an embodiment of the present disclosure;
[0035] Figure 6 Schematically illustrating a graphical user interface diagram in a method for switching virtual objects in an embodiment of the present disclosure;
[0036] Figure 7 A schematic diagram illustrating a process of determining a second virtual object in a method for switching virtual objects in an embodiment of the present disclosure is shown;
[0037] Figure 8 A schematic diagram illustrating a process of determining a second virtual object in a method for switching virtual objects in an embodiment of the present disclosure is shown;
[0038] Figure 9 Schematically illustrating a graphical user interface diagram in a method for switching virtual objects in an embodiment of the present disclosure;
[0039] Figure 10 A schematic diagram illustrating a process of determining a target area in a method for switching a virtual object in an embodiment of the present disclosure is shown;
[0040] Figure 11 A schematic diagram schematically illustrating area rays in a method for switching virtual objects in an embodiment of the present disclosure;
[0041] Figure 12 A schematic diagram schematically illustrating a target area in a method for switching a virtual object in an embodiment of the present disclosure;
[0042] Figure 13 A schematic diagram illustrating a process of determining a second virtual object in a method for switching virtual objects in an embodiment of the present disclosure is shown;
[0043] Figure 14 A schematic diagram illustrating a process of determining a second virtual object in a method for switching virtual objects in an embodiment of the present disclosure is shown;
[0044] Figure 15 A schematic diagram schematically illustrating a sector-shaped area in a method for switching virtual objects in an embodiment of the present disclosure;
[0045] Figure 16 A schematic diagram schematically illustrating an updated sector-shaped area in a method for switching virtual objects in an embodiment of the present disclosure;
[0046] Figure 17 Schematically illustrating a fan-shaped area diagram in a method for switching virtual objects in an embodiment of the present disclosure;
[0047] Figure 18 A schematic diagram illustrating a process of adjusting the attack direction in the method for switching virtual objects in an embodiment of the present disclosure is shown;
[0048] Figure 19 A schematic diagram schematically illustrates a process of adjusting a camera angle in a method for switching a virtual object in an embodiment of the present disclosure;
[0049] Figure 20 A schematic diagram schematically illustrates the structure of a device for switching virtual objects in an embodiment of the present disclosure;
[0050] Figure 21Schematically illustrating an electronic device for a method for switching virtual objects in an embodiment of the present disclosure;
[0051] Figure 22 A computer-readable storage medium for a method for switching virtual objects in an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0052] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the present disclosure will be more comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or that other methods, components, devices, steps, etc. may be employed. In other cases, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0053] The terms "a", "an", "the" and "said" are used in this specification to indicate the presence of one or more elements / components / etc.; the terms "including" and "having" are used to express open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first" and "second" etc. are used only as labels and are not intended to limit the quantity of their objects.
[0054] In addition, the accompanying drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. Identical reference numerals in the drawings represent identical or similar parts, and thus repeated descriptions thereof will be omitted. Some of the blocks shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically separate entities.
[0055] The virtual object switching method in one embodiment of the present disclosure can be run on a local terminal device or a server. When the information processing method is run on the server, the information processing method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0056] In an optional embodiment, various cloud applications can be run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a gaming method based on cloud computing. In the cloud game operation mode, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the virtual object switching method are completed on the cloud game server. The role of the client device is to receive and send data and present the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, TV, computer, PDA, etc.; but the cloud game server in the cloud is responsible for information processing. When playing the game, the player operates the client device to send operation instructions to the cloud game server. The cloud game server runs the game according to the operation instructions, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0057] In an optional embodiment, taking a game as an example, a local terminal device stores a game program and is used to present the game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, conventionally downloading and installing the game program through an electronic device and running it. The local terminal device can provide the graphical user interface to the player in a variety of ways, for example, it can be rendered and displayed on the terminal's display screen, or provided to the player through holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present the graphical user interface, the graphical user interface includes the game screen, and the processor is used to run the game, generate the graphical user interface, and control the display of the graphical user interface on the display screen.
[0058] In response to the problems existing in the related art, the present disclosure proposes a method for switching virtual objects. Figure 1 A flow chart of a method for switching virtual objects is shown in FIG. Figure 1 As shown, the method for switching virtual objects includes at least the following steps:
[0059] Step S110 . In response to a control operation applied to a functional control, determine an operation direction corresponding to the control operation; wherein the functional control is located on a graphical user interface.
[0060] Step S120: Based on the first position information of the currently locked first virtual object, determine the second virtual object according to the operation direction, wherein the currently locked first virtual object is the behavior target of the virtual character.
[0061] Step S130: Switch the currently locked first virtual object to a second virtual object.
[0062] In the method and apparatus provided by the exemplary embodiments of the present disclosure, on the one hand, based on the first position information of the currently locked first virtual object, the second virtual object is determined according to the operation direction, thereby avoiding the situation in the prior art where a virtual object is randomly locked, and avoiding the situation where the randomly locked virtual object is not the locked object expected by the user, thereby improving the user experience; on the other hand, the second virtual object is determined based on the first position information and the operation direction. Based on this, the second virtual object is related to the operation direction and the first position information, thereby improving the accuracy of the determined second virtual object, and avoiding the situation in the prior art where a virtual object may be switched to a virtual object outside the field of view of the virtual object.
[0063] The following describes in detail the steps of the virtual object switching method.
[0064] In step S110 , in response to a control operation applied to a functional control, an operation direction corresponding to the control operation is determined; wherein the functional control is located on a graphical user interface.
[0065] In the exemplary embodiments of the present disclosure, a function control refers to a control displayed in a graphical user interface provided by a terminal device. The terminal device can be the local terminal device mentioned above, or it can be a client device in the cloud interaction system mentioned above.
[0066] Specifically, the function control can be used to lock a certain hostile virtual object in the virtual scene, and can also be used to switch from one hostile virtual object to another hostile virtual object.
[0067] The control operation refers to an operation with an operation direction acting on a function control. Specifically, the control operation can be a sliding operation acting on a function control, or any operation with an operation direction. This exemplary embodiment does not specifically limit this.
[0068] When acting as a control operation on a functional control, it means that the currently locked virtual object needs to be switched from the first virtual object to the second virtual object.
[0069] For example, Figure 2 A schematic diagram of a graphical user interface is shown schematically. Figure 2 As shown, interface 210 is a graphical user interface, control 220 is a functional control, object 230 is a virtual object corresponding to a virtual character, and object 240 is a behavioral target of the virtual object, that is, a hostile virtual object. For example, in a shooting game, the virtual object is a virtual object corresponding to the user, and object 240 can be a hostile virtual object shot by the virtual object.
[0070] Based on this, when the user acts on the control 220 to control the operation, the operation direction corresponding to the sliding operation is determined as follows: Figure 2 Indicated by the arrow.
[0071] In an alternative embodiment, Figure 3 FIG. 4 shows a flow chart of determining a first virtual object in a method for switching virtual objects. Figure 3 As shown, the method includes at least the following steps: in step S310, in response to a first touch operation on a functional control, screen position information corresponding to a graphical user interface is determined.
[0072] Among them, the first touch operation refers to an operation acting on the function control for locking the first virtual object, and the first touch operation is different from the control operation, and it does not have an operation direction. Specifically, the first touch operation can be a click operation, a double-click operation, or a long press operation. This exemplary embodiment does not make any special limitations on this.
[0073] The screen position information may be a specific position information in the graphical user interface, for example, the position information of the center position of the graphical user interface, the character position information of the virtual character in the virtual scene, or the crosshair position information. This exemplary embodiment does not make any special limitation on this.
[0074] For example, when the user performs a click operation on the function control, the screen position information corresponding to the graphical user interface is determined to be (15, 3).
[0075] In step S320, the object position information of the hostile virtual object displayed in the graphical user interface is determined, and the object position information and the screen position information are calculated respectively to obtain a position calculation result.
[0076] The hostile virtual object corresponds to the hostile virtual character, and the hostile virtual character is the behavioral target of the virtual character.
[0077] The hostile virtual object refers to the target of the virtual object's behavior. Correspondingly, the object position information is the interface coordinates of the hostile virtual object displayed on the graphical user interface. After obtaining the object position information and screen position information, calculations are performed on the object position information and screen position information to determine the first virtual object closest to the screen position information.
[0078] For example, Figure 4 The schematic diagram of the game interface is shown schematically. Figure 4As shown, when the user clicks the function control 220, it is determined that the hostile virtual objects displayed in the graphical user interface include two hostile virtual objects 240 and one hostile virtual object 410, and then, it is determined that the object position information corresponding to the hostile virtual object 410 is (12, 20), the object position information corresponding to one of the hostile virtual objects 240 is (17, 40), and the object position information corresponding to the other hostile virtual object 240 is (10, 37).
[0079] Based on this, the object position information (12, 20) and the screen position information (15, 3) are calculated to obtain the position calculation result, the object position information (12, 20) and the screen position information (15, 3) are also calculated to obtain the position calculation result, and the object position information (10, 37) and the screen position information (15, 3) are also calculated to obtain the position calculation result.
[0080] In step S330 , based on the position calculation result, a first virtual object is determined among the hostile virtual objects, and the first virtual object is determined as the currently locked virtual object.
[0081] Among them, based on the position calculation result, the first virtual object is determined among the hostile virtual objects. It is worth noting that the determined first virtual object is closest to the screen position information, and after the first virtual object is determined, the first virtual object is determined as the currently locked virtual object. Then, when the function control is subsequently controlled, the currently locked virtual object can be switched from the first virtual object to the second virtual object.
[0082] For example, if Figure 4 As shown, the hostile virtual object 410 is the first virtual object.
[0083] In this exemplary embodiment, before performing a control operation on the functional control, it is necessary to first determine the first virtual object, which lays the foundation for subsequently switching the currently locked virtual object from the first virtual object to the second virtual object.
[0084] In an optional embodiment, the screen position information includes position information corresponding to the center of the graphical user interface, crosshair position information, and character position information corresponding to the virtual character.
[0085] The crosshair position information refers to the position information of the weapon used to launch the attack on the hostile virtual object. The character position information refers to the position information of the virtual character in the virtual scene.
[0086] For example, the screen position information may be position information (100, 100) corresponding to the center of the graphical user interface, the screen position information may be crosshair position information (50, 75), or the screen position information may be character position information (15, 37) of a virtual character.
[0087] In this exemplary embodiment, the screen position information includes position information corresponding to the center of the graphical user interface, crosshair position information, and character position information corresponding to the virtual character, which increases the flexibility of determining the first virtual object based on the screen position information.
[0088] In an alternative embodiment, Figure 5 FIG. 4 shows a flow chart of the virtual object switching method after determining the first virtual object as the currently locked virtual object. Figure 5 As shown, the method includes at least the following steps: in step S510, in response to a second touch operation acting on the function control, determining a target hostile virtual object displayed in the graphical user interface; wherein the target hostile virtual object does not include the first virtual object.
[0089] Among them, after the first virtual object is determined as the currently locked virtual object, if the user performs a second touch operation on the function control, a second virtual object will be randomly determined to switch the currently locked virtual object from the first virtual object to the second virtual object.
[0090] In the process of randomly determining the second virtual object, it is first necessary to determine the target hostile virtual object displayed in the graphical user interface. It is worth noting that the target hostile virtual object does not include the first virtual object.
[0091] For example, if Figure 4 As shown, at this time, the first virtual object is object 410 . When the user clicks the function control 220 , the number of target hostile virtual objects determined is two. Specifically, the target hostile virtual object is object 240 .
[0092] In step S520, one of the target hostile virtual objects is used as the second virtual object, and the currently locked first virtual object is switched to the second virtual object.
[0093] Among them, any one of the target hostile virtual objects is selected as the second virtual object, and the currently locked virtual object is switched from the first virtual object to the second virtual object.
[0094] For example, if Figure 4As shown, the number of target hostile virtual objects is two, specifically, the target hostile virtual object is object 240, and then, one of the two target hostile virtual objects can be randomly determined as the second virtual object to switch the currently locked virtual object from the first virtual object to the second virtual object.
[0095] In this exemplary embodiment, after the first virtual object is determined, when the user performs a second touch operation on the function control, one of the target hostile virtual objects is selected as the second virtual object to switch the currently locked first virtual object to a randomly selected second virtual object.
[0096] In step S120 , based on the first position information of the currently locked first virtual object, a second virtual object is determined according to the operation direction; wherein the currently locked first virtual object is the behavior target of the virtual character.
[0097] In an exemplary embodiment of the present disclosure, the first position information refers to the display coordinates of the first virtual object in the graphical user interface. A second virtual object can be determined based on the first position information and the operation direction, so that the currently locked virtual object can be subsequently switched from the first virtual object to the second virtual object.
[0098] For example, Figure 6 A schematic diagram of a graphical user interface is shown schematically. Figure 6 As shown, position 610 is the position of the first virtual object in the graphical user interface, that is, the first position information, position 620 is the display position of the behavior target of the virtual object displayed in the game interface, position 630 is the display position of another behavior target of the virtual object displayed in the game interface, and position 640 is the display position of the virtual object displayed in the graphical user interface. Figure 6 The fan-shaped area shown is a target area determined according to the position 610 and the operation direction. Based on this, the object at the position 630 in the target area is the second virtual object.
[0099] In an alternative embodiment, Figure 7 FIG. 4 shows a flow chart of determining a second virtual object in a method for switching virtual objects. Figure 7 As shown, the method includes at least the following steps: in step S710, first position information corresponding to the currently locked first virtual object is determined, and a target area is determined based on the first position information and the operation direction.
[0100] The target area refers to an area determined based on the first position information and the operation direction. Specifically, the target area can be a fan-shaped area, a rectangular area, or an area of any shape. This exemplary embodiment does not specifically limit this.
[0101] For example, if Figure 6 As shown, position 610 is the first position information, and the arrow is the operation direction. Figure 6 The fan-shaped area formed by the dotted lines is the area determined based on the first position information and the operation direction.
[0102] In step S720 , all area objects in the target area are determined to determine a second virtual object in all area objects.
[0103] The area object refers to the hostile virtual object in the target area.
[0104] For example, if Figure 6 As shown, the fan-shaped area formed by the dotted line is the target area. Obviously, the hostile virtual object at position 630 in the target area is the area object.
[0105] In this exemplary embodiment, based on the first position information and the operation direction, the target area is determined, and the second virtual object is determined among all area objects in the target area, thereby improving the accuracy of the determined second virtual object and avoiding the situation where the second virtual object is not within the field of view of the virtual object.
[0106] In an alternative embodiment, Figure 8 FIG. 4 shows a flow chart of determining a second virtual object in a method for switching virtual objects. Figure 8 As shown, the method includes at least the following steps: in step S810, the first position information is used as an endpoint to establish a target ray consistent with the operation direction.
[0107] In addition to determining the second virtual object in the target area, the second virtual object can also be determined based on a target ray. The target ray refers to a ray established with the first position information as an endpoint and consistent with the operation direction.
[0108] For example, Figure 9 A schematic diagram of a graphical user interface is shown schematically. Figure 9 As shown, the ray 910 is based on the first position information 610 and is related to the operation direction (ie Figure 9 There is a hostile virtual object at position 920 and a hostile virtual object at position 930, according to the target ray (direction of the arrow in the middle).
[0109] In step S820 , all ray virtual objects on the target ray are determined to determine a second virtual object among all ray virtual objects.
[0110] Among them, the position of the ray virtual object overlaps with the target ray.
[0111] For example, if Figure 9 As shown, the hostile virtual object at position 920 and the hostile virtual object at position 930 are all ray virtual objects. Furthermore, the hostile virtual object at position 920 can be determined as the second virtual object.
[0112] In this exemplary embodiment, the second virtual object can also be a ray virtual object on the target ray, and since the target ray takes the first position information as the endpoint and establishes a ray consistent with the operation direction, the accuracy of the determined second virtual object is improved, and the situation where the second virtual object is not within the field of view of the virtual object is avoided.
[0113] In an alternative embodiment, Figure 10 The flowchart of determining the target area in the switching method of the virtual object is shown. The target area includes a sector area, such as Figure 10 As shown, the method includes at least the following steps: in step S1010, the first position information is used as an endpoint to establish a regional ray consistent with the operation direction.
[0114] The target area may be specifically a fan-shaped area. When determining the fan-shaped area, a regional ray is required. The regional ray refers to a ray that takes the first position information as an endpoint and is consistent with the operation direction.
[0115] For example, Figure 11 The schematic diagram of the area ray is shown schematically. It is worth noting that the user will not see the area ray in the terminal. Figure 11 As shown, ray 1110 is the area ray, the endpoint of ray 1110 is at position 610, that is, at the first position information where the first virtual object is displayed in the graphic user interface, and the direction of ray 810 is consistent with the operation direction indicated by the arrow.
[0116] In step S1020, a fan-shaped area with a center angle of a preset angle is constructed based on area rays with the first position information as the center of the circle.
[0117] Among them, the preset angle refers to the angle value of the central angle of a preset fan-shaped area. Based on the preset angle and the area ray, a fan-shaped area can be constructed. The fan-shaped area is the target area. It is worth noting that the area ray divides the fan-shaped area into two parts.
[0118] For example, Figure 12 The target area is schematically shown. It is worth noting that the target area will not be displayed on the user interface. Figure 12As shown, the area 1210 composed of the position 610 represented by the first position information, point A and point B is a fan-shaped area. Obviously, the area ray 1110 divides the fan-shaped area 1210 into two parts.
[0119] In this exemplary embodiment, with the first position information as the center of the circle, a fan-shaped area with a central angle of a preset angle is constructed based on the area ray, wherein the direction of the area ray is consistent with the operation direction, thereby ensuring that the determined target area corresponds to the user's control operation, and thus ensuring the accuracy of the subsequently determined second virtual object, avoiding the situation in the prior art of switching to the second virtual object outside the field of view of the virtual object, and improving the user's gaming experience.
[0120] In an alternative embodiment, Figure 13 FIG. 4 shows a flow chart of determining a second virtual object in a method for switching virtual objects. Figure 13 As shown, the method at least includes the following steps: in step S1310, if there are region objects in the sector region, the number of region objects is judged to obtain a number judgment result.
[0121] The region object refers to a hostile virtual object that may exist in the sector-shaped region. When the region object exists in the sector-shaped region, the number of region objects in the sector-shaped region is determined to obtain a number determination result.
[0122] For example, if Figure 12 As shown, it is obvious that there is a region object in the fan-shaped area 1210, namely the hostile virtual object displayed at position 630.
[0123] In step S1320 , if the number determination result is one, one area object is determined as the second virtual object.
[0124] If the result of the number determination is one, this one area object is determined as the second virtual object.
[0125] For example, if Figure 12 As shown, there is a region object in the fan-shaped region, that is, a virtual object displayed at position 630, and the virtual enemy virtual object displayed at position 630 is determined as the second virtual object.
[0126] In step S1330, if the number determination result is multiple, object position information corresponding to the multiple area objects is determined, and a second virtual object is determined in the area object based on the position distance between the object position information and the first position information.
[0127] If there are multiple area objects in the sector area, object position information corresponding to the multiple area objects is determined, and a second virtual object is determined in the area object according to the position distance between the object position information and the first position information.
[0128] For example, if there are two area objects, namely area object X1 and area object X2, then after determining the object position information (25, 24) corresponding to area object X1, it is also necessary to determine the object position information (40, 35) corresponding to area object X2.
[0129] The position distances between the position information of the plurality of objects and the first position information are calculated respectively, and a region object closest to the first virtual object is selected as the second virtual object according to the position distances.
[0130] For example, the first position information is (22, 20), and then it is necessary to calculate the position distance between the first position information (22, 20) and the object position information (25, 24), and it is also necessary to calculate the position distance between the first position information (22, 20) and the object position information (40, 35). Based on this, it is determined that the area object X1 is the second virtual object.
[0131] In this exemplary embodiment, if the result of the number judgment is one, one area object is determined as the second virtual object; if the result of the number judgment is multiple, one second virtual object is determined among the multiple area objects according to the position distance. On the one hand, the logic of determining the second virtual object is improved; on the other hand, it ensures that the determined second virtual object is in the target area, improves the accuracy of the determined second virtual object, avoids the situation in the prior art where the second virtual object is outside the field of view of the virtual object, and enhances the user's gaming experience.
[0132] In an alternative embodiment, Figure 14 FIG. 4 shows a flow chart of determining a second virtual object in a method for switching virtual objects. Figure 14 As shown, the method includes at least the following steps: in step S1410, if there is no area object in the sector area, the preset angle is expanded to update the sector area.
[0133] If there is no area object in the sector-shaped area, the preset angle is expanded to update the area of the sector-shaped area.
[0134] For example, Figure 15 The schematic diagram of the sector area is shown schematically. It is worth noting that the shape of the sector area is not displayed in the terminal, so it is represented by a dotted line, as shown in FIG. Figure 15As shown, the hostile virtual object 1520 does not exist in the sector area 1510. Therefore, there is no area object in the sector area 1510. At this time, the preset angle needs to be expanded to update the sector area. For example, the preset angle of the sector area can be expanded to twice the original angle.
[0135] Figure 16 The schematic diagram of the updated sector area is shown schematically. It is worth noting that the shape of the sector area is not displayed in the terminal, so it is represented by a dotted line, as shown in FIG. Figure 16 As shown, area 1610 is the updated sector-shaped area.
[0136] In step S1420, it is determined whether there is a region object in the updated sector-shaped region to obtain an object determination result.
[0137] Wherein, whether there is a region object in the updated sector-shaped region is judged to obtain an object judgment result.
[0138] For example, if Figure 16 , it is determined whether there is an area object in the updated sector area 1610 to obtain a determination result.
[0139] In step S1430 , according to the judgment result, the second virtual object in the sector-shaped area is determined.
[0140] According to the judgment result, a second virtual object is determined in the updated sector-shaped area.
[0141] For example, if Figure 16 As shown, it is obvious that the judgment result is that the area object 1520 exists in the updated sector area 1610, and the area object 1520 is determined as the second virtual object.
[0142] In this exemplary embodiment, if the sector-shaped area does not include the area object, the preset angle is expanded to improve the logic of determining the second virtual object and ensure that the second virtual object can be determined.
[0143] In an optional embodiment, if the area object does not exist in the sector-shaped area, the preset angle is expanded to update the sector-shaped area, including: increasing the preset angle according to a preset angle increment parameter to update the sector-shaped area.
[0144] If no area object exists within the sector-shaped area, the preset angle needs to be expanded. Furthermore, the preset angle is expanded incrementally according to a preset angle increment parameter. The preset angle increment parameter can be a specific incremental value or a parameter in a formula for calculating the incremental angle, and this exemplary embodiment does not specifically limit this.
[0145] For example, if the preset angle increment parameter is 30 degrees, the preset angle is increased by 30 degrees. Specifically, if the initial angle of the fan-shaped area is 35 degrees, if there is no area object in the target area, the angle of the fan-shaped area is expanded to 65 degrees. If there is still no area object in the expanded fan-shaped area, the angle of the fan-shaped area is expanded to 95 degrees, and so on, until there is a area object in the fan-shaped area.
[0146] In this exemplary embodiment, if there is no area object in the sector area, the preset angle is incremented according to the preset angle increment parameter to ensure that the second virtual object can be determined, thereby avoiding the logic of being unable to determine the second virtual object.
[0147] In an optional embodiment, the method also includes: if the enlarged preset angle meets the preset angle condition, and there is no area object in the fan-shaped area corresponding to the enlarged preset angle, then the direction of the area ray is changed from consistent with the operation direction to opposite to the operation direction to update the area ray.
[0148] The preset angle condition refers to a condition that the expanded preset angle may meet. When the expanded preset angle meets the preset angle condition, it means that there is no area object in the field of view consistent with the sliding direction. Therefore, the direction of the area ray is changed to the direction opposite to the sliding direction to update the area ray. Based on the updated area ray, a new sector area is created to determine the second virtual object within the sector area.
[0149] Specifically, the preset angle condition may be a condition that the enlarged preset angle is greater than a certain angle value, which is not particularly limited in this exemplary embodiment.
[0150] If there is no area object in the newly created sector-shaped area, the preset angle may be incremented according to the preset angle increment parameter until the second virtual object is determined.
[0151] For example, Figure 17 The schematic diagram of the sector area is shown schematically. It is worth noting that the shape of the sector area is not displayed in the terminal, so it is represented by a dotted line, such as Figure 17 , the preset angle of the fan-shaped area of area 1710 is greater than the angle threshold 180°, and there is still no area object in area 1710, then the direction of the area ray is changed to a direction opposite to the operation direction.
[0152] In an optional embodiment, if the enlarged preset angle is greater than the angle threshold and there is no area object in the fan-shaped area corresponding to the enlarged preset angle, the direction of the area ray is changed to a direction opposite to the operation direction to ensure that when there is no area object in the field of view corresponding to the virtual object, the second virtual object can also be determined subsequently, thereby improving the logic for determining the second virtual object.
[0153] In step S130 , the currently locked first virtual object is switched to a second virtual object.
[0154] In an exemplary embodiment of the present disclosure, a second virtual object in the target area is determined, and the first virtual object is switched to the second virtual object, that is, the currently locked virtual object is no longer the first virtual object, but the second virtual object.
[0155] Furthermore, after the currently locked virtual object is locked, if the user performs a game perspective conversion operation, the game perspective conversion operation may not be responded to to ensure that the locked virtual object is always in a position that the user can directly attack; or the game perspective conversion operation may be responded to, and when the game perspective conversion operation ends, the shooting angle of the virtual camera is restored to the state before the game character conversion operation to ensure that the locked virtual object is always in a position that the user can directly attack.
[0156] For example, if Figure 16 As shown, the second virtual object in the target area 1610 is determined to be the virtual object X3 displayed at the position 1520. Based on this, the virtual object X3 is determined to be the second virtual object. At this time, the currently locked virtual object is switched from the first virtual object to the second virtual object.
[0157] In an alternative embodiment, Figure 18 A flow chart of adjusting the attack direction in the virtual object switching method is shown. Figure 18 As shown, the method includes at least the following steps: in step S1810, obtaining the position direction of the currently locked virtual object relative to the virtual character, and determining the current attack direction corresponding to the virtual character; wherein the currently locked virtual object is the first virtual object or the second virtual object.
[0158] The position direction refers to the direction of the position of the currently locked virtual object relative to the position of the virtual character.
[0159] For example, if the currently locked hostile virtual object is the first virtual object, the position direction is the direction of the first virtual object relative to the virtual character; if the currently locked hostile virtual object is the second virtual object, the position direction is the direction of the second virtual object relative to the virtual character.
[0160] In step S1820, the current attack direction is adjusted based on the position direction so that the adjusted current attack direction corresponds to the currently locked virtual object.
[0161] The current attack direction is the direction in which the virtual character is currently attacking the hostile virtual character. Adjusting the current attack direction according to the position direction can ensure that the virtual character's attack target is the currently locked virtual object.
[0162] For example, the position direction is due south, and the current attack direction is south-west. Based on this, the current attack direction is adjusted to due south.
[0163] In this exemplary embodiment, the current attack direction is adjusted based on the position direction, ensuring that the attack target of the current virtual character is the currently locked virtual object, providing convenience for the virtual character to attack and optimizing the gaming experience.
[0164] In an alternative embodiment, Figure 19 FIG. 4 shows a flow chart of adjusting the camera angle in the method for switching virtual objects. Figure 19 As shown, the method includes at least the following steps: in step S1910, obtaining the shooting angle of the virtual camera corresponding to the virtual scene.
[0165] The virtual camera refers to a camera corresponding to a virtual scene and determining the virtual scene displayed on a graphical user interface.
[0166] For example, it is determined that the shooting angle of the virtual camera corresponding to the virtual scene at this time is 0. Here, 0 corresponds to the true north direction of the virtual scene.
[0167] In step S1920 , in response to a movement operation applied to the currently locked virtual object, a movement direction corresponding to the movement operation is acquired.
[0168] Among them, the moving operation refers to an operation that can control the movement of the currently locked virtual object. Specifically, the moving operation can be directly applied to the currently locked virtual object, or it can be applied to the moving control corresponding to the currently locked virtual object. This exemplary embodiment does not specifically limit this.
[0169] For example, a movement operation is performed on the second virtual object, and it is determined that the movement direction corresponding to the movement operation is north-east.
[0170] In step S1930, the shooting angle is adjusted according to the moving direction.
[0171] The shooting angle of the virtual camera is adjusted according to the moving direction.
[0172] For example, since the moving direction is north-east, the shooting angle is 0, and therefore, the shooting angle is adjusted from 0 to 315 according to the moving direction, so that the shooting angle of the virtual camera is consistent with the moving direction.
[0173] In this exemplary embodiment, the shooting angle is adjusted according to the moving direction to ensure that the shooting angle of the virtual camera is consistent with the moving direction of the currently locked virtual object, so that the currently locked virtual object is always displayed at a specific position in the virtual scene.
[0174] In an optional embodiment, the method further includes: displaying a lock mark at a preset position corresponding to the currently locked virtual object.
[0175] Among them, the preset position refers to the position corresponding to the currently locked virtual object. Specifically, the preset position can be the upper position of the currently locked virtual object, the lower position of the currently locked virtual object, the right position of the currently locked virtual object, the left position of the currently locked virtual object, or the position of a certain part of the body of the currently locked virtual object. This exemplary embodiment does not make any special limitations on this.
[0176] The function of the lock mark is to remind the user that the hostile virtual object is the currently locked virtual object. Specifically, the lock mark can be a graphic, a number, or a letter, and this exemplary embodiment does not impose any special limitation on this.
[0177] For example, a lock mark is displayed at the exact center of the body of the currently locked virtual object.
[0178] In this exemplary embodiment, a lock mark is displayed at a preset position relative to the currently locked virtual object, which helps to remind the user which hostile virtual object is locked, thereby optimizing the user's gaming experience.
[0179] In an optional embodiment, the method further includes: in response to a third touch operation on the function control, cancelling the lock on the currently locked virtual object.
[0180] Among them, the third touch operation is different from the first touch operation, the second touch operation and the control operation. Specifically, the third touch operation can be a long press operation, a double-click operation, or any operation that is different from the first touch operation, the second touch operation and the control operation. This exemplary embodiment does not make any special limitations on this.
[0181] When the user performs a third touch operation on the function control, the currently locked virtual object will be unlocked.
[0182] For example, the currently locked virtual object is the second virtual object X4. When the user long presses the function control, the lock on the second virtual object X4 is released.
[0183] In this exemplary embodiment, when the third touch operation is performed on the lock control, the lock on the currently locked virtual object is canceled, which meets the user's need to cancel the lock and improves the user experience.
[0184] In the method and apparatus provided by the exemplary embodiments of the present disclosure, on the one hand, based on the first position information of the currently locked first virtual object, the second virtual object is determined according to the operation direction, thereby avoiding the situation in the prior art where a virtual object is randomly locked, and avoiding the situation where the randomly locked virtual object is not the locked object expected by the user, thereby improving the user experience; on the other hand, the second virtual object is determined based on the first position information and the operation direction. Based on this, the second virtual object is related to the operation direction and the first position information, thereby improving the accuracy of the determined second virtual object, and avoiding the situation in the prior art where a virtual object may be switched to a virtual object outside the field of view of the virtual object.
[0185] The following describes in detail the method for switching virtual objects in the embodiment of the present disclosure in conjunction with an application scenario.
[0186] In the game interface of a shooting game, the currently locked first virtual object is virtual object A. At this time, when the user slides on the function (upper right of the sliding direction), the second virtual object is determined to be virtual object B based on the first position information of the first virtual object A and the sliding direction, and the currently locked virtual object is switched from the first virtual object A to the second virtual object B.
[0187] In this application scenario, on the one hand, based on the first position information of the currently locked first virtual object, the second virtual object is determined according to the operation direction, thereby avoiding the situation in the prior art where a virtual object is randomly locked, and avoiding the randomly locked virtual object not being the locked object expected by the user, thereby improving the user experience; on the other hand, the second virtual object is determined based on the first position information and the operation direction. Based on this, the second virtual object is related to the operation direction and the first position information, thereby improving the accuracy of the determined second virtual object, and avoiding the situation in the prior art where a virtual object may be switched to a virtual object outside the field of view of the virtual object.
[0188] In addition, in an exemplary embodiment of the present disclosure, a display device for a virtual object is also provided. Figure 20 A schematic diagram of the structure of a switching device for a virtual object is shown in FIG. Figure 20As shown, the virtual object switching device 2000 may include: a response module 2010, a determination module 2020 and a switching module 2030.
[0189] The response module 2010 is configured to respond to a control operation acting on a functional control and determine an operation direction corresponding to the control operation; wherein the functional control is located on a graphical user interface; the determination module 2020 is configured to determine a second virtual object according to the operation direction based on the first position information of the currently locked first virtual object, wherein the currently locked first virtual object is the behavior target of the virtual character; and the switching module 2030 is configured to switch the currently locked first virtual object to the second virtual object.
[0190] The specific details of the virtual object switching device 2000 have been described in detail in the corresponding virtual object switching method, and thus will not be repeated here.
[0191] It should be noted that although the above detailed description mentions several modules or units of the virtual object switching device 2100, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided to be embodied by multiple modules or units.
[0192] In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0193] Refer to the following Figure 21 1 and 2 will now be described an electronic device 2100 according to such an embodiment of the present invention. Figure 21 The electronic device 2100 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present invention.
[0194] like Figure 21 As shown, electronic device 2100 is implemented as a general-purpose computing device. Components of electronic device 2100 may include, but are not limited to, the aforementioned at least one processing unit 2110, the aforementioned at least one storage unit 2120, a bus 2130 connecting various system components (including storage unit 2120 and processing unit 2110), and a display unit 2140.
[0195] The storage unit stores program codes, which can be executed by the processing unit 2110, so that the processing unit 2110 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification.
[0196] The storage unit 2120 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 2121 and / or a cache memory unit 2122 , and may further include a read-only memory unit (ROM) 2123 .
[0197] The storage unit 2120 may also include a program / utility 2124 having a set (at least one) of program modules 2125, such program modules 2125 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include the reality of a network environment.
[0198] The bus 2130 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0199] The electronic device 2100 can also communicate with one or more external devices 2170 (e.g., a keyboard, a pointing device, a Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 2100, and / or any device that enables the electronic device 2100 to communicate with one or more other computing devices (e.g., a router, a modem, etc.). Such communication can occur via an input / output (I / O) interface 2150. Furthermore, the electronic device 2100 can also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 2160. As shown, the network adapter 2160 communicates with other modules of the electronic device 2100 via a bus 2130. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 2100, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0200] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
[0201] In exemplary embodiments of the present disclosure, a computer-readable storage medium is also provided, storing a program product capable of implementing the aforementioned methods of this specification. In some possible embodiments, various aspects of the present invention may also be implemented in the form of a program product comprising program code. When the program product is executed on a terminal device, the program code is configured to cause the terminal device to perform the steps according to various exemplary embodiments of the present invention described in the "Exemplary Methods" section of this specification.
[0202] refer to Figure 22 As shown, a program product 2200 for implementing the above method according to an embodiment of the present invention is described. The program product 2200 may be a portable compact disc read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0203] The program product may be implemented in any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0204] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0205] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0206] The program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, and the like, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0207] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow from the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.
Claims
1. A method for switching virtual objects, comprising providing a graphical user interface through a terminal device, wherein the graphical user interface includes at least a portion of a virtual scene and at least a portion of a virtual character, wherein: The virtual character is a virtual object corresponding to the terminal device, and the method includes: In response to a control operation applied to a functional control, determining an operation direction corresponding to the control operation; wherein the functional control is located on the graphical user interface; determining a second virtual object according to the operation direction based on first position information of a currently locked first virtual object, wherein the currently locked first virtual object is a behavioral target of the virtual character, and the currently locked first virtual object is determined from hostile virtual objects displayed in the graphical user interface in response to a first touch operation applied to the function control, and the first touch operation does not have an operation direction; Switching the currently locked first virtual object to the second virtual object; The determining of the second virtual object according to the operation direction based on the first position information of the currently locked first virtual object includes: Determine first position information corresponding to the currently locked first virtual object, establish a region ray consistent with the operation direction with the first position information as an endpoint; construct a sector-shaped region with a central angle of a preset angle based on the region ray with the first position information as a center; determine all region objects within the sector-shaped region, and determine a second virtual object within all the region objects; If there is no area object in the fan-shaped area, the preset angle is expanded to update the fan-shaped area; it is determined whether there is the area object in the updated fan-shaped area to obtain an object judgment result; and according to the judgment result, a second virtual object in the fan-shaped area is determined.
2. The method for switching virtual objects according to claim 1, wherein: The determining the second virtual object according to the operation direction based on the first position information of the currently locked first virtual object includes: Using the first position information as an endpoint, establishing a target ray consistent with the operation direction; All ray virtual objects on the target ray are determined to determine a second virtual object among all the ray virtual objects.
3. The method for switching virtual objects according to claim 1, wherein: The determining of all area objects in the sector-shaped area to determine the second virtual object in all area objects includes: If there are area objects in the sector area, the number of the area objects is determined to obtain a number determination result; If the number determination result is one, determining one of the area objects as the second virtual object; If the number determination result is multiple, object position information corresponding to the multiple area objects is determined, and a second virtual object is determined in the area object according to the position distance between the object position information and the first position information.
4. The method for switching virtual objects according to claim 1, wherein: If no area object exists in the sector-shaped area, expanding the preset angle to update the sector-shaped area includes: The preset angle is incremented according to a preset angle increment parameter to update the sector area.
5. The method for switching virtual objects according to claim 1, wherein: The method further comprises: If the enlarged preset angle meets the preset angle condition and the area object does not exist in the fan-shaped area corresponding to the enlarged preset angle, the direction of the area ray is changed from being consistent with the operation direction to being opposite to the operation direction to update the area ray.
6. The method for switching virtual objects according to claim 1, wherein: The method further comprises: Obtaining the position and direction of a currently locked virtual object relative to the virtual character, and determining a current attack direction corresponding to the virtual character; wherein the currently locked virtual object is the first virtual object or the second virtual object; Based on the position direction, the current attack direction is adjusted so that the adjusted current attack direction corresponds to the currently locked virtual object.
7. The method for switching virtual objects according to claim 6, wherein: The method further comprises: Acquire a shooting angle of a virtual camera corresponding to the virtual scene; In response to a movement operation applied to the currently locked virtual object, obtaining a movement direction corresponding to the movement operation; The shooting angle is adjusted according to the moving direction.
8. The method for switching virtual objects according to claim 1, wherein: The method further comprises: A locking mark is displayed at a preset position corresponding to the currently locked virtual object.
9. The method for switching virtual objects according to claim 1, wherein: Before responding to the control operation on the functional control and determining the operation direction corresponding to the control operation, the method further includes: In response to a first touch operation on the functional control, determining screen position information corresponding to the graphical user interface; determining object position information of a hostile virtual object displayed in the graphical user interface, and calculating the object position information and the screen position information to obtain position calculation results; According to the position calculation result, a first virtual object is determined among the hostile virtual objects, and the first virtual object is determined as the currently locked virtual object.
10. The method for switching virtual objects according to claim 9, wherein: The screen position information includes position information corresponding to the center of the graphical user interface, crosshair position information, and character position information corresponding to the virtual character.
11. The method for switching virtual objects according to claim 9, wherein: After determining the first virtual object as the currently locked virtual object, the method further includes: In response to a second touch operation on the function control, determining a target hostile virtual object displayed in the graphical user interface; wherein the target hostile virtual object does not include the first virtual object; One of the target hostile virtual objects is used as the second virtual object, and the currently locked first virtual object is switched to the second virtual object.
12. The method for switching virtual objects according to any one of claims 6 to 11, characterized in that: The method further comprises: In response to a third touch operation on the function control, the currently locked virtual object is unlocked.
13. A device for switching virtual objects, providing a graphical user interface through a terminal device, wherein the graphical user interface includes at least a portion of a virtual scene and at least a portion of a virtual character, wherein: The virtual character is a virtual object corresponding to the terminal device, and is characterized by including: a response module configured to respond to a control operation applied to a functional control and determine an operation direction corresponding to the control operation; wherein the functional control is located on the graphical user interface; a determination module configured to determine a second virtual object according to the operation direction based on first position information of a currently locked first virtual object, wherein the currently locked first virtual object is a behavior target of the virtual character, and the currently locked first virtual object is determined from hostile virtual objects displayed in the graphical user interface in response to a first touch operation applied to the function control, and the first touch operation does not have an operation direction; a switching module, configured to switch the currently locked first virtual object to the second virtual object; The determining of the second virtual object according to the operation direction based on the first position information of the currently locked first virtual object includes: Using the first position information as an endpoint, establishing a region ray consistent with the operation direction; using the first position information as a center, constructing a sector-shaped region with a central angle of a preset angle based on the region ray; determining all region objects within the sector-shaped region, and determining a second virtual object within all the region objects; If there is no area object in the fan-shaped area, the preset angle is expanded to update the fan-shaped area; it is determined whether there is the area object in the updated fan-shaped area to obtain an object judgment result; and according to the judgment result, a second virtual object in the fan-shaped area is determined.
14. An electronic device, characterized in that: include: processor; a memory for storing executable instructions of the processor; The processor is configured to execute the virtual object switching method according to any one of claims 1 to 12 by executing the executable instructions.
15. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for switching virtual objects according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Method and apparatus for locking virtual object in game, electronic device, and storage medium
CN110420462A
Virtual object switching method and device, equipment, medium and program product
CN114130023A
Target locking method and device, electronic equipment and readable storage medium
CN114510184A