Methods, devices, electronic equipment, and computer media for detecting hits in attack behaviors

By converting the intersection determination of some ball attack boxes and hit points in 3D games into geometric analysis in three-dimensional space, the computational overhead and accuracy problems of attack behavior hit detection are solved, making it suitable for high-speed moving character scenes.

CN116196627BActive Publication Date: 2026-05-26NETEASE (HANGZHOU) NETWORK CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NETEASE (HANGZHOU) NETWORK CO LTD
Filing Date
2023-03-02
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing technologies for attack detection in 3D games have high computational costs and inaccurate results, especially when characters are moving at high speeds, they are prone to missing certain targets.

Method used

By converting the intersection determination of a partial ball attack box with the hit point into the intersection calculation of the moving line segment of the partial ball and the hit point in three-dimensional space, the intersection angle interval is calculated using geometric analysis methods, and the interval is compared with the attack angle interval of the partial ball attack box to determine whether the attack behavior hits.

Benefits of technology

It achieves accurate detection of attack behavior in high-speed character movement scenarios, reduces computational overhead, is applicable to various gaming devices and scenarios, and the calculation process is simple and easy to understand.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116196627B_ABST
    Figure CN116196627B_ABST
Patent Text Reader

Abstract

This disclosure relates to a method, apparatus, electronic device, and computer-readable medium for detecting the hit of an attack, belonging to the field of data processing technology. The method includes: acquiring a partial ball attack box corresponding to the attacker, and obtaining a moving line segment of the hit point based on the moving direction of the partial ball attack box and the moving direction of the hit point corresponding to the target; acquiring the intersection angle interval corresponding to the intersection line segment between the moving line segment of the hit point and the complete sphere containing the partial ball attack box; determining whether the moving line segment of the hit point intersects with the partial ball attack box based on the intersection angle interval and the attack angle interval corresponding to the partial ball attack box; if they intersect, determining that the attacker's attack has hit the target. This disclosure transforms the problem of determining the intersection between the partial ball attack box and the hit point into a geometric problem of calculating the intersection of the moving line segment of the partial ball and the hit point, which can accurately determine whether the attacker's attack has hit the target and reduce computational overhead.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing technology, and more specifically, to a method for detecting the hit of an attack, a device for detecting the hit of an attack, an electronic device, and a computer-readable medium. Background Technology

[0002] To enhance the playability and fun of 3D (three-dimensional space) games, players or AI (Artificial Intelligence)-controlled characters can launch attacks on other characters. Successful attacks provide players with strong feedback and a rich gaming experience through visual (attack hit animations and effects), auditory (attack hit sound effects), and tactile (device vibration upon hit) feedback. Since different characters in the game are typically in different states (such as moving, jumping, etc.), rules need to be defined to determine whether an attack will successfully hit the target.

[0003] In most games, to ensure that attack hit detection aligns with players' everyday understanding, the hit condition is usually that the attacker's attack area covers the affected area of ​​the target. Therefore, game designers introduced the concepts of attack box and hit point, determining whether an attack hit by detecting whether these two points spatially intersect at the current moment. However, current intersection detection algorithms are time-consuming and inaccurate for game scenarios with fast-moving characters.

[0004] Therefore, there is an urgent need in this field for a hit detection method for attack behavior that can accurately determine whether the attacker's attack behavior has hit the target and reduce computational overhead.

[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0006] The purpose of this disclosure is to provide a method, device, electronic device, and computer-readable medium for detecting the hit of an attack, thereby enabling, at least to a certain extent, accurate determination of whether the attacker's attack has hit the target and reducing computational overhead.

[0007] According to the first aspect of this disclosure, a hit detection method for attack behavior is provided, comprising:

[0008] Obtain the partial ball attack box corresponding to the attacker, and based on the movement direction of the partial ball attack box and the movement direction of the hit point corresponding to the victim, obtain the movement line segment of the hit point in the current frame, wherein the partial ball attack box is used to represent the attack range of the attacker.

[0009] Obtain the intersection angle range corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located;

[0010] Based on the intersection angle range and the attack angle range corresponding to the partial ball attack box, determine whether the moving line segment of the hit point intersects with the partial ball attack box;

[0011] If the moving line segment of the hit point intersects with the partial ball attack box, it is determined that the attacker's attack has hit the hit party.

[0012] According to a second aspect of this disclosure, a hit detection device for attack behavior is provided, comprising:

[0013] The moving line segment acquisition module is used to acquire the partial ball attack box corresponding to the attacker, and obtain the moving line segment of the hit point according to the moving direction of the partial ball attack box and the moving direction of the hit point corresponding to the hit party, wherein the partial ball attack box is used to represent the attack range of the attacker.

[0014] Angle range acquisition module is used to acquire the intersection angle range corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located;

[0015] The line segment intersection detection module is used to determine whether the moving line segment of the hit point intersects with the partial ball attack box based on the intersection angle range and the attack angle range corresponding to the partial ball attack box.

[0016] The attack hit determination module is used to determine that the attacker's attack has hit the target if the moving line segment of the hit point intersects with the partial ball attack box.

[0017] According to a third aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform a hit detection method for any of the aforementioned attack behaviors by executing the executable instructions.

[0018] According to a fourth aspect of this disclosure, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements a hit detection method for any of the attack behaviors described above.

[0019] The exemplary embodiments disclosed herein can have the following beneficial effects:

[0020] In the attack behavior hit detection method of this exemplary embodiment, the problem of determining the intersection between a partial ball attack box and the hit point is transformed into the problem of calculating the intersection of the moving line segment of the partial ball and the hit point in three-dimensional space by adopting a continuous thinking approach. The intersection angle interval corresponding to the intersection line segment between the moving line segment of the hit point in the current frame and the complete sphere containing the partial ball attack box is calculated using geometric analysis. Finally, by comparing whether this intersection angle interval intersects with the attack angle interval of the partial ball attack box itself, it is determined whether there is an intersection between the moving line segment of the hit point and the partial ball attack box, thereby determining whether the attacker's attack behavior has hit the hit party. The attack behavior hit detection method in this exemplary embodiment, on the one hand, considers the sweeping range of the partial ball attack box and the hit point between each frame by adopting a continuous thinking approach, thus avoiding the problem of missed intersection detection, and is suitable for game scenarios where characters move at high speeds. On the other hand, intersection determination can be completed solely through geometric analysis, without introducing additional interpolation logic, resulting in low computational overhead and applicability to various gaming devices and application scenarios. Furthermore, the problem of calculating the intersection of a portion of the spheres in the transformed 3D space with the line segment of the moving point of the impact point involves only regular geometry within the scene, making the calculation process simple and easy to understand. Additionally, accurate spatial geometric calculations can theoretically prove the correctness and accuracy of the solution.

