Virtual object control method, storage medium and electronic device
By optimizing the control method of virtual objects, first judging the target position information of the virtual object, and then judging the obstacle detection results, the problem of low virtual object control efficiency is solved and efficient utilization of computing resources is achieved.
Patent Information
- Application Number
- CN202111307446.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-05
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-11-05
AI Technical Summary
The control efficiency of virtual objects in virtual games is low, and existing technology cannot effectively solve the problem of increased computing volume caused by complex judgment mechanisms.
By obtaining the target position information and obstacle detection results between virtual objects, the judgment sequence is optimized, and the position information with a small amount of calculation is judged first, and then the obstacle detection results with a large amount of calculation are judged, thereby saving computing resources.
It improves the control efficiency of virtual objects, optimizes the utilization of computing resources, and reduces the computing load of the system.
Smart Images

Figure CN114011069B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a control method, storage medium and electronic device for a virtual object. Background Art
[0002] In virtual games, players can often control virtual objects to perform a variety of attack operations. The higher the intensity of the attack operation, the more demanding the control method is. For example, a more complex judgment mechanism is set to determine whether the execution conditions of the attack operation are met, but a complex judgment mechanism also means more calculations, and more calculations will naturally reduce the control efficiency of the virtual object. Therefore, there is a problem of low control efficiency of virtual objects.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] Embodiments of the present invention provide a method for controlling a virtual object, a storage medium, and an electronic device, so as to at least solve the technical problem of low control efficiency of the virtual object.
[0005] According to one aspect of an embodiment of the present invention, a control method for a virtual object is provided, comprising: in response to a target attack instruction triggered on a first virtual object, obtaining target position information associated with a second virtual object, wherein the target attack instruction is used to instruct the first virtual object to perform a target attack operation, the second virtual object and the first virtual object are in different camps, and the target position information is used to indicate position information of the second virtual object relative to the first virtual object; when the target position information satisfies a first trigger condition, performing ray detection on an area between the first virtual object and the second virtual object to obtain a target detection result, wherein the target detection result is a detection result of an obstacle between the first virtual object and the second virtual object; when the target detection result satisfies a second trigger condition, playing a target animation, wherein the target animation includes a screen in which the first virtual object performs the target attack operation on the second virtual object, and a screen in which the second virtual object is defeated by the target attack operation.
[0006] According to another aspect of an embodiment of the present invention, a control device for a virtual object is also provided, comprising: an acquisition unit, configured to acquire target position information associated with a second virtual object in response to a target attack instruction triggered on a first virtual object, wherein the target attack instruction is used to instruct the first virtual object to perform a target attack operation, the second virtual object and the first virtual object are in different camps, and the target position information is used to indicate position information of the second virtual object relative to the first virtual object; a detection unit, configured to perform ray detection on an area between the first virtual object and the second virtual object when the target position information satisfies a first trigger condition, to obtain a target detection result, wherein the target detection result is a detection result of an obstacle between the first virtual object and the second virtual object; and a playback unit, configured to play a target animation when the target detection result satisfies a second trigger condition, wherein the target animation includes a screen in which the first virtual object performs the target attack operation on the second virtual object, and a screen in which the second virtual object is defeated by the target attack operation.
[0007] As an optional solution, the above-mentioned acquisition unit includes: a first acquisition module, used to acquire relative distance information, wherein the above-mentioned relative distance information is used to indicate the relative distance between the above-mentioned second virtual object and the above-mentioned first virtual object; a second acquisition module, used to acquire target height information when the above-mentioned relative distance information satisfies a first trigger sub-condition, wherein the above-mentioned target height information is used to indicate the height difference between the above-mentioned second virtual object and the above-mentioned first virtual object; a third acquisition module, used to acquire target angle information when the above-mentioned target height information satisfies a second trigger sub-condition, wherein the above-mentioned target angle information is information associated with the field of view angle of the above-mentioned second virtual object and / or the above-mentioned first virtual object, and the above-mentioned first trigger condition includes that the above-mentioned target angle information satisfies the third trigger sub-condition.
[0008] As an optional scheme, the above-mentioned first acquisition module includes: a first determination submodule, used to determine multiple first position points associated with the above-mentioned first virtual object; a second determination submodule, used to determine multiple second position points associated with the above-mentioned second virtual object; the first acquisition submodule, used to obtain M relative distances between each first position point among the above-mentioned multiple first position points and each second position point among the above-mentioned multiple second position points, wherein M is a natural number; the second acquisition submodule, used to obtain the minimum relative distance among the above-mentioned M relative distances, wherein the above-mentioned relative distance information includes the above-mentioned minimum relative distance, and the first trigger subcondition includes that the above-mentioned minimum relative distance is less than or equal to the first threshold.
[0009] As an optional scheme, the above-mentioned second acquisition module includes: a third determination submodule, used to determine multiple third position points associated with the above-mentioned first virtual object; a fourth determination submodule, used to determine multiple fourth position points associated with the above-mentioned second virtual object; a third acquisition submodule, used to obtain N relative height differences between each third position point in the above-mentioned multiple third position points and each fourth position point in the above-mentioned multiple fourth position points, wherein N is a natural number; a fourth acquisition submodule, used to obtain the maximum relative height difference among the above-mentioned N relative height differences, wherein the above-mentioned target height information includes the above-mentioned maximum relative height difference, and the above-mentioned second trigger subcondition includes that the above-mentioned maximum relative height difference is less than or equal to the second threshold.
[0010] As an optional scheme, the above-mentioned third acquisition module includes: a fifth determination sub-module, used to determine the field of view angle of the above-mentioned first virtual object; a fifth acquisition sub-module, used to obtain first angle information, wherein the above-mentioned first angle information is used to indicate whether the above-mentioned second virtual object is located in the first area range corresponding to the field of view angle of the above-mentioned first virtual object, and the above-mentioned third trigger sub-condition includes the above-mentioned first angle information indicating that the above-mentioned second virtual object is located in the above-mentioned first area range.
[0011] As an optional scheme, the above-mentioned fifth acquisition submodule includes: a first acquisition subunit, used to acquire the current orientation vector of the above-mentioned first virtual object; a second acquisition subunit, used to acquire the position difference vector between the above-mentioned second virtual object and the above-mentioned first virtual object; a first calculation subunit, used to calculate the angle between the current orientation vector of the above-mentioned first virtual object and the above-mentioned position difference vector, to obtain a first target angle; a third acquisition subunit, used to acquire a first angle comparison result between the field of view angle of the above-mentioned second virtual object and the above-mentioned first target angle, wherein the above-mentioned first angle information includes the above-mentioned first angle comparison result, and the above-mentioned third trigger subcondition includes the above-mentioned first angle comparison result indicating that the above-mentioned first target angle is less than or equal to the field of view angle of the above-mentioned first virtual object.
[0012] As an optional scheme, the above-mentioned third acquisition module includes: a sixth determination sub-module, used to determine the field of view angle of the above-mentioned second virtual object; a sixth acquisition sub-module, used to obtain second angle information, wherein the above-mentioned second angle information is used to determine whether the above-mentioned first virtual object is located in the second area range corresponding to the field of view angle of the above-mentioned second virtual object, and the above-mentioned third trigger sub-condition includes the above-mentioned second angle information indicating that the above-mentioned first virtual object is located outside the above-mentioned second area range.
[0013] As an optional scheme, the above-mentioned sixth acquisition submodule includes: a fourth acquisition subunit, used to obtain the current orientation vector of the above-mentioned second virtual object; a fifth acquisition subunit, used to obtain the position difference vector between the above-mentioned second virtual object and the above-mentioned first virtual object; a second calculation subunit, used to calculate the angle between the current orientation vector of the above-mentioned second virtual object and the above-mentioned position difference vector, to obtain the second target angle; a sixth acquisition subunit, used to obtain a second angle comparison result between the field of view angle of the above-mentioned second virtual object and the above-mentioned second target angle, wherein the above-mentioned second angle information includes the above-mentioned second angle comparison result, and the above-mentioned third trigger subcondition includes the above-mentioned second angle comparison result indicating that the above-mentioned second target angle is greater than the field of view angle of the above-mentioned second virtual object.
[0014] As an optional scheme, the above-mentioned detection unit includes: a first determination module, used to determine the first contact point between the above-mentioned first virtual object and the above-mentioned target area, and the second contact point between the above-mentioned second virtual object and the above-mentioned target area when the above-mentioned first virtual object and the above-mentioned second virtual object are located on the target area; a second determination module, used to emit one or more rays from the above-mentioned first contact point to the above-mentioned second contact point, and detect obstacles colliding with the above-mentioned one or more rays to obtain the above-mentioned target detection result.
[0015] As an optional solution, the above-mentioned device also includes: a first trigger unit, which is used to trigger the above-mentioned target attack instruction when the selection operation of the first virtual button is obtained, the above-mentioned target position information meets the above-mentioned first trigger condition, and the above-mentioned target detection result meets the above-mentioned second trigger condition; or, a second trigger unit, which is used to trigger the target operation instruction when the selection operation of the above-mentioned first virtual button is obtained and the above-mentioned target position information does not meet the above-mentioned first trigger condition, wherein the above-mentioned target operation instruction is used to instruct the above-mentioned first virtual object to perform the target operation; or, a third trigger unit, which is used to trigger the above-mentioned target operation instruction when the selection operation of the above-mentioned first virtual button is obtained, the above-mentioned target position information meets the above-mentioned first trigger condition, but the above-mentioned target detection result does not meet the above-mentioned second trigger condition.
[0016] As an optional solution, the above-mentioned device also includes: a fourth trigger unit, which is used to trigger the above-mentioned target attack instruction when the selection operation of the second virtual button is obtained, the above-mentioned target position information satisfies the above-mentioned first trigger condition, and the above-mentioned target detection result satisfies the above-mentioned second trigger condition; or, a fifth trigger unit, which is used to not trigger any instruction when the selection operation of the above-mentioned second virtual button is obtained and the above-mentioned target position information does not meet the above-mentioned first trigger condition; or, a sixth trigger unit, which is used to not trigger any of the above-mentioned instructions when the selection operation of the above-mentioned second virtual button is obtained, the above-mentioned target position information satisfies the above-mentioned first trigger condition, but the above-mentioned target detection result does not meet the above-mentioned second trigger condition.
[0017] As an optional scheme, the above-mentioned target position information includes at least one of the following: relative distance information, wherein the above-mentioned relative distance information is used to indicate the relative distance between the above-mentioned second virtual object and the above-mentioned first virtual object; target height information, wherein the above-mentioned target height information is used to indicate the height difference between the above-mentioned second virtual object and the above-mentioned first virtual object; target angle information, wherein the above-mentioned target angle information is information associated with the field of view angle of the above-mentioned second virtual object and / or the above-mentioned first virtual object.
[0018] According to another aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the control method of the virtual object as described above.
[0019] According to another aspect of an embodiment of the present invention, there is provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the virtual object control method through the computer program.
[0020] In an embodiment of the present invention, in response to a target attack instruction triggered on a first virtual object, target position information associated with a second virtual object is obtained, wherein the target attack instruction is used to instruct the first virtual object to perform a target attack operation, the second virtual object and the first virtual object are in different camps, and the target position information is used to represent the position information of the second virtual object relative to the first virtual object; when the target position information satisfies a first trigger condition, ray detection is performed on the area between the first virtual object and the second virtual object to obtain a target detection result, wherein the target detection result is a detection result of an obstacle between the first virtual object and the second virtual object; when the target detection result satisfies a second trigger condition, a target animation is played, wherein The target animation includes a screen in which the first virtual object performs the target attack operation on the second virtual object, and a screen in which the second virtual object is defeated by the target attack operation. In the process of judging whether the trigger condition is satisfied after responding to the target attack instruction, the target position information with a smaller amount of computation is first judged, and then the detection result of the obstacle with a larger amount of computation is judged. In this way, if the judgment result of the target position information is not satisfied, there is no need to pay a larger amount of computation to judge whether the detection result of the obstacle is satisfied, thereby saving a large amount of computing resources, thereby achieving the purpose of improving the utilization rate of computing resources in the control process of virtual objects, thereby achieving the technical effect of improving the control efficiency of virtual objects, and thereby solving the technical problem of low control efficiency of virtual objects. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0022] Figure 1 is a schematic diagram of an application environment of an optional virtual object control method according to an embodiment of the present invention;
[0023] Figure 2 is a schematic diagram of a process of an optional virtual object control method according to an embodiment of the present invention;
[0024] Figure 3 is a schematic diagram of an optional method for controlling a virtual object according to an embodiment of the present invention;
[0025] Figure 4 is a schematic diagram of another optional method for controlling a virtual object according to an embodiment of the present invention;
[0026] Figure 5is a schematic diagram of another optional method for controlling a virtual object according to an embodiment of the present invention;
[0027] Figure 6 is a schematic diagram of another optional method for controlling a virtual object according to an embodiment of the present invention;
[0028] Figure 7 is a schematic diagram of another optional method for controlling a virtual object according to an embodiment of the present invention;
[0029] Figure 8 is a schematic diagram of another optional method for controlling a virtual object according to an embodiment of the present invention;
[0030] Fig. 9 is a schematic diagram of another optional method for controlling a virtual object according to an embodiment of the present invention;
[0031] Fig.10 is a schematic diagram of another optional method for controlling a virtual object according to an embodiment of the present invention;
[0032] Fig.11 is a schematic diagram of another optional method for controlling a virtual object according to an embodiment of the present invention;
[0033] Fig.12 is a schematic diagram of another optional method for controlling a virtual object according to an embodiment of the present invention;
[0034] Fig.13 is a schematic diagram of an optional control device for a virtual object according to an embodiment of the present invention;
[0035] Fig.14 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0036] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0037] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0038] First, to facilitate understanding of the embodiments of the present invention, some terms or nouns involved in the present invention are explained below:
[0039] Mobile terminal: generally refers to the mobile phone terminal, including but not limited to all handheld portable gaming devices.
[0040] Shooting games: including first-person shooter games, third-person shooter games, and other games that use hot weapons for long-range attacks, including but not limited to these.
[0041] Execution interaction: A method of interaction between two characters, with an initiator and a victim. After the initiator initiates the interaction, a forced animation will be played and the victim will be killed.
[0042] According to one aspect of an embodiment of the present invention, a method for controlling a virtual object is provided. Optionally, as an optional implementation, the method for controlling a virtual object may be, but is not limited to, applied to: Figure 1 In the environment shown, it may include but is not limited to a user device 102, a network 110 and a server 112, wherein the user device 102 may include but is not limited to a display 108, a processor 106 and a memory 104.
[0043] The specific process can be as follows:
[0044] Step S102, the user device 102 obtains a target attack instruction triggered on the first virtual object (A), wherein the target attack instruction is used to instruct the first virtual object (A) to perform a target attack operation on the second virtual object (B);
[0045] Steps S104-S106, the user device 102 sends the target attack instruction to the server 112 via the network 110, wherein the target attack instruction also carries the target position information associated with the second virtual object (B);
[0046] Step S108, the server 112 searches the database 114 for the first trigger condition and the second trigger condition of the target attack operation, and sends the ray detection instruction to the user device 102 through the network 110 when the target position information meets the first trigger condition, and receives the target detection result fed back by the user device 102 in response to the ray detection instruction; further, when the above target detection result meets the second trigger condition, the processing engine 116 generates a target animation corresponding to the target attack operation;
[0047] In steps S110 - S112 , the server 112 sends the target animation to the user device 102 via the network 110 , and the processor 106 in the user device 102 displays the target animation on the display 108 and stores the target animation in the memory 104 .
[0048] remove Figure 1 In addition to the examples shown, the above steps can be completed independently by the user device 102, that is, the user device 102 performs steps such as generating a target animation corresponding to the target attack operation, thereby reducing the processing pressure of the server. The user device 102 includes but is not limited to a handheld device (such as a mobile phone), a laptop computer, a desktop computer, a vehicle-mounted device, etc., and the present invention does not limit the specific implementation of the user device 102.
[0049] Optionally, as an optional implementation, as Figure 2 As shown, the control method of the virtual object includes:
[0050] S202, in response to a target attack instruction triggered on the first virtual object, obtaining target position information associated with the second virtual object, wherein the target attack instruction is used to instruct the first virtual object to perform a target attack operation, the second virtual object and the first virtual object are in different camps, and the target position information is used to indicate position information of the second virtual object relative to the first virtual object;
[0051] S204, when the target position information satisfies the first trigger condition, performing ray detection on the area between the first virtual object and the second virtual object to obtain a target detection result, wherein the target detection result is a detection result of an obstacle between the first virtual object and the second virtual object;
[0052] S206, when the target detection result meets the second trigger condition, play the target animation, wherein the target animation includes a picture of the first virtual object performing a target attack operation on the second virtual object, and a picture of the second virtual object being defeated by the target attack operation.
[0053] Optionally, in this embodiment, the control method of the virtual object can be but is not limited to being applied in the execution interaction process in the target game scene. Specifically, for example, the user controls the first virtual object to move to a position near the second virtual object and triggers a target attack instruction, and then, when it is determined that the relevant information meets the trigger condition, the game screen of the second virtual object being executed is played, wherein the relevant information at least includes the target position information associated with the second virtual object and the detection result of the obstacle between the first virtual object and the second virtual object, and in the process of determining that the relevant information meets the trigger condition, the judgment order is to first judge the target position information associated with the second virtual object, and then judge the obstacle between the first virtual object and the second virtual object. The advantage of this is that the target position information associated with the second virtual object can be directly obtained, and the computing resources consumed are relatively small. The detection result of the obstacle between the first virtual object and the second virtual object requires ray detection of the area between the first virtual object and the second virtual object, and the computing resources consumed are relatively large. After judging the target position information associated with the second virtual object, if the conclusion is that the trigger condition is not met, there is no need to judge the detection result of the obstacle between the first virtual object and the second virtual object, which saves most of the computing resources required, improves the utilization rate of computing resources, and achieves the effect of improving the control efficiency of virtual objects.
[0054] Optionally, in this embodiment, the target game scene includes first-person shooter games, third-person shooter games, and other games that use hot weapons for long-range attacks, including but not limited to these. Among them, the target shooting application can be a multiplayer online tactical competitive game (Multiplayer Online Battle Arena, referred to as MOBA) or a single-player game (Single-Player Game, referred to as SPG). It should be noted that the types of the game applications may include but are not limited to at least one of the following: two-dimensional (Two Dimension, referred to as 2D) game applications, three-dimensional (Three Dimension, referred to as 3D) game applications, virtual reality (Virtual Reality, referred to as VR) game applications, augmented reality (Augmented Reality, referred to as AR) game applications, mixed reality (Mixed Reality, referred to as MR) game applications. The above is just an example, and this embodiment does not make any limitation to this.
[0055] Optionally, in the present embodiment, the target position information associated with the second virtual object may be, but is not limited to, understood as position information related to the second virtual object, such as position information of the second virtual object itself, for example, the height of the second virtual object, the position coordinates of the second virtual object, the field of view angle of the current direction of the second virtual object, etc.; another example is the relative position information between the second virtual object and other virtual objects, for example, the relative distance between the second virtual object and the first virtual object, the relative height between the second virtual object and the first virtual object, etc., or a more complex information pattern, such as the second virtual object is within / outside the field of view angle of the first virtual object, and the first virtual object is within / outside the field of view angle of the second virtual object.
[0056] Optionally, in this embodiment, the target attack operation can be understood as, but not limited to, an attack operation specified to be performed on the second virtual object, or can be understood as an attack operation performed on all (enemy) virtual objects within the target range, or can be understood as an attack operation performed on the (enemy) virtual object closest to the first virtual object within the target range, or can be understood as an attack operation performed on the (enemy) virtual object directly facing the first virtual object within the target range, wherein the target range can be, but is not limited to, the operating range of the target attack operation.
[0057] Optionally, in this embodiment, ray detection of the area between the first virtual object and the second virtual object may be implemented but is not limited to using Unity's ray detection system, which may but is not limited to also involve intersection detection of lines in the space and the 3D space, which is the calculation with the largest amount of computation, for example, ray detection is performed between the BoundingBox (8 points) of the first virtual object and the BoundingBox (8 points) of the second virtual object to see if there are any obstacles.
[0058] Optionally, in this embodiment, the second trigger condition may include but is not limited to including a target detection result indicating that there is no obstacle between the first virtual object and the second virtual object, or a target detection result indicating that there is no target obstacle between the first virtual object and the second virtual object, wherein the target obstacle is an obstacle whose obstruction attribute value reaches an obstacle threshold, and the obstruction attribute value may include but is not limited to at least one of the following: obstacle size, obstacle area, obstacle material, etc.
[0059] Optionally, in this embodiment, the target animation includes a picture of the first virtual object performing a target attack operation on the second virtual object, and a picture of the second virtual object being defeated by the target attack operation, or the target animation can be understood as, but is not limited to, the first execution interaction animation that is forced to be played.
[0060] Optionally, in this embodiment, the first trigger condition and / or the second trigger condition may be but is not limited to being determined by the second virtual object or the first virtual object itself. For example, with respect to the first virtual object, a first attribute may be set, and the first attribute is used to reduce the difficulty of judging the first trigger condition and / or the second trigger condition; and with respect to the second virtual object, a second attribute may be set, and the first attribute is used to increase the difficulty of judging the first trigger condition and / or the second trigger condition.
[0061] It should be noted that, in response to a target attack instruction triggered on the first virtual object, target position information associated with the second virtual object is obtained, wherein the target attack instruction is used to instruct the first virtual object to perform a target attack operation, the second virtual object and the first virtual object are in different camps, and the target position information is used to indicate the position information of the second virtual object relative to the first virtual object; when the target position information satisfies the first trigger condition, ray detection is performed on the area between the first virtual object and the second virtual object to obtain a target detection result, wherein the target detection result is a detection result of an obstacle between the first virtual object and the second virtual object; when the target detection result satisfies the second trigger condition, a target animation is played, wherein the target animation includes a picture of the first virtual object performing a target attack operation on the second virtual object, and a picture of the second virtual object being defeated by the target attack operation.
[0062] To further illustrate, the optional Figure 3 As shown, in response to a target attack instruction triggered on the first virtual object 302, the target position information associated with the second virtual object 304 is obtained, wherein the target attack instruction is used to instruct the first virtual object 302 to perform a target attack operation, the second virtual object 304 and the first virtual object 302 are in different camps, and the target position information is used to represent the position information of the second virtual object 304 relative to the first virtual object 302; when the target position information meets the first trigger condition, a ray detection is performed on the area between the first virtual object 302 and the second virtual object 304 to obtain a target detection result, such as Figure 3 As shown in (a), the target detection result is the detection result of the obstacle between the first virtual object 302 and the second virtual object 304; further, when the target detection result satisfies the second trigger condition, such as Figure 3 As shown in (b) of FIG. 3 , a target animation 306 is played, wherein the target animation 306 includes a screen in which the first virtual object 302 performs a target attack operation on the second virtual object 304, and a screen in which the second virtual object 304 is defeated by the target attack operation.
[0063] Optionally, in this embodiment, the operations are sorted according to the complexity of the operations, which can reduce the amount of operations in the system to a certain extent. The judgment of the position information is a simple calculation based on the position of the virtual object, which is a simple judgment and requires a small amount of computing resources; the judgment of obstacles often needs to rely on Unity's ray detection system, which involves the intersection detection of the lines in the space and the 3D space, which is the calculation with the largest amount of operations and requires a large amount of computing resources. If it is placed in the last step of the detection system, high utilization of computing resources can be achieved. The specific steps can be Figure 4 As shown:
[0064] Step S402, obtaining target location information;
[0065] Step S404, determining whether the target location information meets the first trigger condition, if yes, executing step S406, if no, executing step S412;
[0066] Step S406, obtaining target detection results;
[0067] Step S408, determining whether the target detection result meets the second trigger condition, if yes, executing step S410, if no, executing step S412;
[0068] Step S410, playing the target animation;
[0069] Step S412: the trigger condition judgment fails and no response is given.
[0070] Through the embodiments provided by the present application, in response to a target attack instruction triggered on a first virtual object, target position information associated with a second virtual object is obtained, wherein the target attack instruction is used to instruct the first virtual object to perform a target attack operation, the second virtual object and the first virtual object are in different camps, and the target position information is used to indicate the position information of the second virtual object relative to the first virtual object; when the target position information meets the first trigger condition, ray detection is performed on the area between the first virtual object and the second virtual object to obtain a target detection result, wherein the target detection result is a detection result of an obstacle between the first virtual object and the second virtual object; when the target detection result meets the second trigger condition, the target motion is played. The target animation includes a picture of the first virtual object performing a target attack operation on the second virtual object, and a picture of the second virtual object being defeated by the target attack operation. In the process of judging whether the trigger condition is met after responding to the target attack instruction, the target position information with a smaller amount of calculation is first judged, and then the detection result of the obstacle with a larger amount of calculation is judged. In this way, if the judgment result of the target position information is not satisfied, there is no need to pay a larger amount of calculation to judge whether the detection result of the obstacle is satisfied, thereby saving a lot of computing resources, thereby achieving the purpose of improving the utilization rate of computing resources in the control process of virtual objects, thereby achieving the technical effect of improving the control efficiency of virtual objects.
[0071] As an optional solution, obtaining target position information associated with the second virtual object includes:
[0072] S1, obtaining relative distance information, wherein the relative distance information is used to represent the relative distance between the second virtual object and the first virtual object;
[0073] S2, when the relative distance information satisfies the first trigger sub-condition, acquiring target height information, wherein the target height information is used to represent the height difference between the second virtual object and the first virtual object;
[0074] S3. When the target height information satisfies the second trigger sub-condition, obtain the target angle information, wherein the target angle information is information associated with the field of view angle of the second virtual object and / or the first virtual object, and the first trigger condition includes that the target angle information satisfies the third trigger sub-condition.
[0075] Optionally, in this embodiment, the order is based on the complexity of the operation, which can reduce the amount of operation of the system to a certain extent. The judgment of the position information is a simple calculation based on the position of the virtual object, which is a simple judgment. However, if it is subdivided, the relative distance information is a simple calculation based on the relative position between the virtual objects, and the target height information is a simple calculation based on the relative height between the virtual objects. The more complicated is the target angle information, which requires a comprehensive judgment based on the field of view angle of the virtual object and the position of the virtual object, and the complexity is higher. Based on this, the relative distance information, relative height information and target angle information are prioritized based on the principle of performing simpler judgments first and then performing more complex judgments.
[0076] To further illustrate, the optional Figure 5 As shown, the specific steps are as follows:
[0077] Step S502, obtaining target distance information;
[0078] Step S504, determining whether the target distance information meets the first trigger sub-condition, if yes, executing step S506, if no, executing step S520;
[0079] Step S506, obtaining target height information;
[0080] Step S508, determining whether the target height information satisfies the second trigger sub-condition, if yes, executing step S510, if no, executing step S520;
[0081] Step S510, obtaining target angle information;
[0082] Step S512, determining whether the target angle information satisfies the third trigger sub-condition, if yes, executing step S514, if no, executing step S520;
[0083] Step S514, obtaining target detection results;
[0084] Step S516, determining whether the target detection result meets the second trigger condition, if yes, executing step S518, if no, executing step S520;
[0085] Step S518, playing the target animation;
[0086] Step S520: the trigger condition judgment fails and no response is given.
[0087] Through the embodiments provided by the present application, relative distance information is obtained, wherein the relative distance information is used to indicate the relative distance between the second virtual object and the first virtual object; when the relative distance information satisfies the first trigger sub-condition, target height information is obtained, wherein the target height information is used to indicate the height difference between the second virtual object and the first virtual object; when the target height information satisfies the second trigger sub-condition, target angle information is obtained, wherein the target angle information is information associated with the field of view angle of the second virtual object and / or the first virtual object, and the first trigger condition includes that the target angle information satisfies the third trigger sub-condition, thereby achieving the purpose of optimizing the judgment step in the control process of the virtual object and realizing the effect of improving the control efficiency of the virtual object.
[0088] As an optional solution, obtain relative distance information, including:
[0089] S1, determining a plurality of first position points associated with a first virtual object;
[0090] S2, determining a plurality of second position points associated with the second virtual object;
[0091] S3, obtaining M relative distances between each first position point among the plurality of first position points and each second position point among the plurality of second position points, where M is a natural number;
[0092] S4, obtaining a minimum relative distance among M relative distances, wherein the relative distance information includes the minimum relative distance, and the first trigger sub-condition includes that the minimum relative distance is less than or equal to a first threshold.
[0093] Optionally, in this embodiment, the first position point may be a node on the first virtual object or a node near the first virtual object. Similarly, the second position point may be a node on the second virtual object or a node near the second virtual object.
[0094] It should be noted that, multiple first position points associated with the first virtual object are determined; multiple second position points associated with the second virtual object are determined; M relative distances between each first position point in the multiple first position points and each second position point in the multiple second position points are obtained, where M is a natural number; the minimum relative distance among the M relative distances is obtained, where the relative distance information includes the minimum relative distance, and the first trigger sub-condition includes that the minimum relative distance is less than or equal to a first threshold.
[0095] To further illustrate, the optional Figure 6As shown, two first position points associated with the first virtual object 602 are determined, such as the first position point 6022 and the first position point 6024; two second position points associated with the second virtual object 604 are determined, such as the second position point 6042 and the second position point 6044; four relative distances between each of the first position points 6022 and the first position point 6024 and the second position point 6042 and the second position point 6044 are obtained; the minimum relative distance among the four relative distances is obtained, and then when the minimum relative distance is less than or equal to the first threshold, it is determined that the relative distance information satisfies the first trigger sub-condition.
[0096] Through the embodiments provided by the present application, multiple first position points associated with a first virtual object are determined; multiple second position points associated with a second virtual object are determined; M relative distances between each first position point in the multiple first position points and each second position point in the multiple second position points are obtained, where M is a natural number; the minimum relative distance among the M relative distances is obtained, where the relative distance information includes the minimum relative distance, and the first trigger sub-condition includes that the minimum relative distance is less than or equal to a first threshold, thereby achieving the effect of improving the information accuracy of the relative distance information.
[0097] As an optional solution, obtain target height information, including:
[0098] S1, determining a plurality of third position points associated with the first virtual object;
[0099] S2, determining a plurality of fourth position points associated with the second virtual object;
[0100] S3, obtaining N relative height differences between each third position point among the plurality of third position points and each fourth position point among the plurality of fourth position points, where N is a natural number;
[0101] S4, obtaining a maximum relative height difference among N relative height differences, wherein the target height information includes the maximum relative height difference, and the second trigger sub-condition includes that the maximum relative height difference is less than or equal to a second threshold.
[0102] Optionally, in this embodiment, the third position point may be a node on the first virtual object or a node near the first virtual object. Similarly, the fourth position point may be a node on the second virtual object or a node near the second virtual object.
[0103] It should be noted that, multiple third position points associated with the first virtual object are determined; multiple fourth position points associated with the second virtual object are determined; N relative height differences between each third position point in the multiple third position points and each fourth position point in the multiple fourth position points are obtained, where N is a natural number; the maximum relative height difference among the N relative height differences is obtained, where the target height information includes the maximum relative height difference, and the second trigger sub-condition includes that the maximum relative height difference is less than or equal to the second threshold.
[0104] To further illustrate, the optional Figure 6 The scenario shown, continuing with e.g. Figure 7 Determine two third position points associated with the first virtual object 602, such as the third position point 7022 and the third position point 7024; determine two fourth position points associated with the second virtual object 604, such as the fourth position point 7042 and the fourth position point 7044; obtain four relative height differences between each of the third position points 7022 and the third position point 7024 and each of the fourth position points 7042 and the fourth position point 7044; obtain the maximum relative height difference among the four relative height differences, wherein the target height information includes the maximum relative height difference, and then when the maximum relative height difference is less than or equal to the second threshold, determine that the maximum relative height difference satisfies the second trigger sub-condition.
[0105] Through the embodiments provided by the present application, multiple third position points associated with the first virtual object are determined; multiple fourth position points associated with the second virtual object are determined; N relative height differences between each third position point in the multiple third position points and each fourth position point in the multiple fourth position points are obtained, where N is a natural number; the maximum relative height difference among the N relative height differences is obtained, where the target height information includes the maximum relative height difference, and the second trigger sub-condition includes that the maximum relative height difference is less than or equal to the second threshold, thereby achieving the effect of improving the information accuracy of the relative distance information.
[0106] As an optional solution, obtain target angle information, including:
[0107] S1, determining a field of view angle of a first virtual object;
[0108] S2, obtaining first angle information, wherein the first angle information is used to indicate whether the second virtual object is located in a first area range corresponding to the field of view angle of the first virtual object, and the third trigger sub-condition includes the first angle information indicating that the second virtual object is located in the first area range.
[0109] Optionally, in this embodiment, the field of view angle of the first virtual object may be understood as, but not limited to, a range angle that can be observed by the first virtual object.
[0110] It should be noted that the field of view angle of the first virtual object is determined; first angle information is obtained, wherein the first angle information is used to indicate whether the second virtual object is located in a first area range corresponding to the field of view angle of the first virtual object, and the third trigger sub-condition includes the first angle information indicating that the second virtual object is located within the first area range.
[0111] To further illustrate, the optional Figure 6 The scenario shown, continuing with e.g. Figure 8 As shown, the field of view angle of the first virtual object 602 is determined; first angle information is obtained, wherein the first angle information is used to indicate whether the second virtual object 604 is located in the first area range 802 corresponding to the field of view angle of the first virtual object 602, and the third trigger sub-condition includes the first angle information indicating that the second virtual object 604 is located in the first area range 802.
[0112] Through the embodiments provided in the present application, the field of view angle of the first virtual object is determined; first angle information is obtained, wherein the first angle information is used to indicate whether the second virtual object is located in a first area range corresponding to the field of view angle of the first virtual object, and the third trigger sub-condition includes the first angle information indicating that the second virtual object is located in the first area range, thereby achieving the effect of improving the information accuracy of the target angle information.
[0113] As an optional solution, obtain target angle information, including:
[0114] S1, determining a field of view angle of a second virtual object;
[0115] S2, obtaining second angle information, wherein the second angle information is used to determine whether the first virtual object is located in a second area range corresponding to the field of view angle of the second virtual object, and the third trigger sub-condition includes that the second angle information indicates that the first virtual object is located outside the second area range.
[0116] Optionally, in this embodiment, the field of view angle of the second virtual object may be understood as, but not limited to, a range angle that the second virtual object can observe.
[0117] It should be noted that the field of view angle of the second virtual object is determined; second angle information is obtained, wherein the second angle information is used to determine whether the first virtual object is located in a second area range corresponding to the field of view angle of the second virtual object, and the third trigger sub-condition includes the second angle information indicating that the first virtual object is located outside the second area range.
[0118] To further illustrate, the optional Figure 6 As shown, continue with Fig. 9As shown, the field of view angle of the second virtual object 604 is determined; second angle information is obtained, wherein the second angle information is used to determine whether the first virtual object 602 is located in the second area range 902 corresponding to the field of view angle of the second virtual object 604, and the third trigger sub-condition includes the second angle information indicating that the first virtual object 602 is located outside the second area range 902.
[0119] Through the embodiments provided in the present application, the field of view angle of the second virtual object is determined; the second angle information is obtained, wherein the second angle information is used to determine whether the first virtual object is located in a second area range corresponding to the field of view angle of the second virtual object, and the third trigger sub-condition includes that the second angle information indicates that the first virtual object is located outside the second area range, thereby achieving the effect of improving the information accuracy of the target angle information.
[0120] As an optional solution, obtaining the first angle information includes:
[0121] S1, obtaining a current orientation vector of a first virtual object;
[0122] S2, obtaining a position difference vector between the second virtual object and the first virtual object;
[0123] S3, calculating the angle between the current orientation vector and the position difference vector of the first virtual object to obtain a first target angle;
[0124] S4, obtaining a first angle comparison result between the field of view angle of the second virtual object and the first target angle, wherein the first angle information includes the first angle comparison result, and the third trigger sub-condition includes the first angle comparison result indicating that the first target angle is less than or equal to the field of view angle of the first virtual object.
[0125] Optionally, in this embodiment, the current heading vector of the first virtual object can be but is not limited to being located in the middle position of the field of view angle of the second virtual object, and then when comparing the field of view angle of the second virtual object with the first target angle, 1 / 2 of the field of view angle of the second virtual object is selected for angle comparison with the first target angle to compare whether the first target angle is less than, greater than or equal to 1 / 2 of the field of view angle of the second virtual object.
[0126] It should be noted that the current orientation vector of the first virtual object is obtained; the position difference vector between the second virtual object and the first virtual object is obtained; the angle between the current orientation vector and the position difference vector of the first virtual object is calculated to obtain a first target angle; and a first angle comparison result between the field of view angle of the second virtual object and the first target angle is obtained, wherein the first angle information includes the first angle comparison result, and the third trigger sub-condition includes the first angle comparison result indicating that the first target angle is less than or equal to the field of view angle of the first virtual object.
[0127] To further illustrate, the optional Fig.10 As shown, the current orientation vector of the first virtual object 1002 is obtained; the position difference vector between the second virtual object 1004 and the first virtual object 1002 is obtained; the angle between the current orientation vector and the position difference vector of the first virtual object 1002 is calculated to obtain a first target angle 1006; a first angle comparison result between the field of view angle 1008 of the second virtual object 1002 and the first target angle 1006 is obtained, wherein the first angle information includes the first angle comparison result, and the third trigger sub-condition includes the first angle comparison result indicating that the first target angle 1006 is less than or equal to the field of view angle 1008 of the first virtual object.
[0128] Through the embodiments provided by the present application, a current orientation vector of a first virtual object is obtained; a position difference vector between a second virtual object and the first virtual object is obtained; an angle between the current orientation vector of the first virtual object and the position difference vector is calculated to obtain a first target angle; a first angle comparison result between the field of view angle of the second virtual object and the first target angle is obtained, wherein the first angle information includes the first angle comparison result, and the third trigger sub-condition includes the first angle comparison result indicating that the first target angle is less than or equal to the field of view angle of the first virtual object, thereby achieving an effect of improving the calculation accuracy of the target angle information.
[0129] As an optional solution, obtaining the second angle information includes:
[0130] S1, obtaining the current orientation vector of the second virtual object;
[0131] S2, obtaining a position difference vector between the second virtual object and the first virtual object;
[0132] S3, calculating the angle between the current orientation vector and the position difference vector of the second virtual object to obtain a second target angle;
[0133] S4, obtaining a second angle comparison result between the field of view angle of the second virtual object and the second target angle, wherein the second angle information includes the second angle comparison result, and the third trigger sub-condition includes that the second angle comparison result indicates that the second target angle is greater than the field of view angle of the second virtual object.
[0134] Optionally, in this embodiment, the current heading vector of the first virtual object can be but is not limited to being located in the middle position of the field of view angle of the second virtual object, and then when comparing the field of view angle of the second virtual object with the first target angle, 1 / 2 of the field of view angle of the second virtual object is selected for angle comparison with the first target angle to compare whether the first target angle is less than, greater than or equal to 1 / 2 of the field of view angle of the second virtual object.
[0135] It should be noted that the current orientation vector of the second virtual object is obtained; the position difference vector between the second virtual object and the first virtual object is obtained; the angle between the current orientation vector of the second virtual object and the position difference vector is calculated to obtain the second target angle; and the second angle comparison result between the field of view angle of the second virtual object and the second target angle is obtained, wherein the second angle information includes the second angle comparison result, and the third trigger sub-condition includes that the second angle comparison result indicates that the second target angle is greater than the field of view angle of the second virtual object.
[0136] To further illustrate, the optional Fig.11 As shown, the current orientation vector of the second virtual object 1104 is obtained; the position difference vector between the second virtual object 1104 and the first virtual object 1102 is obtained; the angle between the current orientation vector of the second virtual object 1104 and the position difference vector is calculated to obtain a second target angle 1108; a second angle comparison result between the field of view angle 1106 of the second virtual object 1104 and the second target angle 1108 is obtained, wherein the second angle information includes the second angle comparison result, and the third trigger sub-condition includes that the second angle comparison result indicates that the second target angle 1108 is greater than the field of view angle 1106 of the second virtual object 1104.
[0137] Through the embodiments provided by the present application, the current orientation vector of the second virtual object is obtained; the position difference vector between the second virtual object and the first virtual object is obtained; the angle between the current orientation vector of the second virtual object and the position difference vector is calculated to obtain a second target angle; and a second angle comparison result between the field of view angle of the second virtual object and the second target angle is obtained, wherein the second angle information includes the second angle comparison result, and the third trigger sub-condition includes that the second angle comparison result indicates that the second target angle is greater than the field of view angle of the second virtual object, thereby achieving the effect of improving the calculation accuracy of the target angle information.
[0138] As an optional solution, performing ray detection on the area between the first virtual object and the second virtual object to obtain a target detection result includes:
[0139] S1, when the first virtual object and the second virtual object are located on a target area, determining a first contact point between the first virtual object and the target area, and a second contact point between the second virtual object and the target area;
[0140] S2, emitting one or more rays from the first contact point to the second contact point, and detecting obstacles that collide with the one or more rays to obtain a target detection result.
[0141] Optionally, in this embodiment, the target area may be understood as, but not limited to, a block or a type of area where the first virtual object and the second virtual object are located together, such as the ground, a building, etc.
[0142] Optionally, in this embodiment, for obstacle detection, a generally more accurate detection algorithm is to detect whether there is an obstacle based on the rays between the BoundingBox (8 points) of the first virtual object and the BoundingBox (8 points) of the second virtual object. Such an accurate algorithm detection requires 8*8 rays. However, for mobile terminals (such as mobile games), this is obviously an unacceptable performance overhead. Considering that obstacles generally touch the ground, it is possible but not limited to simply determining whether there is an obstacle between the landing points of the two virtual objects, that is, just detecting whether there is a collision between a ray.
[0143] It should be noted that, when the first virtual object and the second virtual object are located on the target area, a first contact point between the first virtual object and the target area, and a second contact point between the second virtual object and the target area are determined; one or more rays are emitted from the first contact point to the second contact point, and obstacles colliding with the one or more rays are detected to obtain a target detection result.
[0144] To further illustrate, the optional Fig.12 As shown, when the first virtual object 1202 and the second virtual object 1206 are located on the target area 1206, a first contact point 1208 between the first virtual object 1202 and the target area 1206, and a second contact point 1210 between the second virtual object 1204 and the target area 1206 are determined; one or more rays 1212 are emitted from the first contact point 1208 to the second contact point 1210, and obstacles colliding with the one or more rays 1212 are detected to obtain a target detection result.
[0145] Through the embodiments provided by the present application, when the first virtual object and the second virtual object are located on the target area, a first contact point between the first virtual object and the target area, and a second contact point between the second virtual object and the target area are determined; one or more rays are emitted from the first contact point to the second contact point, and obstacles colliding with the one or more rays are detected to obtain target detection results, thereby achieving the effect of improving the efficiency of obstacle detection.
[0146] As an optional solution, the method further includes:
[0147] S1, triggering a target attack instruction when a selection operation on a first virtual button is obtained, the target position information satisfies a first trigger condition, and the target detection result satisfies a second trigger condition; or,
[0148] S2, when a selection operation on the first virtual button is obtained and the target position information does not meet the first trigger condition, triggering a target operation instruction, wherein the target operation instruction is used to instruct the first virtual object to perform a target operation; or
[0149] S3, triggering a target operation instruction when a selection operation on the first virtual button is obtained and the target position information meets the first trigger condition, but the target detection result does not meet the second trigger condition.
[0150] Optionally, in this embodiment, the first virtual button can be used, but not limited to, to trigger a target attack instruction or a target operation instruction. In other words, when both the first trigger condition and the second trigger condition are met, the first virtual button can trigger the target attack instruction, and when the first trigger condition or the second trigger condition is not met, the first virtual button triggers the target operation instruction.
[0151] Through the embodiments provided by the present application, when a selection operation is obtained for the first virtual button and the target position information does not meet the first trigger condition, the target operation instruction is triggered, wherein the target operation instruction is used to instruct the first virtual object to perform the target operation; or, S3, when a selection operation is obtained for the first virtual button and the target position information meets the first trigger condition, but the target detection result does not meet the second trigger condition, the target operation instruction is triggered, thereby achieving the effect of improving the utilization rate of the virtual buttons.
[0152] As an optional solution, the method further includes:
[0153] S1, triggering a target attack instruction when a selection operation on a second virtual button is obtained, the target position information satisfies a first trigger condition, and the target detection result satisfies a second trigger condition; or,
[0154] S2, when a selection operation on the second virtual button is obtained and the target position information does not meet the first trigger condition, no instruction is triggered; or,
[0155] S3: When a selection operation on the second virtual button is obtained and the target position information meets the first trigger condition, but the target detection result does not meet the second trigger condition, no instruction is triggered.
[0156] Optionally, in this embodiment, the second virtual button can be used, but not limited to, to trigger only a target attack instruction or a target operation instruction. In other words, when both the first trigger condition and the second trigger condition are met, the second virtual button can trigger a target attack instruction, and when the first trigger condition or the second trigger condition is not met, the second virtual button does not trigger any instruction.
[0157] As an optional solution, the target location information includes at least one of the following:
[0158] Relative distance information, wherein the relative distance information is used to indicate a relative distance between the second virtual object and the first virtual object;
[0159] Target height information, wherein the target height information is used to represent a height difference between the second virtual object and the first virtual object;
[0160] Target angle information, wherein the target angle information is information associated with the field of view angle of the second virtual object and / or the first virtual object.
[0161] Optionally, in this embodiment, considering that the acquisition of target location information is relatively simple, multiple information may be selected as target location information, or multiple information may be combined as target location information. For example, relative distance information may be used as target location information, and in the process of determining the target location information, it is only necessary to determine whether the relative distance information meets the trigger condition.
[0162] As an optional solution, for ease of understanding, the control method of the virtual object is applied to a first-person shooting (FPS) game on a mobile terminal as an example. In the FPS game, players play shooting games from a subjective perspective. Players pursue an immersive gaming experience. This naturally places higher demands on the freedom and authenticity of the game. Adding a new experience with more freedom to the game, the execution interaction is more suitable for the game style in this scenario, but since the execution is a mandatory interaction process involving two characters, and the states and actions of the two characters are freely changeable, the detection of the execution often faces huge challenges in the actual process. The present invention aims to propose an innovative detection mechanism to help the system complete the execution detection more accurately and friendly, while bringing less performance consumption.
[0163] For the execution interaction to be triggered, at least one of the following conditions must be met:
[0164] Condition 1) The execution distance must be met. The execution distance is a property of the executioner. Different characters have different execution distances, and the execution distance can be set flexibly. In addition, the execution distance is calculated by calculating the minimum horizontal distance between our capsule and the enemy capsule.
[0165] Condition 2) The height difference between the executioner and the executed cannot be too large. The height difference between the two needs to be within a certain range for execution to be carried out. The height difference can be set flexibly. In addition, the execution height calculation method can also be but is not limited to calculating the maximum vertical distance between our capsule and the enemy capsule.
[0166] Condition 3) The execution angle is a property of the executioner. Different characters have different execution angles, which can be set flexibly. The execution can only be performed behind the enemy, so it is necessary to determine whether the enemy is behind the enemy. The definition of the back is the residual area of the enemy's current perspective. The enemy's perspective takes the largest fov as the benchmark, and different quality characters have different execution angles.
[0167] Condition 4) Smaller obstacles are allowed between the executioner and the executed. For example, the permitted obstacle conditions are that the obstacle height does not exceed 30 cm (for example only) and the width does not exceed 15 cm (for example only).
[0168] Optionally, in this embodiment, when performing execution detection, it is necessary to record the action state stages of both interactors to facilitate subsequent adaptation of actions according to the state stages; in addition, ray detection and coordinate detection can also be used, but not limited to, to replace collision and physical detection.
[0169] To further illustrate, before the runtime detection begins, the attribute value configured by the planner for the character is read according to the ID value of the current character. In the current design, the success of the execution system depends on the satisfaction of all four conditions, that is, distance judgment, height judgment, angle judgment, and obstacle judgment are the four necessary and sufficient conditions of the execution system. Therefore, the four conditions need to be tested in turn. If any condition is not met, then we can directly consider it a failure.
[0170] For the four conditions, they can be sorted according to the complexity of the calculation, which can reduce the amount of calculation of the system to a certain extent. Distance judgment and height judgment are both calculated based on the position difference between the two characters, which is the simplest judgment. The judgment of obstacles needs to rely on Unity's ray detection system, which involves the intersection detection of the inner line of the space and the 3D space. It is the calculation with the largest amount of calculation and should be placed in the last step of the detection system. Therefore, the process of the entire detection system is as follows:
[0171] For the distance condition, the coordinates of the top node and the bottom node of the executioner and the executed are taken respectively, and the distance is calculated respectively. The minimum value of the four distances obtained is the minimum distance interval between the two character capsules. It is compared with the maximum execution distance configured by the planner in the character configuration. If the minimum distance is greater than the configured value, it is considered that the execution cannot be carried out. Otherwise, the distance condition is met.
[0172] The determination of the height condition is similar to the detection of the distance condition, and will not be described in detail here.
[0173] For angle judgment, it is necessary to detect whether the executed person can see the executioner in his field of vision. The positive direction of the executed person is taken as the n1 vector, and the position difference vector between the executed person and the executioner is taken as the n2 vector.
[0174] Calculate the angle between n1 and n2, and compare the obtained angle with the current FoV / 2 of the executed person. If it exceeds FoV / 2, then it can be considered that the executioner is behind the executed person, which means that the angle judgment requirement is met. For judgment within the field of view, the influence of the Y axis (height) direction can be ignored, and the calculation is performed on the XZ plane. The angle calculation formula between the two vectors is as follows:
[0175]
[0176] For obstacle detection, the more accurate detection algorithm is to use rays to detect obstacles between the BoundingBox (8 points) of the executioner and the BoundingBox (8 points) of the executed. Such an accurate algorithm detection requires 8*8 rays. For mobile games, this is obviously an unacceptable performance overhead. Since obstacles are usually on the ground in Call of Duty Mobile, we only need to determine whether there is an obstacle between the landing points of the two characters. In other words, we only need to detect whether there is a collision between a ray.
[0177] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0178] According to another aspect of an embodiment of the present invention, a virtual object control device for implementing the above-mentioned virtual object control method is also provided. Fig.13 As shown, the device comprises:
[0179] An acquiring unit 1302 is configured to acquire target position information associated with a second virtual object in response to a target attack instruction triggered on the first virtual object, wherein the target attack instruction is used to instruct the first virtual object to perform a target attack operation, the second virtual object and the first virtual object are in different camps, and the target position information is used to indicate position information of the second virtual object relative to the first virtual object;
[0180] The detection unit 1304 is used to perform ray detection on the area between the first virtual object and the second virtual object to obtain a target detection result when the target position information satisfies the first trigger condition, wherein the target detection result is a detection result of an obstacle between the first virtual object and the second virtual object;
[0181] The playback unit 1306 is used to play the target animation when the target detection result meets the second trigger condition, wherein the target animation includes a picture of the first virtual object performing a target attack operation on the second virtual object, and a picture of the second virtual object being defeated by the target attack operation.
[0182] Optionally, in this embodiment, the control method of the virtual object can be but is not limited to being applied in the execution interaction process in the target game scene. Specifically, for example, the user controls the first virtual object to move to a position near the second virtual object and triggers a target attack instruction, and then, when it is determined that the relevant information meets the trigger condition, the game screen of the second virtual object being executed is played, wherein the relevant information at least includes the target position information associated with the second virtual object and the detection result of the obstacle between the first virtual object and the second virtual object, and in the process of determining that the relevant information meets the trigger condition, the judgment order is to first judge the target position information associated with the second virtual object, and then judge the obstacle between the first virtual object and the second virtual object. The advantage of this is that the target position information associated with the second virtual object can be directly obtained, and the computing resources consumed are relatively small. The detection result of the obstacle between the first virtual object and the second virtual object requires ray detection of the area between the first virtual object and the second virtual object, and the computing resources consumed are relatively large. After judging the target position information associated with the second virtual object, if the conclusion is that the trigger condition is not met, there is no need to judge the detection result of the obstacle between the first virtual object and the second virtual object, which saves most of the computing resources required, improves the utilization rate of computing resources, and achieves the effect of improving the control efficiency of virtual objects.
[0183] Optionally, in this embodiment, the target game scene includes first-person shooter games, third-person shooter games, and other games that use hot weapons for long-range attacks, including but not limited to these. Among them, the target shooting application can be a multiplayer online tactical competitive game (Multiplayer Online Battle Arena, referred to as MOBA) or a single-player game (Single-Player Game, referred to as SPG). It should be noted that the types of the game applications may include but are not limited to at least one of the following: two-dimensional (Two Dimension, referred to as 2D) game applications, three-dimensional (Three Dimension, referred to as 3D) game applications, virtual reality (Virtual Reality, referred to as VR) game applications, augmented reality (Augmented Reality, referred to as AR) game applications, mixed reality (Mixed Reality, referred to as MR) game applications. The above is just an example, and this embodiment does not make any limitation to this.
[0184] Optionally, in the present embodiment, the target position information associated with the second virtual object may be, but is not limited to, understood as position information related to the second virtual object, such as position information of the second virtual object itself, for example, the height of the second virtual object, the position coordinates of the second virtual object, the field of view angle of the current direction of the second virtual object, etc.; another example is the relative position information between the second virtual object and other virtual objects, for example, the relative distance between the second virtual object and the first virtual object, the relative height between the second virtual object and the first virtual object, etc., or a more complex information pattern, such as the second virtual object is within / outside the field of view angle of the first virtual object, and the first virtual object is within / outside the field of view angle of the second virtual object.
[0185] Optionally, in this embodiment, the target attack operation can be understood as, but not limited to, an attack operation specified to be performed on the second virtual object, or can be understood as an attack operation performed on all (enemy) virtual objects within the target range, or can be understood as an attack operation performed on the (enemy) virtual object closest to the first virtual object within the target range, or can be understood as an attack operation performed on the (enemy) virtual object directly facing the first virtual object within the target range, wherein the target range can be, but is not limited to, the operating range of the target attack operation.
[0186] Optionally, in this embodiment, ray detection of the area between the first virtual object and the second virtual object may be implemented but is not limited to using Unity's ray detection system, which may but is not limited to also involve intersection detection of lines in the space and the 3D space, which is the calculation with the largest amount of computation, for example, ray detection is performed between the BoundingBox (8 points) of the first virtual object and the BoundingBox (8 points) of the second virtual object to see if there are any obstacles.
[0187] Optionally, in this embodiment, the second trigger condition may include but is not limited to including a target detection result indicating that there is no obstacle between the first virtual object and the second virtual object, or a target detection result indicating that there is no target obstacle between the first virtual object and the second virtual object, wherein the target obstacle is an obstacle whose obstruction attribute value reaches an obstacle threshold, and the obstruction attribute value may include but is not limited to at least one of the following: obstacle size, obstacle area, obstacle material, etc.
[0188] Optionally, in this embodiment, the target animation includes a picture of the first virtual object performing a target attack operation on the second virtual object, and a picture of the second virtual object being defeated by the target attack operation, or the target animation can be understood as, but is not limited to, the first execution interaction animation that is forced to be played.
[0189] Optionally, in this embodiment, the first trigger condition and / or the second trigger condition may be but is not limited to being determined by the second virtual object or the first virtual object itself. For example, with respect to the first virtual object, a first attribute may be set, and the first attribute is used to reduce the difficulty of judging the first trigger condition and / or the second trigger condition; and with respect to the second virtual object, a second attribute may be set, and the first attribute is used to increase the difficulty of judging the first trigger condition and / or the second trigger condition.
[0190] It should be noted that, in response to a target attack instruction triggered on the first virtual object, target position information associated with the second virtual object is obtained, wherein the target attack instruction is used to instruct the first virtual object to perform a target attack operation, the second virtual object and the first virtual object are in different camps, and the target position information is used to indicate the position information of the second virtual object relative to the first virtual object; when the target position information satisfies the first trigger condition, ray detection is performed on the area between the first virtual object and the second virtual object to obtain a target detection result, wherein the target detection result is a detection result of an obstacle between the first virtual object and the second virtual object; when the target detection result satisfies the second trigger condition, a target animation is played, wherein the target animation includes a picture of the first virtual object performing a target attack operation on the second virtual object, and a picture of the second virtual object being defeated by the target attack operation.
[0191] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling a virtual object, which will not be described in detail in this example.
[0192] Through the embodiments provided by the present application, in response to a target attack instruction triggered on a first virtual object, target position information associated with a second virtual object is obtained, wherein the target attack instruction is used to instruct the first virtual object to perform a target attack operation, the second virtual object and the first virtual object are in different camps, and the target position information is used to indicate the position information of the second virtual object relative to the first virtual object; when the target position information meets the first trigger condition, ray detection is performed on the area between the first virtual object and the second virtual object to obtain a target detection result, wherein the target detection result is a detection result of an obstacle between the first virtual object and the second virtual object; when the target detection result meets the second trigger condition, the target motion is played. The target animation includes a picture of the first virtual object performing a target attack operation on the second virtual object, and a picture of the second virtual object being defeated by the target attack operation. In the process of judging whether the trigger condition is met after responding to the target attack instruction, the target position information with a smaller amount of calculation is first judged, and then the detection result of the obstacle with a larger amount of calculation is judged. In this way, if the judgment result of the target position information is not satisfied, there is no need to pay a larger amount of calculation to judge whether the detection result of the obstacle is satisfied, thereby saving a lot of computing resources, thereby achieving the purpose of improving the utilization rate of computing resources in the control process of virtual objects, thereby achieving the technical effect of improving the control efficiency of virtual objects.
[0193] As an optional solution, the obtaining unit 1302 includes:
[0194] A first acquisition module, used to acquire relative distance information, wherein the relative distance information is used to represent the relative distance between the second virtual object and the first virtual object;
[0195] A second acquisition module, configured to acquire target height information when the relative distance information satisfies the first trigger sub-condition, wherein the target height information is used to represent a height difference between the second virtual object and the first virtual object;
[0196] The third acquisition module is used to acquire target angle information when the target height information satisfies the second trigger sub-condition, wherein the target angle information is information associated with the field of view angle of the second virtual object and / or the first virtual object, and the first trigger condition includes that the target angle information satisfies the third trigger sub-condition.
[0197] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling a virtual object, which will not be described in detail in this example.
[0198] As an optional solution, the first acquisition module includes:
[0199] A first determination submodule, used to determine a plurality of first position points associated with a first virtual object;
[0200] A second determination submodule, used to determine a plurality of second position points associated with a second virtual object;
[0201] A first acquisition submodule is used to acquire M relative distances between each first position point among the plurality of first position points and each second position point among the plurality of second position points, where M is a natural number;
[0202] The second acquisition submodule is used to acquire the minimum relative distance among the M relative distances, wherein the relative distance information includes the minimum relative distance, and the first trigger subcondition includes that the minimum relative distance is less than or equal to a first threshold.
[0203] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling a virtual object, which will not be described in detail in this example.
[0204] As an optional solution, the second acquisition module includes:
[0205] A third determination submodule, used to determine a plurality of third position points associated with the first virtual object;
[0206] A fourth determination submodule, used to determine a plurality of fourth position points associated with the second virtual object;
[0207] A third acquisition submodule is used to acquire N relative height differences between each third position point among the plurality of third position points and each fourth position point among the plurality of fourth position points, where N is a natural number;
[0208] The fourth acquisition submodule is used to acquire the maximum relative height difference among N relative height differences, wherein the target height information includes the maximum relative height difference, and the second trigger subcondition includes that the maximum relative height difference is less than or equal to a second threshold.
[0209] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling a virtual object, which will not be described in detail in this example.
[0210] As an optional solution, the third acquisition module includes:
[0211] A fifth determining submodule, used to determine a field of view angle of the first virtual object;
[0212] The fifth acquisition submodule is used to acquire first angle information, wherein the first angle information is used to indicate whether the second virtual object is located in a first area range corresponding to the field of view angle of the first virtual object, and the third trigger subcondition includes the first angle information indicating that the second virtual object is located in the first area range.
[0213] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling a virtual object, which will not be described in detail in this example.
[0214] As an optional solution, the fifth acquisition submodule includes:
[0215] A first acquisition subunit, used to acquire a current orientation vector of the first virtual object;
[0216] A second acquisition subunit, used to acquire a position difference vector between the second virtual object and the first virtual object;
[0217] A first calculation subunit is used to calculate the angle between the current orientation vector and the position difference vector of the first virtual object to obtain a first target angle;
[0218] The third acquisition sub-unit is used to obtain a first angle comparison result between the field of view angle of the second virtual object and the first target angle, wherein the first angle information includes the first angle comparison result, and the third trigger sub-condition includes the first angle comparison result indicating that the first target angle is less than or equal to the field of view angle of the first virtual object.
[0219] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling a virtual object, which will not be described in detail in this example.
[0220] As an optional solution, the third acquisition module includes:
[0221] A sixth determination submodule, used to determine a field of view angle of a second virtual object;
[0222] The sixth acquisition submodule is used to acquire second angle information, wherein the second angle information is used to determine whether the first virtual object is located in a second area range corresponding to the field of view angle of the second virtual object, and the third trigger subcondition includes that the second angle information indicates that the first virtual object is located outside the second area range.
[0223] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling a virtual object, which will not be described in detail in this example.
[0224] As an optional solution, the sixth acquisition submodule includes:
[0225] A fourth acquisition subunit, used to acquire a current orientation vector of the second virtual object;
[0226] a fifth acquisition subunit, configured to acquire a position difference vector between the second virtual object and the first virtual object;
[0227] A second calculation subunit is used to calculate the angle between the current orientation vector and the position difference vector of the second virtual object to obtain a second target angle;
[0228] The sixth acquisition subunit is used to obtain a second angle comparison result between the field of view angle of the second virtual object and the second target angle, wherein the second angle information includes the second angle comparison result, and the third trigger subcondition includes that the second angle comparison result indicates that the second target angle is greater than the field of view angle of the second virtual object.
[0229] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling a virtual object, which will not be described in detail in this example.
[0230] As an optional solution, the detection unit 1304 includes:
[0231] A first determining module, configured to determine a first contact point between the first virtual object and the target area, and a second contact point between the second virtual object and the target area, when the first virtual object and the second virtual object are located on the target area;
[0232] The second determination module is used to emit one or more rays from the first contact point to the second contact point, and detect obstacles that collide with the one or more rays to obtain a target detection result.
[0233] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling a virtual object, which will not be described in detail in this example.
[0234] As an optional solution, the device also includes:
[0235] A first trigger unit is configured to trigger a target attack instruction when a selection operation on the first virtual button is obtained, the target position information satisfies a first trigger condition, and the target detection result satisfies a second trigger condition; or,
[0236] a second triggering unit, configured to trigger a target operation instruction when a selection operation on the first virtual button is obtained and the target position information does not satisfy a first triggering condition, wherein the target operation instruction is used to instruct the first virtual object to perform a target operation; or
[0237] The third trigger unit is used to trigger the target operation instruction when a selection operation on the first virtual button is obtained and the target position information meets the first trigger condition, but the target detection result does not meet the second trigger condition.
[0238] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling a virtual object, which will not be described in detail in this example.
[0239] As an optional solution, the device also includes:
[0240] a fourth trigger unit, configured to trigger a target attack instruction when a selection operation on the second virtual button is obtained, the target position information satisfies the first trigger condition, and the target detection result satisfies the second trigger condition; or,
[0241] a fifth triggering unit, configured to, when a selection operation on the second virtual button is obtained and the target position information does not satisfy the first triggering condition, not trigger any instruction; or,
[0242] The sixth trigger unit is used to not trigger any instruction when a selection operation on the second virtual button is obtained and the target position information meets the first trigger condition, but the target detection result does not meet the second trigger condition.
[0243] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling a virtual object, which will not be described in detail in this example.
[0244] As an optional solution, the target location information includes at least one of the following:
[0245] Relative distance information, wherein the relative distance information is used to indicate a relative distance between the second virtual object and the first virtual object;
[0246] Target height information, wherein the target height information is used to represent a height difference between the second virtual object and the first virtual object;
[0247] Target angle information, wherein the target angle information is information associated with the field of view angle of the second virtual object and / or the first virtual object.
[0248] According to another aspect of the embodiments of the present invention, an electronic device for implementing the above-mentioned virtual object control method is also provided. Fig.14 As shown, the electronic device includes a memory 1402 and a processor 1404. The memory 1402 stores a computer program, and the processor 1404 is configured to execute the steps in any of the above method embodiments through the computer program.
[0249] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0250] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0251] S1, in response to a target attack instruction triggered on a first virtual object, obtaining target position information associated with a second virtual object, wherein the target attack instruction is used to instruct the first virtual object to perform a target attack operation, the second virtual object and the first virtual object are in different camps, and the target position information is used to indicate position information of the second virtual object relative to the first virtual object;
[0252] S2, when the target position information satisfies the first trigger condition, performing ray detection on the area between the first virtual object and the second virtual object to obtain a target detection result, wherein the target detection result is a detection result of an obstacle between the first virtual object and the second virtual object;
[0253] S3, when the target detection result meets the second trigger condition, playing the target animation, wherein the target animation includes a picture of the first virtual object performing a target attack operation on the second virtual object, and a picture of the second virtual object being defeated by the target attack operation.
[0254] Alternatively, a person skilled in the art may understand that: Fig.14 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Fig.14 The structure of the electronic device is not limited. Fig.14 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig.14 Different configurations are shown.
[0255] Among them, the memory 1402 can be used to store software programs and modules, such as the program instructions / modules corresponding to the control method and device of the virtual object in the embodiment of the present invention. The processor 1404 executes various functional applications and data processing by running the software programs and modules stored in the memory 1402, that is, realizing the control method of the virtual object mentioned above. The memory 1402 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1402 may further include a memory remotely arranged relative to the processor 1404, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 1402 can be specifically, but not limited to, used to store information such as target location information, target detection results, and target animations. As an example, if Fig.14As shown, the memory 1402 may include, but is not limited to, the acquisition unit 1302, the detection unit 1304, and the playback unit 1306 in the control device of the virtual object. In addition, it may also include, but is not limited to, other module units in the control device of the virtual object, which will not be repeated in this example.
[0256] Optionally, the transmission device 1406 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 1406 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 1406 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0257] In addition, the electronic device further includes: a display 1408 for displaying the target position information, target detection results, target animation and other information; and a connection bus 1410 for connecting various module components in the electronic device.
[0258] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P) network, and any form of computing device, such as a server, terminal or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0259] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions provided by the embodiments of the present application are executed.
[0260] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0261] It should be noted that the computer system of the electronic device is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0262] The computer system includes a central processing unit (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) or the program loaded from the storage part to the random access memory (RAM). In the random access memory, various programs and data required for system operation are also stored. The central processing unit, the read-only memory and the random access memory are connected to each other through a bus. The input / output interface (I / O interface) is also connected to the bus.
[0263] The following components are connected to the input / output interface: an input part including a keyboard, a mouse, etc.; an output part including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part including a hard disk, etc.; and a communication part including a network interface card such as a local area network card, a modem, etc. The communication part performs communication processing via a network such as the Internet. A drive is also connected to the input / output interface as needed. Removable media, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive as needed so that the computer program read therefrom is installed into the storage part as needed.
[0264] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions defined in the system of the present application are executed.
[0265] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.
[0266] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0267] S1, in response to a target attack instruction triggered on a first virtual object, obtaining target position information associated with a second virtual object, wherein the target attack instruction is used to instruct the first virtual object to perform a target attack operation, the second virtual object and the first virtual object are in different camps, and the target position information is used to indicate position information of the second virtual object relative to the first virtual object;
[0268] S2, when the target position information satisfies the first trigger condition, performing ray detection on the area between the first virtual object and the second virtual object to obtain a target detection result, wherein the target detection result is a detection result of an obstacle between the first virtual object and the second virtual object;
[0269] S3, when the target detection result meets the second trigger condition, playing the target animation, wherein the target animation includes a picture of the first virtual object performing a target attack operation on the second virtual object, and a picture of the second virtual object being defeated by the target attack operation.
[0270] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0271] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0272] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention.
[0273] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0274] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0275] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0276] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0277] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for controlling a virtual object, characterized in that: include: In response to a target attack instruction triggered on a first virtual object, acquiring target position information associated with a second virtual object, wherein the target attack instruction is used to instruct the first virtual object to perform a target attack operation, the second virtual object and the first virtual object are in different camps, and the target position information is used to indicate position information of the second virtual object relative to the first virtual object; When the target position information satisfies a first trigger condition, a ray detection is performed on the area between the first virtual object and the second virtual object to obtain a target detection result, wherein the target detection result is a detection result of an obstacle between the first virtual object and the second virtual object; when the target detection result satisfies a second trigger condition, a target animation is played, wherein the target animation includes a screen in which the first virtual object performs the target attack operation on the second virtual object, and a screen in which the second virtual object is defeated by the target attack operation; The obtaining of target position information associated with the second virtual object includes: Acquire relative distance information, wherein the relative distance information is used to represent the relative distance between the second virtual object and the first virtual object; When the relative distance information satisfies the first trigger sub-condition, acquiring target height information, wherein the target height information is used to indicate a height difference between the second virtual object and the first virtual object; When the target height information satisfies the second trigger sub-condition, target angle information is obtained, wherein the target angle information is information associated with the field of view angle of the second virtual object and / or the first virtual object, and the first trigger condition includes that the target angle information satisfies the third trigger sub-condition.
2. The method according to claim 1, characterized in that The obtaining of relative distance information comprises: Determining a plurality of first position points associated with the first virtual object; Determining a plurality of second position points associated with the second virtual object; Obtaining M relative distances between each first position point in the plurality of first position points and each second position point in the plurality of second position points, where M is a natural number; Acquire a minimum relative distance among the M relative distances, wherein the relative distance information includes the minimum relative distance, and the first trigger subcondition includes that the minimum relative distance is less than or equal to a first threshold.
3. The method according to claim 1, characterized in that: The obtaining of target height information comprises: Determining a plurality of third position points associated with the first virtual object; determining a plurality of fourth position points associated with the second virtual object; Obtaining N relative height differences between each third position point in the plurality of third position points and each fourth position point in the plurality of fourth position points, where N is a natural number; Acquire a maximum relative height difference among the N relative height differences, wherein the target height information includes the maximum relative height difference, and the second trigger sub-condition includes that the maximum relative height difference is less than or equal to a second threshold.
4. The method according to claim 1, characterized in that: The obtaining of target angle information comprises: determining a field of view angle of the first virtual object; Obtain first angle information, wherein the first angle information is used to indicate whether the second virtual object is located in a first area range corresponding to the field of view angle of the first virtual object, and the third trigger subcondition includes that the first angle information indicates that the second virtual object is located in the first area range.
5. The method according to claim 4, characterized in that The obtaining of the first angle information includes: Obtaining a current orientation vector of the first virtual object; Acquire a position difference vector between the second virtual object and the first virtual object; Calculating an angle between a current orientation vector of the first virtual object and the position difference vector to obtain a first target angle; Obtain a first angle comparison result between the field of view angle of the second virtual object and the first target angle, wherein the first angle information includes the first angle comparison result, and the third trigger sub-condition includes that the first angle comparison result indicates that the first target angle is less than or equal to the field of view angle of the first virtual object.
6. The method according to claim 1, characterized in that The obtaining of target angle information comprises: determining a field of view angle of the second virtual object; Obtain second angle information, wherein the second angle information is used to determine whether the first virtual object is located in a second area range corresponding to the field of view angle of the second virtual object, and the third trigger sub-condition includes that the second angle information indicates that the first virtual object is located outside the second area range.
7. The method according to claim 6, characterized in that The acquiring the second angle information includes: Obtaining a current orientation vector of the second virtual object; Acquire a position difference vector between the second virtual object and the first virtual object; Calculating the angle between the current orientation vector of the second virtual object and the position difference vector to obtain a second target angle; Obtain a second angle comparison result between the field of view angle of the second virtual object and the second target angle, wherein the second angle information includes the second angle comparison result, and the third trigger sub-condition includes that the second angle comparison result indicates that the second target angle is greater than the field of view angle of the second virtual object.
8. The method according to any one of claims 1 to 7, characterized in that The performing ray detection on the area between the first virtual object and the second virtual object to obtain a target detection result includes: When the first virtual object and the second virtual object are located on a target area, determining a first contact point between the first virtual object and the target area, and a second contact point between the second virtual object and the target area; One or more rays are emitted from the first contact point to the second contact point, and obstacles colliding with the one or more rays are detected to obtain the target detection result.
9. The method according to any one of claims 1 to 7, characterized in that The method further comprises: When a selection operation on the first virtual button is obtained, and the target position information satisfies the first trigger condition, and the target detection result satisfies the second trigger condition, triggering the target attack instruction; or, When a selection operation on the first virtual button is obtained and the target position information does not meet the first trigger condition, triggering a target operation instruction, wherein the target operation instruction is used to instruct the first virtual object to perform a target operation; or When a selection operation on the first virtual button is obtained and the target position information meets the first trigger condition, but the target detection result does not meet the second trigger condition, the target operation instruction is triggered.
10. The method according to any one of claims 1 to 7, characterized in that The method further comprises: When a selection operation on the second virtual button is obtained, and the target position information satisfies the first trigger condition, and the target detection result satisfies the second trigger condition, triggering the target attack instruction; or, When a selection operation on the second virtual button is obtained and the target position information does not meet the first trigger condition, no instruction is triggered; or, When a selection operation on the second virtual button is obtained and the target position information meets the first trigger condition, but the target detection result does not meet the second trigger condition, none of the instructions is triggered.
11. The method according to any one of claims 1 to 7, characterized in that The target location information includes at least one of the following: Relative distance information, wherein the relative distance information is used to indicate the relative distance between the second virtual object and the first virtual object; target height information, wherein the target height information is used to represent a height difference between the second virtual object and the first virtual object; Target angle information, wherein the target angle information is information associated with the field of view angle of the second virtual object and / or the first virtual object.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 11 when executed.
13. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method described in any one of claims 1 to 11 are implemented.
14. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 11 through the computer program.
Citation Information
Patent Citations
Animation playing method and device based on virtual environment, equipment and medium
CN111330278A
Game live broadcast control method and device
CN111773702A