[0021] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0022] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0023] Figure 1 A schematic diagram of part of the ball attack box is shown;

[0024] Figure 2 The diagram illustrates the timed detection of attack behavior.

[0025] Figure 3 A flowchart illustrating a hit detection method for attack behavior according to an exemplary embodiment of this disclosure is shown.

[0026] Figure 4 A schematic diagram of the process of performing intersection detection before obtaining the intersection angle range in an exemplary embodiment of the present disclosure is shown;

[0027] Figure 5A flowchart illustrating a method for determining whether a moving line segment at the point of impact intersects with a complete sphere is shown in an exemplary embodiment of this disclosure.

[0028] Figure 6 A flowchart illustrating a sample embodiment of this disclosure is shown, illustrating the process of determining whether a moving line segment at the point of impact intersects with a portion of the ball-attacking box.

[0029] Figure 7 A flowchart illustrating the process of determining whether there is an overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to the partial ball attack box in an exemplary embodiment of this disclosure is shown.

[0030] Figure 8 The diagram illustrates a first angle range determination scenario according to a specific embodiment of the present disclosure.

[0031] Figure 9 A schematic diagram illustrating a second angle range determination according to a specific embodiment of the present disclosure is shown.

[0032] Figure 10 A schematic diagram illustrating a third angle interval determination according to a specific embodiment of the present disclosure is shown.

[0033] Figure 11 A schematic diagram illustrating a fourth angle interval determination according to a specific embodiment of the present disclosure is shown.

[0034] Figure 12 A flowchart illustrating a hit detection method for attack behavior according to a specific embodiment of the present disclosure is shown;

[0035] Figure 13 A block diagram of a hit detection apparatus for attack behavior according to an exemplary embodiment of this disclosure is shown;

[0036] Figure 14 A schematic diagram of the structure of a computer system suitable for implementing the embodiments of the present disclosure is shown. Detailed Implementation

[0037] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more of the specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.

[0038] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0039] 3D games typically run on computer devices such as personal computers, mobile phones, and game consoles (Xbox, PlayStation). The CPU (Central Processing Unit) within a computer usually executes programs running on the machine at regular time intervals. Therefore, as a special type of program within 3D games, all game logic (such as attack actions) is executed at fixed time intervals. This time interval is called the frame interval and is usually set to a fixed value (e.g., 1 / 30th of a second). Game designers assign a hit detection period to attack actions. Within this time interval, if the attack box and the hit point intersect, a hit is considered successful. This intersection detection, like other game logic, is also executed at frame intervals. Because the position and orientation of characters in 3D games can change at any time, the attack box bound to the attacker and the hit point of the receiver can also change drastically within a single frame interval.

[0040] Without angular limitations and only specifying the attack radius, the attack box would be a sphere centered at the attacker's location. However, this would allow the attacker to hit the target behind them, which generally contradicts player intuition. Therefore, an angular limitation needs to be added to the radius. Game designers typically define a sector with a certain radius and angular range as a simplified attack box area. In 3D games, this sector expands to a portion of a sphere defined by a certain angular range in 3D space, often simply called a partial sphere attack box, such as... Figure 1 As shown, since characters in 3D games may be constantly moving, the hit detection for attack actions ultimately transforms into the intersection detection of the attack box and the hit point of a moving ball. The main execution time overhead of attack action detection in the game is concentrated in the intersection detection of the attack box and the hit point.

[0041] In some related embodiments, the methods for detecting and determining the intersection between a ball attack box and the point of impact may include the following:

[0042] 1. Regular testing

[0043] This method updates the facing and center position of a portion of the ball's attack box, as well as the position of the hit point, based on the attacker's position and orientation, and the hit point's position during each frame interval. It then calculates whether the hit point is inside the portion of the ball. There are two methods for this calculation.

[0044] One approach is to represent the partial ball and the point of impact in a Cartesian coordinate system. First, calculate the distance from the point of impact to the center of the partial ball. Then, calculate the angle between the line connecting the point of impact and the center of the ball and the direction the partial ball faces. If the distance is less than the radius of the partial ball and the angle is within the sector angle range of the partial ball, then the point of impact and the partial ball can be considered to intersect.

[0045] One approach is to represent part of the sphere and the point of impact using polar coordinates. A polar coordinate system is a coordinate system in a plane consisting of a pole, polar axis, and polar radius. Spheres and points naturally fit within polar coordinates. Part of the sphere can be represented by a polar coordinate equation where the radius is a fixed value and the angle of the sphere facing forward in three dimensions is within a certain range. The point of impact, on the other hand, is represented by a polar coordinate equation where both the radius and the three-dimensional orientation are fixed values. By calculating whether solutions exist for the two polar coordinate equations, it can be determined whether the part of the sphere and the point of impact intersect.

[0046] For scenarios where in-game character movement speed is not too fast and the positional changes of the attacker and the attacked between adjacent frames are negligible relative to the size of some ball attack boxes, this is a simplified algorithm that does not guarantee completely accurate results. For scenarios where characters may move at high speeds, this method can lead to serious omissions in attack detection.

[0047] like Figure 2As shown, sector 201 represents a projection of part of the ball attack box. If the hit target is in a non-intersecting position in front of the part of the ball attack box in the previous frame (position 202), and then moves to behind the part of the ball attack box in the next frame (position 203), this method will directly determine that they do not intersect in the intersection determination between these two frames. However, the actual result is simply that the hit target moves a relatively long distance within one frame. Since the hit determination of attack behavior is a crucial part of the player experience in the game, this inaccurate method has significant limitations in its applicability.

[0048] 2. Timed interpolation detection

[0049] This method records the positions of a portion of the ball and the hit point after each frame's intersection detection. At the start of each frame's intersection determination, it calculates the interpolated positions of the portion of the ball and the hit point at several interpolation moments using linear interpolation, combining the positions of the portion of the ball and the hit point from the previous and current frames. Combining the two calculation methods mentioned in the timing detection method, it determines whether the portion of the ball and the hit point intersect at these interpolated positions. As long as one interpolation intersection determination passes, the hit determination is considered successful.

[0050] Timed interpolation detection is an improved version of the timed detection method. By performing multiple interpolations, the positional changes of some balls hitting the box and the point of impact between each interpolation are reduced, alleviating the problem of missed judgments in the timed detection method.

[0051] However, multiple interpolations cannot guarantee that the positional change between two interpolations will be small enough to be negligible. For example, if the target moves fast enough, even with multiple interpolations, the point of impact might cross from one end of the ball to the other between two interpolations without being detected by the algorithm, which would still consider them non-intersecting. Furthermore, the introduction of multiple interpolations increases the computational cost of intersection detection per frame by N times (N being the number of interpolations) compared to timed detection algorithms, resulting in significant algorithm execution time overhead. Therefore, this method reduces the possibility of missed detections at the cost of additional performance overhead, making it unsuitable for some high-performance gaming devices.

[0052] 3. Fixed hit point, attack box movement detection

[0053] From the player's perspective, the movement trajectories of the attacker and the attacked are continuous over a period of time. Both of the methods mentioned above aim to divide the character's movement into several fixed moments in a discrete manner, assuming that while the character's position may differ within those moments, it remains unchanged between adjacent moments. The difference lies in how finely the time-interpolation detection method breaks down the character's movement time.

[0054] The third method assumes that the character's movement between two frames is continuous. By calculating whether the two swept spatial ranges formed in 3D space due to the positional changes of a part of the ball attacking the box and the point of impact between the two frames intersect, it is possible to accurately determine whether the two intersect between the two frames. For example, the spatial range formed by a point and a ball in 3D space due to positional changes is a line segment and a capsule, respectively.

[0055] To simplify the calculation process, one of the two geometric objects involved in the intersection detection is usually fixed in position, and its movement vector within the two frames is superimposed onto the other geometric object in reverse order. Taking a partial ball and the hit point as an example, point calculation in 3D space is generally relatively simple, so the hit point's position is fixed. Assuming the hit point's movement vector between the two frames is V, then a movement vector of -V is applied to the partial ball, and then it is determined whether the spatial region swept by the partial ball intersects with the hit point.

[0056] While this method can solve the problem of detection omissions in the two methods mentioned above, the calculation process of whether the impact point is within the swept area is rather obscure and difficult to understand intuitively because the range swept by some balls in 3D space is not a common standard geometry. The computational load is also relatively large compared to the timed detection method.

[0057] Based on the above analysis, this disclosure aims to solve the problem of detecting the intersection between the moving ball attack box and the hit point in 3D game attack behavior, and to meet the following requirement in the 3D game development process: the position and orientation of the ball attack box bound to the attacker and the hit point of the receiver may change at any time. Within the hit determination time interval of the attack behavior, a certain algorithm can be run every frame to calculate all the intersection situations between the ball attack box and the hit point, thereby solving the important function of whether the attack behavior in 3D game hits the target.

[0058] This example implementation first provides a method for detecting the hit of an attack. (See reference...) Figure 3 As shown, the hit detection method for the above-mentioned attack behavior may include the following steps:

[0059] Step S310. Obtain the partial ball attack box corresponding to the attacker, and based on the movement direction of the partial ball attack box and the movement direction of the hit point corresponding to the receiver, obtain the movement line segment of the hit point in the current frame.

[0060] Among them, some ball attack boxes are used to indicate the attack range of the attacking side.

[0061] Step S320. Obtain the intersection angle range corresponding to the intersection line segment between the moving line segment of the hit point and the complete sphere where part of the ball attack box is located.

[0062] Step S330. Based on the intersection angle range and the attack angle range corresponding to the partial ball attack box, determine whether the moving line segment of the hit point intersects with the partial ball attack box.

[0063] Step S340. If the moving line segment of the hit point intersects with part of the ball attack box, it is determined that the attacking party's attack has hit the hit party.

[0064] In the attack behavior hit detection method of this exemplary embodiment, the problem of determining the intersection between a partial ball attack box and the hit point is transformed into the problem of calculating the intersection of the moving line segment of the partial ball and the hit point in three-dimensional space by adopting a continuous thinking approach. The intersection angle interval corresponding to the intersection line segment between the moving line segment of the hit point in the current frame and the complete sphere containing the partial ball attack box is calculated using geometric analysis. Finally, by comparing whether this intersection angle interval intersects with the attack angle interval of the partial ball attack box itself, it is determined whether there is an intersection between the moving line segment of the hit point and the partial ball attack box, thereby determining whether the attacker's attack behavior has hit the hit party. The attack behavior hit detection method in this exemplary embodiment, on the one hand, considers the sweeping range of the partial ball attack box and the hit point between each frame by adopting a continuous thinking approach, thus avoiding the problem of missed intersection detection, and is suitable for game scenarios where characters move at high speeds. On the other hand, intersection determination can be completed solely through geometric analysis, without introducing additional interpolation logic, resulting in low computational overhead and applicability to various gaming devices and application scenarios. Furthermore, the problem of calculating the intersection of a portion of the spheres in the transformed 3D space with the line segment of the moving point of the impact point involves only regular geometry within the scene, making the calculation process simple and easy to understand. Additionally, accurate spatial geometric calculations can theoretically prove the correctness and accuracy of the solution.

[0065] Below, in conjunction with Figures 4 to 11 The steps described above in this example implementation will be explained in more detail.

[0066] In step S310, the partial ball attack box corresponding to the attacker is obtained, and the moving line segment of the hit point in the current frame is obtained according to the moving direction of the partial ball attack box and the moving direction of the hit point corresponding to the victim.

[0067] In this example implementation, the attacker refers to a character in the game who actively initiates an attack, and the victim refers to a character in the game who is attacked by other characters. A character refers to a game unit, which typically includes behaviors such as movement, attack, and being hit. The hit point refers to a point in the game that simplifies the victim's position to the same location as the victim's current position when determining whether the victim has been hit, thereby reducing the complexity of the game's decision-making logic.

[0068] In 3D games, when a character initiates an attack, it's necessary to check whether the target will be hit. To represent the range of the attacker's attack, a geometry of a certain size containing 3D position and orientation can be created while checking if the attack hits the target; this geometry is called the attack box. By adding certain angle constraints, a partial ball attack box can be obtained to represent the attacker's attack range.

[0069] In this example implementation, to simplify the calculation, some of the ball attack boxes in the current frame can remain stationary, and the hit point, in addition to its own movement, moves in the opposite direction to the movement direction of some of the ball attack boxes, forming a movement line segment of the hit point in the current frame.

[0070] For ease of explanation, let's assume that 3D games use a left-handed Cartesian coordinate system. A Cartesian coordinate system is defined as follows: passing through a fixed point O, three mutually perpendicular number axes are drawn, all with O as the origin and generally having the same unit of length. These three axes are called the x-axis (horizontal axis), y-axis (vertical axis), and z-axis (vertical axis). A left-handed coordinate system is a Cartesian coordinate system where the direction determined by the right-hand rule from X to Y is opposite to the direction of the Z-axis.

[0071] In this example implementation, the position of a point in space is assumed to be represented by P plus a subscript, which is a three-dimensional vector. The direction is represented by V plus a subscript. Assume the previous frame positions of the center of the partial ball attack box and the hit point are Ps1 and Pp1, and the next frame positions are Ps2 and Pp2. The radius of the partial ball attack box is radius. Therefore, the movement direction of the partial ball attack box is Vs_move = Ps2 – Ps1. To simplify the calculation, the partial ball attack box remains stationary, and the hit point, in addition to its own movement, moves in the opposite direction of Vs_move, forming a line segment:

[0072] Vp_move = -Vs_move + Pp2 – Pp1

[0073] The starting point of the line segment is Pp1.

[0074] In step S320, the intersection angle range corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where part of the ball attack box is located is obtained.

[0075] In this example implementation, after obtaining the moving line segment of the impact point, it is necessary to determine whether there is an intersection between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located. If there is an intersection, the intersection angle range corresponding to the intersecting line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located is obtained.

[0076] In this example implementation, such as Figure 4 As shown, obtaining the intersection angle range corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where part of the ball attacks the box can specifically include the following steps:

[0077] Step S410. Determine whether the moving line segment of the hit point intersects with the complete sphere where part of the ball attack box is located.

[0078] In this example implementation, such as Figure 5 As shown, determining whether the moving line segment of the impact point intersects with the complete sphere containing part of the ball's attack box can specifically include the following steps:

[0079] Step S510. Determine whether the line segment on which the point of impact moves intersects with the complete sphere on which part of the ball attacks the box.

[0080] First, calculate the length of the moving line segment Vp_move:

[0081] len_seg = Vp_move.length()

[0082] The normalized length of the moving line segment is:

[0083] Vp_move = Vp_move.normalize()

[0084] The length of a vector is calculated using the `length` keyword, and the vector length is normalized using the `normalize` interface. Next, the vector from the starting point of the partial ball to the starting point of the moving line segment is calculated:

[0085] Vs_to_p=Ps1–Pp1

[0086] Then, the projection of Vs_to_p onto the direction of the moving line segment is obtained through vector dot product operation:

[0087] center_proj=Vs_to_p.dot(Vp_move)

[0088] The interface for calculating the vector inner product is dot.

[0089] Based on this, calculate the projection point of the sphere's center onto the direction of the moving line segment:

[0090] Ps_proj=Pp1+Vp_move*center_proj

[0091] And calculate the vector from the projection point to the center of the sphere:

[0092] Vs_proj_to_1=Ps1–Ps_proj

[0093] Finally, the distance from the point of intersection between the line segment where the point of impact is located and the complete sphere containing part of the ball attack box to the projection point is:

[0094] dist_square=radius*radius-Vs_proj_to_1.length*Vs_proj_to_1.length

[0095] If dist_square is less than 0, the line containing the moving segment of the hit point does not intersect the complete sphere containing the partial ball attack box.

[0096] Step S520. If the line segment on which the point of impact moves does not intersect the complete sphere in which the partial ball attack box is located, then it is determined that the line segment on which the point of impact moves does not intersect the partial ball attack box, and the attacking party's attack action did not hit the target.

[0097] If the line segment on which the point of impact moves does not intersect the complete sphere containing the partial ball attack box, then the line segment on which the point of impact moves also does not intersect the partial ball attack box. In this case, the intersection detection can be directly concluded, and the attacker's attack has failed to hit the target.

[0098] Step S530. If the line segment on which the point of impact moves intersects with the complete sphere where the partial ball attack box is located, then continue to determine whether the line segment on which the point of impact moves intersects with the complete sphere where the partial ball attack box is located.

[0099] If the line segment containing the moving point intersects the complete sphere containing the partial ball attack box (i.e., dist_square is greater than 0), then there is an intersection point between the moving line segment and the complete sphere. The expression dist = sqrt(dist_square) is calculated, where sqrt represents the square root. The directed distances from the two intersection points to the starting point of the moving line segment are as follows:

[0100] min_dist = center_proj – dist

[0101] max_dist = center_proj + dist

[0102] The conditions for determining whether a moving line segment intersects with a complete sphere are as follows:

[0103] ange_intersect=min_dist<=len_seg and max_dist>=0

[0104] If the range_intersect condition is not met, it means that the two intersection points are outside the moving line segment, and the moving line segment of the hit point does not intersect with the complete sphere where part of the ball attack box is located.

[0105] Step S420. If the moving line segment of the hit point does not intersect with the complete sphere where the partial ball attack box is located, it is determined that the moving line segment of the hit point does not intersect with the partial ball attack box, and the attacking party's attack behavior has not hit the hit party.

[0106] If the moving line segment of the hit point does not intersect with the complete sphere containing the partial ball attack box, then the moving line segment of the hit point also definitely does not intersect with the partial ball attack box. In this case, the intersection detection can be directly determined to be over, and the attacker's attack did not hit the hit party.

[0107] Step S430. If the moving line segment of the hit point intersects with the complete sphere where part of the ball attack box is located, then obtain the intersection angle range corresponding to the intersecting line segment between the moving line segment of the hit point and the complete sphere.

[0108] If the moving line segment of the hit point intersects with the complete sphere where part of the ball attack box is located, then the intersection determination between the moving line segment of the hit point and part of the ball attack box continues.

[0109] In this example implementation, when obtaining the intersection angle range corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located, the two intersection points corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located can be obtained first. Then, based on the included angle between the two intersection points and the target orientation of the partial ball attack box, the intersection angle range corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located can be obtained.

[0110] The directed distances from the starting point of the moving line segment to the two intersection points between the moving line segment and the complete sphere containing the partial ball attack box are as follows:

[0111] min_dist = max(min_dist, 0)

[0112] max_dist=min(max_dist,len_seg)

[0113] The interface for selecting the larger of the two numbers is max, and the interface for selecting the smaller of the two numbers is min.

[0114] The intersection point of the two is as follows:

[0115] min_pos=Pp1+Vp_move*min_dist

[0116] max_pos = Pp1 + Vp_move * max_dist

[0117] The included angles between the two intersection points and the forward direction of the partial sphere are respectively:

[0118] min_angle = get_angle_of_pos(Ps1, Vs_fwd, min_pos)

[0119] max_angle = get_angle_of_pos(Ps1, Vs_fwd, max_pos)

[0120] Among them, the get_angle_of_pos interface is used to calculate the included angle from the current position and the current orientation to the target position, and Vs_fwd is the forward orientation of the partial sphere. Therefore, the included angle range corresponding to the intersecting line segment is [min_angle, max_angle]. Since the value ranges of max_angle and min_angle are both from 0 to 360 degrees, it is necessary to convert the angle range to obtain a monotonically increasing angle range. It should be particularly noted that since max_angle and min_angle only represent the angle values corresponding to the two intersection points, the included angle between the two angles is the included angle range corresponding to the two intersection points, and there is no literal angle size relationship between max_angle and min_angle.

[0121] Continue to refer to Figure 3 As shown, in step S330, according to the included angle range and the attack angle range corresponding to the partial sphere attack box, it is determined whether the moving line segment of the hit point intersects with the partial sphere attack box.

[0122] In this exemplary embodiment, it is assumed that the attack angle range corresponding to the partial sphere attack box is from angle_1 to angle_2 (angle values), where -180 < angle_1 <= 0 and 0 <= angle_2 < 180. Determining whether the two angle ranges intersect means determining whether the two angle ranges [min_angle, max_angle] and [angle_1, angle_2] intersect.

[0123] In this exemplary embodiment, as Figure 6 shown, according to the included angle range and the attack angle range corresponding to the partial sphere attack box, determining whether the moving line segment of the hit point intersects with the partial sphere attack box may specifically include the following steps:

[0124] Step S610. Determine whether there is an overlapping angle range between the included angle range of the intersection and the attack angle range corresponding to the partial sphere attack box.

[0125] In this example implementation, such as Figure 7 As shown, determining whether there is an overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to some of the ball attack boxes can specifically include the following steps:

[0126] Step S710. Obtain the first critical angle value and the second critical angle value of the intersecting angle interval, and obtain the critical angle difference value based on the first critical angle value and the second critical angle value.

[0127] Assuming A is the angle range corresponding to the first critical angle value min_angle and the second critical angle value max_angle of the intersecting angle intervals, then the critical angle difference between the intersecting angle intervals is:

[0128] delta_angle=max_angle–min_angle

[0129] Meanwhile, assume that B is the angle range corresponding to angle_1 and angle_2.

[0130] Step S720. Based on the range of critical angle difference values, determine whether there is an overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to the partial ball attack box.

[0131] In this example implementation, the range of the critical angle difference can be divided into four ranges. Within different ranges, different judgment conditions can be used to determine whether there is an overlapping angle range between the intersecting angle interval and the attack angle interval corresponding to the partial ball attack box. If the range of the critical angle difference is within two preset ranges, i.e., the first and fourth angle interval judgment cases, then when the mutual circumference angle interval corresponding to the attack angle interval does not contain the intersecting angle interval, it is determined that there is an overlapping angle interval between the intersecting angle interval and the attack angle interval. Based on the value of delta_angle, it can be specifically divided into the following four cases:

[0132] (1). delta_angle <= 180 and delta_angle >= 0:

[0133] like Figure 8 The diagram illustrates the first type of angle interval determination. In this case, the angle range corresponding to A is [min_angle, max_angle]. This angle range does not pass through 0 degrees, therefore, they intersect if the following conditions are met:

[0134] res = ! (angle_1 + 360.0)<min_angle&&angle_2> max_angle)

[0135] Here, [angle_2, angle_1+360.0] is the complement of B, ! is the logical negation operation, and && is the logical AND operation. The result of the calculation corresponding to res is that the complement of B does not contain set A, in other words, B and A intersect.

[0136] (2). delta_angle <- 180.0:

[0137] like Figure 9 The diagram illustrates the second angle range determination scenario. In this case, the angle range of A is [min_angle, max_angle]. This range passes through 0 degrees, the value of max_angle is always less than min_angle, and the value of min_angle is always greater than 180 degrees. Therefore, subtracting 360 degrees from min_angle yields a more readable range representation of A: [min_angle - 360, max_angle]. Intersection occurs when the following conditions are met:

[0138] res = min_angle – 360<angle_2&&max_angle> angle_1.

[0139] (3). delta_angle > 180.0:

[0140] like Figure 10 The diagram illustrates the third angle range determination scenario. In this case, the angle range of A is [max_angle, min_angle]. This range passes through 0 degrees, and the value of max_angle is greater than 180 degrees. Therefore, subtracting 360 degrees from max_angle yields a more readable range representation of A: [max_angle - 360, min_angle]. Intersection occurs when the following condition is met:

[0141] res = max_angle - 360<angle_2&&min_angle> angle_1.

[0142] (4).delta_angle>=-180&&delta_angle<=0:

[0143] like Figure 11 The diagram illustrates the fourth angle range determination scenario. In this case, the angle range of A is [max_angle, min_angle], which does not pass through 0 degrees. Therefore, they intersect if the following conditions are met:

[0144] res = ! (angle_2)<max_angle&&angle_1+360.0> min_angle)

[0145] Here, [angle_2, angle_1+360.0] is the complement of B, and the result of the calculation corresponding to res is that the complement of B does not contain the set A, in other words, B and A intersect.

[0146] Step S620. If there is an overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to the partial ball attack box, then it is determined that the moving line segment of the hit point intersects with the partial ball attack box.

[0147] If the intersection angle interval between the moving line segment of the hit point and the complete sphere where the partial ball attack box is located overlaps with the attack angle interval corresponding to the partial ball attack box, then it is determined that the moving line segment of the hit point intersects with the partial ball attack box.

[0148] Step S630. If there is no overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to the partial ball attack box, then it is determined that the moving line segment of the hit point does not intersect with the partial ball attack box.

[0149] If the intersection angle interval between the moving line segment of the hit point and the complete sphere where the partial ball attack box is located does not overlap with the attack angle interval corresponding to the partial ball attack box, then it is determined that the moving line segment of the hit point and the partial ball attack box do not intersect.

[0150] Continue to refer to Figure 3 As shown, in step S340, if the moving line segment of the hit point intersects with part of the ball attack box, it is determined that the attacker's attack has hit the hit party.

[0151] In this example implementation, if it is determined that there is an intersection between the moving line segment of the hit point in the current frame and part of the ball attack box, it means that the attacker's attack behavior in the current frame hits the hit party.

[0152] like Figure 12 The diagram shown is a complete flowchart of an attack behavior hit detection method according to a specific embodiment of this disclosure, illustrating the above steps in this example embodiment. Assuming the 3D game uses a left-handed Cartesian coordinate system, the specific steps of the flowchart are as follows:

[0153] Step S1201. Calculate the direction of movement of the center of the partial ball.

[0154] The direction of movement of the center of part of the ball is Vs_move = Ps2 – Ps1.

[0155] Step S1202. Generate the moving line segment of the hit point.

[0156] To simplify the calculation, some of the balls remain stationary when hitting the target box. The point of impact, in addition to its own movement, moves in the opposite direction of Vs_move, forming a line segment: Vp_move = -Vs_move + Pp2 – Pp1. The starting point of the line segment is Pp1. Specifically, the previous frame positions of the center of some balls and the point of impact are Ps1 and Pp1, and the next frame positions are Ps2 and Pp2.

[0157] Step S1203. Calculate the length of the moving line segment.

[0158] The length of the moving line segment Vp_move is denoted as len_seg, and len_seg = Vp_move.length(). The normalized length of the line segment Vp_move is: Vp_move = Vp_move.normalize(), where the length of a vector is calculated using the `length` function, and the vector length is normalized using the `normalize` function.

[0159] Step S1204. Calculate the vector from the starting point of the partial ball to the starting point of the moving line segment.

[0160] The vector Vs_to_p from the starting point of the ball to the starting point of the moving line segment is Ps1–Pp1.

[0161] Step S1205. Calculate the projection point of the sphere's center in the direction of the moving line segment.

[0162] First, calculate the projection of Vs_to_p onto the direction of the moving line segment (using vector dot product):

[0163] center_proj=Vs_to_p.dot(Vp_move).

[0164] Then calculate the projection point of the sphere's center along the direction of the line segment:

[0165] Ps_proj=Pp1+Vp_move*center_proj.

[0166] Step S1206. Calculate the vector from the projection point to the center of the sphere.

[0167] The vector from the projection point to the center of the sphere is Vs_proj_to_1 = Ps1 – Ps_proj.

[0168] Step S1207. Determine whether the line containing the moving line segment intersects the complete sphere.

[0169] The distance from the point where the moving line segment intersects the complete sphere to the projection point is: dist_square = radius * radius - Vs_proj_to_1.length * Vs_proj_to_1.length.

[0170] The radius of the partial sphere is called radius. If dist_square is less than 0, the line containing the moving segment does not intersect the complete sphere, and the line segment and the partial sphere definitely do not intersect, ending the intersection detection. If the line containing the moving segment intersects the complete sphere, proceed to step S1208.

[0171] Step S1208. Calculate the directed distance between the intersection point and the starting point of the moving line segment.

[0172] If dist_square is greater than 0, then the line containing the moving segment intersects the complete sphere. Calculate dist = sqrt(dist_square), where sqrt represents the square root. The directed distances from the two intersection points to the starting point of the moving segment are:

[0173] min_dist = center_proj – dist

[0174] max_dist = center_proj + dist

[0175] Step S1209. Determine whether the moving line segment intersects with the complete sphere.

[0176] The criterion for determining whether a moving line segment intersects with a complete sphere is:

[0177] range_intersect=min_dist<=len_seg and max_dist>=0

[0178] If the `range_intersect` condition is not met, it means that the two intersection points are outside the moving line segment, and the moving line segment does not intersect the complete sphere. Therefore, the line segment and part of the sphere definitely do not intersect, and the intersection detection ends. If the moving line segment intersects the complete sphere, proceed to step S1210.

[0179] Step S1210. Calculate the positions of the two intersection points between the moving line segment and the complete sphere.

[0180] The directed distances of the two intersection points from the starting point of the moving line segment are respectively:

[0181] min_dist = max(min_dist, 0)

[0182] max_dist=min(max_dist,len_seg)

[0183] The intersection point of the two is as follows:

[0184] min_pos=Pp1+Vp_move*min_dist

[0185] max_pos = Pp1 + Vp_move * max_dist

[0186] Step S1211. Calculate the angles between the two intersection points and the forward direction of the partial sphere.

[0187] The angles between the two intersection points and the forward direction of the partial sphere are respectively:

[0188] min_angle = get_angle_of_pos(Ps1, Vs_fwd, min_pos)

[0189] max_angle = get_angle_of_pos(Ps1, Vs_fwd, max_pos)

[0190] Where the get_angle_of_pos interface is used to calculate the angle from the current position and the current orientation to the target position, and the forward direction of the partial sphere is Vs_fwd.

[0191] Step S1212. Determine whether the two angular ranges intersect.

[0192] The angular range of the partial sphere is from angle_1 to angle_2, where -180 < angle_1 <= 0 and 0 <= angle_2 < 180. Determining whether the two angular ranges intersect means determining whether the two angular ranges [min_angle, max_angle] and [angle_1, angle_2] intersect.

[0193] Let A be the angular range corresponding to min_angle and max_angle, and B be the angular range corresponding to angle_1 and angle_2.

[0194] delta_angle = max_angle – min_angle

[0195] According to the value of delta_angle, there are the following four cases:

[0196] (1). delta_angle <= 180 and delta_angle >= 0:

[0197] In this case, the angular range corresponding to A is [min_angle, max_angle], and this angular range does not pass through 0 degrees. Therefore, they intersect if the following condition is met:

[0198] res =!(angle_1 + 360.0 < min_angle && angle_2 > max_angle)

[0199] Here, [angle_2, angle_1+360.0] is the complement of B, ! is the logical negation operation, and && is the logical AND operation. The result of the calculation corresponding to res is that the complement of B does not contain set A, in other words, B and A intersect.

[0200] (2). delta_angle <- 180.0:

[0201] At this point, the angular range of A is [min_angle, max_angle]. This range passes through 0 degrees, the value of max_angle is always less than min_angle, and the value of min_angle is always greater than 180 degrees. Therefore, subtracting 360 degrees from min_angle gives us a more readable range representation of A: [min_angle - 360, max_angle]. The following conditions must be met for the two angles to intersect:

[0202] res = min_angle – 360<angle_2&&max_angle> angle_1.

[0203] (3). delta_angle > 180.0:

[0204] At this point, the angle range of A is [max_angle, min_angle]. This range passes through 0 degrees, and the value of max_angle is greater than 180 degrees. Therefore, subtracting 360 degrees from max_angle gives us a more readable range representation of A: [max_angle - 360, min_angle]. The following conditions must be met for the two angles to intersect:

[0205] res = max_angle - 360<angle_2&&min_angle> angle_1.

[0206] (4).delta_angle>=-180&&delta_angle<=0:

[0207] At this point, the angle range of A is [max_angle, min_angle], and this range does not pass through 0 degrees. Therefore, they intersect if the following conditions are met:

[0208] res = ! (angle_2)<max_angle&&angle_1+360.0> min_angle)

[0209] Here, [angle_2, angle_1+360.0] is the complement of B, and the result of the calculation corresponding to res is that the complement of B does not contain the set A, in other words, B and A intersect.

[0210] Step S1213. Determine that the attacker's attack has hit the target.

[0211] Finally, if the moving line segment of the hit point intersects with part of the ball attack box, it is determined that the attacker's attack hit the hit party.

[0212] It should be noted that although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0213] Furthermore, this disclosure also provides a hit detection device for attack behavior. (Reference) Figure 13 As shown, the hit detection device for this attack behavior may include a moving line segment acquisition module 1310, an angle interval acquisition module 1320, a line segment intersection detection module 1330, and an attack hit determination module 1340.

[0214] in:

[0215] The moving line segment acquisition module 1310 can be used to acquire the partial ball attack box corresponding to the attacker, and obtain the moving line segment of the hit point in the current frame according to the moving direction of the partial ball attack box and the moving direction of the hit point corresponding to the hit party. The partial ball attack box is used to represent the attack range of the attacker.

[0216] The angle interval acquisition module 1320 can be used to acquire the intersection angle interval corresponding to the intersection line segment between the moving line segment of the hit point and the complete sphere where part of the ball attack box is located;

[0217] The line segment intersection detection module 1330 can be used to determine whether the moving line segment of the hit point intersects with the partial ball attack box based on the intersection angle range and the attack angle range corresponding to the partial ball attack box.

[0218] The attack hit determination module 1340 can be used to determine that the attacker's attack has hit the target if the moving line segment of the hit point intersects with part of the ball attack box.

[0219] In some exemplary embodiments of this disclosure, the angle interval acquisition module 1320 may include a first intersection detection unit, a first non-intersection determination unit, and an intersection angle interval acquisition unit. Wherein:

[0220] The first intersection detection unit can be used to determine whether the moving line segment of the impact point intersects with the complete sphere where part of the ball attack box is located;

[0221] The first non-intersection determination unit can be used to determine that if the moving line segment of the hit point does not intersect with the complete sphere where part of the ball attack box is located, the attacking party's attack behavior has not hit the hit party.

[0222] The intersection angle interval acquisition unit can be used to obtain the intersection angle interval between the moving line segment of the hit point and the complete sphere where part of the ball attack box is located if the moving line segment of the hit point intersects with the complete sphere.

[0223] In some exemplary embodiments of this disclosure, the first intersection detection unit may include a second intersection detection unit, a second non-intersection determination unit, and a second intersection determination unit. Wherein:

[0224] The second intersection detection unit can be used to determine whether the straight line containing the moving line segment of the impact point intersects with the complete sphere where part of the ball attack box is located;

[0225] The second non-intersection determination unit can be used to determine that if the line segment of the moving line segment of the hit point does not intersect with the complete ball where the partial ball attack box is located, then the moving line segment of the hit point does not intersect with the partial ball attack box, and the attacking party's attack behavior has not hit the hit party.

[0226] The second intersection determination unit can be used to determine whether the moving line segment of the hit point intersects with the complete sphere where the partial ball attack box is located if the moving line segment of the hit point intersects with the complete sphere where the partial ball attack box is located.

[0227] In some exemplary embodiments of this disclosure, the angle interval acquisition module 1320 may further include a line segment intersection point acquisition unit and an intersection angle interval calculation unit. Wherein:

[0228] The line segment intersection point acquisition unit can be used to acquire the two intersection points corresponding to the intersecting line segments between the moving line segment of the hit point and the complete sphere where part of the ball attack box is located;

[0229] The intersection angle interval calculation unit can be used to obtain the intersection angle interval corresponding to the intersection line segment between the moving line segment of the hit point and the complete sphere where the partial ball attack box is located, based on the included angle between the two intersection points and the target orientation of the partial ball attack box.

[0230] In some exemplary embodiments of this disclosure, the line segment intersection detection module 1330 may include a coincidence angle determination unit, a partial sphere intersection determination unit, and a partial sphere non-intersection determination unit. Wherein:

[0231] The overlapping angle judgment unit can be used to determine whether there is an overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to some ball attack boxes;

[0232] The partial ball intersection determination unit can be used to determine whether the moving line segment of the hit point intersects with the partial ball attack box if there is an overlapping angle interval between the intersection angle interval and the attack angle interval corresponding to the partial ball attack box.

[0233] The partial ball non-intersection determination unit can be used to determine that the moving line segment of the hit point does not intersect with the partial ball attack box if there is no overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to the partial ball attack box.

[0234] In some exemplary embodiments of this disclosure, the coincidence angle determination unit may include a critical angle difference determination unit and a value range determination unit. Wherein:

[0235] The critical angle difference determination unit can be used to obtain the first critical angle value and the second critical angle value of the intersecting angle interval, and obtain the critical angle difference value based on the first critical angle value and the second critical angle value.

[0236] The value range judgment unit can be used to determine whether there is an overlapping angle range between the intersecting angle range and the attack angle range corresponding to the partial ball attack box, based on the value range of the critical angle difference.

[0237] In some exemplary embodiments of this disclosure, the value range determination unit may include a mutual circumference angle interval determination unit, which can be used to determine that there is an overlapping angle interval between the intersecting angle interval and the attack angle interval if the value range of the critical angle difference is within two preset value ranges.

[0238] The specific details of each module / unit in the hit detection device for the aforementioned attack behavior have been described in detail in the corresponding method embodiment section, and will not be repeated here.

[0239] Figure 14 A schematic diagram of a computer system suitable for implementing embodiments of the present invention is shown.

[0240] It should be noted that, Figure 14 The computer system 1400 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0241] like Figure 14As shown, the computer system 1400 includes a central processing unit (CPU) 1401, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1402 or programs loaded from storage section 1408 into random access memory (RAM) 1403. The RAM 1403 also stores various programs and data required for system operation. The CPU 1401, ROM 1402, and RAM 1403 are interconnected via a bus 1404. An input / output (I / O) interface 1405 is also connected to the bus 1404.

[0242] The following components are connected to I / O interface 1405: an input section 1406 including a keyboard, mouse, etc.; an output section 1407 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1408 including a hard disk, etc.; and a communication section 1409 including a network interface card such as a LAN card, modem, etc. The communication section 1409 performs communication processing via a network such as the Internet. A drive 1410 is also connected to I / O interface 1405 as needed. Removable media 1411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1410 as needed so that computer programs read from them can be installed into storage section 1408 as needed.

[0243] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1409, and / or installed from removable medium 1411. When the computer program is executed by central processing unit (CPU) 1401, it performs various functions defined in the system of this application.

[0244] It should be noted that the computer-readable medium disclosed herein may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0245] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0246] In another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to perform the methods described in the above embodiments.

[0247] It should be noted that although several modules for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules described above can be embodied in one module. Conversely, the features and functions of one module described above can be further divided and embodied by multiple modules.

[0248] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein.

[0249] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A method for detecting the hit rate of an attack, characterized in that, include: The attack box corresponding to the attacker is obtained, and the movement line segment of the hit point in the current frame is obtained according to the movement direction of the attack box and the movement direction of the hit point corresponding to the hit party. The attack box represents the attack range of the attacker. The movement line segment of the hit point is formed by keeping the attack box of the current frame stationary and moving the hit point in the opposite direction to the movement direction of the attack box, in addition to its own movement. The process involves obtaining the intersection angle range corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located. This process includes: obtaining two intersection points corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located; and obtaining the intersection angle range corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located based on the angle between the two intersection points and the target orientation of the partial ball attack box. Based on the intersection angle range and the attack angle range corresponding to the partial ball attack box, determine whether the moving line segment of the hit point intersects with the partial ball attack box; If the moving line segment of the hit point intersects with the partial ball attack box, it is determined that the attacker's attack has hit the hit party.

2. The hit detection method for attack behavior according to claim 1, characterized in that, The interval of the intersection angle between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located includes: Determine whether the moving line segment of the impact point intersects with the complete sphere where the partial ball attack box is located; If the moving line segment of the hit point does not intersect with the complete sphere where the partial ball attack box is located, it is determined that the moving line segment of the hit point does not intersect with the partial ball attack box, and the attacking party's attack behavior did not hit the hit party. If the moving line segment of the impact point intersects with the complete sphere where the partial ball attack box is located, then the intersection angle range corresponding to the intersecting line segment between the moving line segment of the impact point and the complete sphere is obtained.

3. The hit detection method for attack behavior according to claim 2, characterized in that, The determination of whether the moving line segment of the impact point intersects with the complete sphere where the partial ball attack box is located includes: Determine whether the straight line containing the moving line segment of the impact point intersects with the complete sphere containing the partial ball attack box; If the line segment of the moving point of the hit does not intersect the complete sphere where the partial ball attack box is located, it is determined that the line segment of the moving point of the hit does not intersect the partial ball attack box, and the attacking party's attack behavior did not hit the hit party. If the line segment of the moving point intersects with the complete sphere containing the partial ball attack box, then it is further determined whether the line segment of the moving point intersects with the complete sphere containing the partial ball attack box.

4. The hit detection method for attack behavior according to claim 1, characterized in that, The step of determining whether the moving line segment of the hit point intersects with the partial ball attack box based on the intersection angle range and the attack angle range corresponding to the partial ball attack box includes: Determine whether there is an overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to the partial ball attack box; If there is an overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to the partial ball attack box, then it is determined that the moving line segment of the hit point intersects with the partial ball attack box. If there is no overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to the partial ball attack box, it is determined that the moving line segment of the hit point does not intersect with the partial ball attack box.

5. The hit detection method for attack behavior according to claim 4, characterized in that, The step of determining whether there is an overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to the partial ball attack box includes: Obtain the first critical angle value and the second critical angle value of the intersection angle interval, and obtain the critical angle difference value based on the first critical angle value and the second critical angle value; Based on the range of the critical angle difference, determine whether there is an overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to the partial ball attack box.

6. The hit detection method for attack behavior according to claim 5, characterized in that, The step of determining whether there is an overlapping angle interval between the intersecting angle interval and the attack angle interval corresponding to the partial ball attack box based on the range of the critical angle difference includes: If the critical angle difference is within two preset ranges, then when the intersecting angle interval corresponding to the attack angle interval does not include the intersecting angle interval, it is determined that there is an overlapping angle interval between the intersecting angle interval and the attack angle interval.

7. A hit detection device for attack behavior, characterized in that, include: The moving line segment acquisition module is used to acquire the partial ball attack box corresponding to the attacker, and obtain the moving line segment of the hit point in the current frame according to the moving direction of the partial ball attack box and the moving direction of the hit point corresponding to the hit party. The partial ball attack box is used to represent the attack range of the attacker. The moving line segment of the hit point is formed by keeping the partial ball attack box in the current frame stationary and the hit point moving in the opposite direction to the moving direction of the partial ball attack box in addition to its own movement. An angle interval acquisition module is used to acquire the intersection angle interval corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located; acquiring the intersection angle interval corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located includes: acquiring two intersection points corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located; and obtaining the intersection angle interval corresponding to the intersection line segment between the moving line segment of the impact point and the complete sphere where the partial ball attack box is located based on the angle between the two intersection points and the target orientation of the partial ball attack box. The line segment intersection detection module is used to determine whether the moving line segment of the hit point intersects with the partial ball attack box based on the intersection angle range and the attack angle range corresponding to the partial ball attack box. The attack hit determination module is used to determine that the attacker's attack has hit the target if the moving line segment of the hit point intersects with the partial ball attack box.

8. An electronic device, characterized in that, include: processor; as well as A memory for storing one or more programs, which, when executed by the processor, cause the processor to implement the hit detection method for the attack behavior as described in any one of claims 1 to 6.

9. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the hit detection method for the attack behavior as described in any one of claims 1 to 6.