Limb collision detection method and device for digital character, equipment and medium

By making cuts on the character's limbs and detecting the intersection of the sampling line segment with the target cut plane, the problem of collision detection of structural simulation limbs with unknown parameter equations is solved, high-accuracy limb collision detection is achieved, the mold-crossing phenomenon is avoided, and the applicability is improved .

CN118807205APending Publication Date: 2024-10-22JIANGSU YILING DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410812087.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

It is difficult for the existing technology to effectively detect collisions between simulated limbs in structures with unknown parameter equations, leading to the phenomenon of limbs passing through the mold.

Method used

By making a cut on the limb of the character to be detected, the target cut plane is obtained, and on the second character's limb, the edge points on the first and end cut planes are selected to connect to form a sampling line segment, and whether the line segment intersects with the target cut plane is detected to determine the limb collision. .

Benefits of technology

This method does not need to obtain the parametric equation of the limb, but directly compares the position of the cut surface with the line segment, which improves the accuracy of collision detection, avoids the occurrence of mold penetration, and supports structures with any convex cut surface, improving applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118807205A_ABST
    Figure CN118807205A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of image processing, and particularly relates to a limb collision detection method and device for a digital character, equipment and a medium. The method comprises the following steps: making a section on a first limb of a to-be-detected first role in any direction to obtain a target section, respectively selecting edge points on a head end section and a tail end section on a second limb of a to-be-detected second role for connection to obtain a sampling line segment, and detecting whether the sampling line segment intersects with the target section, if it is detected that the sampling line segment intersects with the target section, it is determined that limb collision exists between the first limb of the first role and the second limb of the second role, the section position is directly compared with the line segment, collision detection is achieved, a parameter equation of the limbs does not need to be obtained, the collision detection accuracy is improved, and the phenomenon of mold penetration is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application is applicable to the field of image processing technology, and in particular relates to a method, device, equipment and medium for detecting body collision of digital characters. Background Art

[0002] When using forward kinematics to design virtual character movements, in order to avoid cross-penetration between character limbs due to unreasonable posture design, the skeleton template needs to be processed in space to detect cross-collision. Generally speaking, it is common to use cylindrical structures with standard shapes such as circles, squares, and ellipses to simulate limbs because they have certain parametric equations. However, in actual use, there may be non-cylindrical structures to simulate limbs, and the corresponding parametric equations are unknown, which makes it impossible to effectively use the parametric square for collision and penetration detection.

[0003] Therefore, how to perform collision detection on limbs simulated by structures with unknown parameter equations to accurately avoid the occurrence of limb penetration has become an urgent problem to be solved. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a method, device, equipment and medium for limb collision detection of digital characters to solve the problem of how to perform collision detection on limbs simulated by structures with unknown parameter equations to accurately avoid the occurrence of limb penetration.

[0005] In a first aspect, an embodiment of the present application provides a body collision detection method for a digital character, the body collision detection method comprising:

[0006] Making a section on the first limb of the first character to be detected in an arbitrary direction to obtain a target section;

[0007] Select an edge point on the first end section and the last end section of the second limb of the second character to be detected and connect them to obtain a sampling line segment;

[0008] Detecting whether the sampling line segment intersects the target section;

[0009] If it is detected that the sampling line segment intersects the target section, it is determined that a limb collision occurs between a first limb of the first character and a second limb of the second character.

[0010] In a second aspect, an embodiment of the present application provides a limb collision detection device for a digital character, the limb collision detection device comprising:

[0011] A section acquisition module, used for making a section on a first limb of a first character to be detected in any direction to obtain a target section;

[0012] A line segment acquisition module, used for selecting an edge point on the head end section and the end end section of the second limb of the second character to be detected and connecting them to obtain a sampling line segment;

[0013] An intersection detection module, used to detect whether the sampling line segment intersects the target section;

[0014] The collision determination module is used to determine that a first limb of the first character and a second limb of the second character collide with each other if it is detected that the sampling line segment intersects the target section.

[0015] In a third aspect, an embodiment of the present application provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the limb collision detection method as described in the first aspect when executing the computer program.

[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the limb collision detection method as described in the first aspect is implemented.

[0017] Compared with the prior art, the beneficial effects of the embodiments of the present application are as follows: the present application makes a section on the first limb of the first character to be detected in any direction to obtain a target section, selects an edge point on the head section and the end section of the second limb of the second character to be detected and connects them to obtain a sampling line segment, detects whether the sampling line segment intersects with the target section, and if it is detected that the sampling line segment intersects with the target section, it is determined that there is a limb collision between the first limb of the first character and the second limb of the second character, and directly compares the section position with the line segment to detect the collision without obtaining the parameter equation of the limb, which helps to improve the accuracy of collision detection and avoid the occurrence of mold penetration. The present application can support structures with arbitrary convex sections, thereby improving applicability. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0019] Figure 1 This is a schematic diagram of an application environment of a method for detecting body collision of a digital character provided in the first embodiment of the present application;

[0020] Figure 2It is a flow chart of a method for detecting body collision of a digital character provided in the second embodiment of the present application;

[0021] Figure 3 This is a structural diagram of a limb collision relationship provided in Example 2 of the present application;

[0022] Figure 4 It is a flowchart of a method for detecting body collision of a digital character provided in Embodiment 3 of the present application;

[0023] Figure 5 It is a flow chart of a method for detecting body collision of a digital character provided in the fourth embodiment of the present application;

[0024] Figure 6 It is a flowchart of a method for detecting body collision of a digital character provided in Embodiment 5 of the present application;

[0025] Figure 7 It is a flowchart of a method for detecting body collision of a digital character provided in Example 6 of the present application;

[0026] Figure 8 This is a schematic diagram of a principle for determining whether a contact point falls within a section provided in Embodiment 6 of the present application;

[0027] Fig. 9 It is a structural schematic diagram of a limb collision detection device for a digital character provided in Embodiment 7 of the present application;

[0028] Fig.10 It is a structural diagram of a computer device provided in Example 8 of the present application. DETAILED DESCRIPTION

[0029] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0030] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0031] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0032] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0033] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0034] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0035] It should be understood that the size of the serial numbers of the steps in the following embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0036] In order to illustrate the technical solution of the present application, a specific embodiment is provided below for illustration.

[0037] A method for detecting body collision of a digital character provided in the first embodiment of the present application can be applied in the following aspects: Figure 1In an application environment, the client communicates with the server, and the client provides corresponding trigger instructions to the server, so that the above-mentioned body collision detection method is executed in the server, wherein the server can be implemented by computer devices including but not limited to handheld computers, desktop computers, laptop computers, ultra-mobile personal computers (ultra-mobile personal computers, UMPC), netbooks, cloud computer devices, personal digital assistants (personal digital assistants, PDAs), etc., and can also be implemented by independent or integrated servers.

[0038] See also Figure 2 , is a flow chart of a method for detecting body collision of a digital character provided in the second embodiment of the present application, wherein the body collision detection method is applied to Figure 1 In the server, when executing the corresponding instructions, the server runs the above body collision detection method. Figure 2 As shown, the limb collision detection method for a digital character may include the following steps:

[0039] Step S201 , making a section on a first limb of a first character to be detected in an arbitrary direction to obtain a target section.

[0040] In this embodiment, any limb of the first character is a first limb, and the first limb is a structure, that is, a structure composed of a skeleton and a volumetric space surrounding the skeleton. The section is a plane of finite size obtained by cutting the structure along a certain planar direction.

[0041] The above-mentioned section may be set to be perpendicular to the bone, that is, the direction of making the section is along a direction perpendicular to the bone, which can help to obtain a sampling point set of the section later.

[0042] Step S202 , select an edge point on the head end section and the end end section of the second limb of the second character to be detected, respectively, and connect them to obtain a sampling line segment.

[0043] In this embodiment, any limb of the second character is a second limb, and the second limb is also a structure. The first segment and the last segment of the second limb respectively represent the end of the second limb close to the character's body and the end far from the character's body.

[0044] A front end section can be obtained by making a section at the front end, and a rear end section can be obtained by making a section at the rear end. Specifically, the section can be made in a direction perpendicular to the speech skeleton.

[0045] Select a sampling point on the edge of the head section, that is, the edge point of the surface representing the head of the limb, and select a sampling point on the edge of the end section, that is, the edge point of the surface representing the end of the limb. Connect the two edge points to form a line segment, which is the sampling line segment.

[0046] Specifically, when selecting edge points, after determining the edge point at the beginning, the edge point where the plane formed by the edge point and the bone intersects the end section is the edge point at the end, and vice versa, thereby forming a line segment along the skin surface of the limb. Using this type of line segment can improve the efficiency of detecting collisions of the entire limb.

[0047] Step S203: Check whether the sampling line segment intersects the target section.

[0048] Step S204: if it is detected that the sampling line segment intersects the target section, it is determined that a first limb of the first character and a second limb of the second character collide with each other.

[0049] In this embodiment, whether the sampling line segment intersects with the target section can be determined by determining whether the target section contains any point in the sampling line segment. For example, the section features of the target section are analyzed to obtain a unified feature of all points on the target section, and whether each point in the sampling line segment meets the unified feature is determined. If there is a point that meets the unified feature, it means that there is an intersection, and if not, it means that there is no intersection.

[0050] like Figure 3 As shown, it is a structural diagram of a limb collision relationship provided in the second embodiment of the present application, and the known conditions are:

[0051] (1) Any cut surface G (convex geometric shape) of the structure I in space and its sampling point set;

[0052] (2) The second limb is a line segment P formed by sampling points between the first and last sections of structure II in space. A P B .

[0053] Need to judge: line segment P A P B Whether the line segment and the cross section G intersect, if there is an intersection, it indicates that the limbs will collide. Of course, only one pair of line segments and cross sections are given here. To determine whether the entire limb has collided, more line segments and cross sections need to be selected from the two structures for intersection judgment. Furthermore, as long as there is a pair of line segments and cross sections that intersect, it can be directly determined that there is a collision. If all line segments and cross sections do not intersect, it can be determined that the two limbs do not collide.

[0054] In an embodiment of the present application, a section is made on the first limb of the first character to be detected in any direction to obtain a target section, and an edge point is selected on the head section and the end section of the second limb of the second character to be detected to be connected to obtain a sampling line segment, and it is detected whether the sampling line segment intersects with the target section. If it is detected that the sampling line segment intersects with the target section, it is determined that there is a limb collision between the first limb of the first character and the second limb of the second character. The section position is directly compared with the line segment to detect the collision without obtaining the parameter equation of the limb, which helps to improve the accuracy of collision detection and avoid the occurrence of mold penetration. The present application can support structures with arbitrary convex sections, thereby improving applicability.

[0055] See also Figure 4 , is a flow chart of a method for detecting body collision of a digital character provided in the third embodiment of the present application. Figure 4 As shown, after making a section in any direction on the first limb of the first character to be detected in step S201 to obtain a target section, the limb collision detection method may further include the following steps:

[0056] Step S401, obtaining an edge sampling point set consisting of edge points of a target section.

[0057] Among them, each point in the edge sampling point set is an edge point of the target section, that is, Figure 3 The points in the outermost circle of the midsection G. The edge sampling point set contains the position information of each sampling point, which can be specifically represented by three-dimensional coordinates.

[0058] In the above step S203, detecting whether the sampling line segment intersects the target section may include the following steps:

[0059] Step S402 , judging whether there is an intersection point according to the coordinates of each line sampling point in the sampling line segment and the coordinates of each surface sampling point in the edge sampling point set.

[0060] The intersection point is a line sampling point that falls on the target section surrounded by all surface sampling points.

[0061] The points in the sampling line segment are defined as line sampling points (corresponding to the line segment), the points in the edge sampling point set are surface sampling points (corresponding to the section), and the intersection points require that the line sampling points are in the target section.

[0062] Step S403: if there is an intersection point, it is determined that the detected sampling line segment intersects the target section plane; if there is no intersection point, it is determined that the detected sampling line segment does not intersect the target section plane.

[0063] In this embodiment, the surface sampling points of the edge sampling point set can be used to calculate the directional characteristics of the target section, and the line sampling points of the sampling line segment can be used to calculate the vector direction of the sampling line segment. By comparing the two directions, if the target section is parallel to the sampling line segment, it is determined that there is no intersection between the two. If they are not parallel, the intersection can be determined by judging whether the sampling line segment intersects with each of the sections, and then judging whether the intersection belongs to the target section according to the position of the intersection. If it belongs to the target section, it is determined to be an intersection; if it does not belong to the target section, it is determined not to be an intersection.

[0064] The embodiment of the present application uses edge sampling point sets to compare with sampling line segments to determine whether there is an intersection. There is no need to use parameter equations of the section surface, and the intersection situation can be effectively determined without manually determining parameters, thereby improving the efficiency of collision detection.

[0065] See also Figure 5 , is a flow chart of a method for detecting body collision of a digital character provided in the fourth embodiment of the present application. Figure 5 As shown, in the above step S402, judging whether there is an intersection point according to the coordinates of each line sampling point in the sampling line segment and the coordinates of each surface sampling point in the edge sampling point set may include the following steps:

[0066] Step S501 : Calculate the coordinates of the sampling center point of the target section according to the coordinates of each surface sampling point in the edge sampling point set.

[0067] Step S502: Calculate the unit normal vector of the target section according to the coordinates of the sampling center point and the coordinates of any two surface sampling points.

[0068] Step S503: construct a first vector representing the sampling line segment according to the coordinates of the starting point and the ending point of the sampling line segment.

[0069] Step S504: construct a second vector according to the coordinates of the starting point and the coordinates of the sampling center point.

[0070] Step S505 , judging whether the sampling line segment is in contact with the plane where the target section plane is located according to the unit normal vector, the first vector and the second vector.

[0071] Step S506: if the sampling line segment contacts the plane where the target section is located, the coordinates of the contact point are determined, and it is detected whether the contact point falls in the target section surrounded by all surface sampling points.

[0072] Step S507: if it is detected that the contact point falls within the target section surrounded by all surface sampling points, the contact point is determined to be an intersection point; if it is detected that the contact point does not fall within the target section surrounded by all surface sampling points, the contact point is determined not to be an intersection point.

[0073] In which, the straight line l1=P is defined A P B is the line where the sampling line segment is located, then the point on the line l1 can be expressed as:

[0074] P=P A +α(P B -P A )

[0075] Among them, P represents the point on the straight line l1, P A represents the edge point on the first end section, P B Represents the edge point on the end section. Since P is a point on the line l1, it is not restricted to the line segment P. A P B Therefore, α can be positive or negative. When α is zero, it represents P A point, when α is 1, it represents P B point.

[0076] Store the m three-dimensional sampling points on G in the matrix M:

[0077]

[0078] Calculate the sampling center P of the section G C ,as follows:

[0079] P C =mean({P1P2P3...P m})

[0080] Take any two points in M ​​and add them to P C Form two vectors and obtain the unit normal vector of the section G through vector cross product

[0081]

[0082] According to the coordinates of the starting point and the ending point of the sampling segment, a first vector representing the sampling segment is constructed. According to the coordinates of the starting point and the coordinates of the sampling center point, a second vector is constructed. The first vector is mapped according to the unit normal vector, and the second vector is mapped using the unit normal vector. Through the mapping results of the two, it can be determined whether the sampling segment is in contact with the plane where the target section is located, that is, the sampling segment passes through the plane where the target section is located or the starting point or the ending point of the sampling segment is on the plane where the target section is located.

[0083] The embodiment of the present application first pre-judges whether the sampling line segment is in contact with the plane where the section is located, and then further judges whether the contact point is an intersection point based on the contact. This can improve the detection efficiency to a certain extent. In addition, the calculation is performed in the form of matrix and vector, which makes the calculation simple and stable, and helps to improve the calculation efficiency of intersection detection.

[0084] See also Figure 6 , is a flow chart of a method for detecting body collision of a digital character provided in Embodiment 5 of the present application. Figure 6 As shown, based on the fourth embodiment, the step S505 determines whether the sampling line segment is in contact with the plane where the target section is located according to the unit normal vector, the first vector and the second vector, including the following steps:

[0085] Step S601, dot the unit normal vector with the first vector to obtain a first dot product result, and dot-product the unit normal vector with the second vector to obtain a second dot product result.

[0086] Step S602, comparing the second dot product result with the first dot product result to obtain a ratio.

[0087] Step S603: if the ratio is in the interval [0, 1], it is determined that the sampling line segment is in contact with the plane where the target section is located; if the ratio is not in the interval [0, 1], it is determined that the sampling line segment is not in contact with the plane where the target section is located.

[0088] Among them, the intersection point P of l1 and the plane where the section G lies GL It can be obtained by the following formula:

[0089]

[0090] P GL =P A +α GL (P B -P A )

[0091] According to α GL The value of is determined as follows:

[0092] (1) If 0≤α GL ≤1, then the intersection of l1 and the plane where G is located is on the sampling line segment P A P B This point is called contact point P. D =P GL ;

[0093] (2) If 1<α GL or α GL <0, then the intersection of l1 and the plane where G is located is not on the sampling line segment P A P B On the sampling line segment P A P B There is no cross contact with the cut surface G.

[0094] Optionally, determining the coordinates of the contact point includes:

[0095] Determine a first coordinate difference between the starting point and the ending point according to the coordinates of the starting point and the coordinates of the ending point;

[0096] The ratio is multiplied by the first coordinate difference, and the multiplication result is the second coordinate difference between the starting point and the contact point;

[0097] The coordinates of the starting point and the difference of the second coordinates are added, and the added result is the coordinates of the contact point.

[0098] The embodiment of the present application uses vector dot multiplication as a comparison method to determine whether there is a contact point, so as to quickly and accurately obtain the contact point determination result, which helps to improve the efficiency of collision detection.

[0099] See also Figure 7 , is a flow chart of a method for detecting body collision of a digital character provided in Example 6 of the present application, such as Figure 7 As shown, in the above step S506, detecting whether the contact point falls within the target section surrounded by all surface sampling points may include the following steps:

[0100] Step S701: construct vectors with the contact point and each surface sampling point to obtain a vector set.

[0101] Step S702: normalize all vectors in the vector set to obtain a unit vector set.

[0102] Step S703, removing duplicate unit vectors from the unit vector set, converting each remaining unit vector into a three-dimensional data point, and constructing a data point matrix based on all three-dimensional data points.

[0103] Step S704, selecting any three-dimensional data point from the data point matrix as a target data point, performing dot multiplication operations on the remaining three-dimensional data points in the data point matrix and the target data point, respectively, to obtain operation results.

[0104] Step S705: rearrange the three-dimensional data points in the data point matrix according to the calculation result to obtain a rearranged matrix.

[0105] Step S706, calculating the angle between any two adjacent three-dimensional data points in the rearranged matrix, and summing up all the angles to obtain the vector expansion angle.

[0106] Step S707, detecting whether the vector expansion angle of the vector set is greater than or equal to 180°.

[0107] Step S708, if it is detected that the vector expansion angle of the vector set is greater than or equal to 180°, it is determined that the contact point falls within the target section surrounded by all surface sampling points; if it is detected that the vector expansion angle of the vector set is less than 180°, it is determined that the contact point does not fall within the target section surrounded by all surface sampling points.

[0108] In this embodiment, after obtaining the contact point P D After that, it is known that P D is in the same plane as the section G, so as long as we judge that P D Whether the sampling line segment P is inside G can be judged A P B Whether it crosses and contacts with the section G.

[0109] like Figure 8 FIG. 1 is a schematic diagram showing a principle of judging whether a contact point falls within a section provided in Embodiment 6 of the present application. Accordingly, judging whether P D Whether it is inside G (convex geometry) can be determined according to the following rules:

[0110] (1) If P D The angle of the vector expansion to all sampling points on G is <180°, then P D Outside G, the sampling line segment P A P B There is no cross contact with the section G;

[0111] (2) If from P D The angle of the vector expansion to all sampling points on G is ≥ 180°, then P D Inside G, sample line segment P A P B Cross-contact with section G.

[0112] The above process is a method for realizing angle calculation, which is as follows:

[0113] 1. Calculate P D To the vector between all sampling points on the section G;

[0114] 2. Normalize these vectors to obtain a set of unit vectors;

[0115] 3. Remove duplicate unit vectors and store them in the form of three-dimensional "data points" in the matrix V;

[0116] 4. Take any data point (vector) from V, mark it as T0, then do vector dot multiplication with other data points (vectors) in V, and find the data point corresponding to the largest positive result, mark it as T1, and then rearrange the data points in V in descending order of the dot multiplication result with T0, and get V = [T0T1T2T3…T n ];

[0117] 5. Calculate the angle θ between the vector (data point) T0 and other vectors in V except T0 0i =cos -1 (T0gT i ), and obtain the array Θ0=[θ 01 θ 02 θ 03 ...θ 0i ...θ 0n ];

[0118] 6. Calculate the angle θ between vector (data point) T1 and other vectors in V except T0 1i =cos -1 (T1gT i ), and obtain the array Θ1=[θ 11 θ 12 θ 13 ...θ 1i ...θ 1n ];

[0119] 7. Initialize j=0, k=1;

[0120] For i∈[2,n], compare θ in order (i takes values ​​from small to large) 0i and θ 01 +θ 1i The value of:

[0121] (1) If the two are equal, update k = k + 1 and set T i The subscript i is changed to k;

[0122] (2) If the two are not equal, update j = j-1 and set T i The subscript i is changed to j;

[0123] After traversing i in sequence, the index of the data in V will be updated. Re-assign the index from 0 to the largest value, and obtain the new matrix U = [Q0Q1Q2Q3...Q n ];

[0124] 8. Calculate the vector expansion angle as follows:

[0125]

[0126] When Ω<180°, the sampling line segment P A P B There is no cross contact with the section G;

[0127] When Ω ≥ 180°, the sampling line segment P A P B Cross-contact with section G.

[0128] In the above process, it is not necessary to know the arrangement order of the sampling points, and the vector expansion angle can be accurately calculated to determine whether the contact point is an intersection point.

[0129] The embodiment of the present application analyzes the vectors of the contact point and the surface sampling point, and determines whether the contact point is an intersection point based on whether the vector expansion angle is greater than 180°, thereby quickly and accurately determining the intersection point. The calculation process is simple and does not require complex logic, thereby improving the efficiency of collision detection.

[0130] Corresponding to the limb collision detection method for digital characters in the above embodiment, Fig. 9 The structure block diagram of the limb collision detection device for digital characters provided in the seventh embodiment of the present application is shown. The limb collision detection device is applied to Figure 1 In the server, when executing the corresponding instruction, the server runs the above-mentioned body collision detection method. For the convenience of explanation, only the part related to the embodiment of the present application is shown.

[0131] See also Fig. 9 , the limb collision detection device comprises:

[0132] A section acquisition module 91 is used to make a section on a first limb of a first character to be detected in any direction to obtain a target section;

[0133] A line segment acquisition module 92, used for selecting an edge point on the head end section and the end section of the second limb of the second character to be detected and connecting them to obtain a sampling line segment;

[0134] The intersection detection module 93 is used to detect whether the sampling line segment intersects with the target section;

[0135] The collision determination module 94 is used to determine that a first limb of the first character and a second limb of the second character collide with each other if it is detected that the sampling line segment intersects with the target section.

[0136] Optionally, the limb collision detection device further includes:

[0137] A sampling point acquisition module is used to make a section on the first limb of the first character to be detected in any direction, and after obtaining a target section, obtain an edge sampling point set composed of edge points of the target section;

[0138] The cross detection module 93 includes:

[0139] An intersection point determination unit, used to determine whether there is an intersection point according to the coordinates of each line sampling point in the sampling line segment and the coordinates of each surface sampling point in the edge sampling point set, wherein the intersection point is a line sampling point that falls on the target section surrounded by all surface sampling points;

[0140] The intersection detection unit is used to determine that the sampling line segment is detected to intersect with the target section if there is an intersection, and to determine that the sampling line segment is detected to not intersect with the target section if there is no intersection.

[0141] Optionally, the intersection determination unit includes:

[0142] The center point determination subunit is used to calculate the coordinates of the sampling center point of the target section according to the coordinates of each surface sampling point in the edge sampling point set;

[0143] A normal vector determination subunit is used to calculate the unit normal vector of the target section according to the coordinates of the sampling center point and the coordinates of any two surface sampling points;

[0144] A first vector construction subunit, used to construct a first vector representing the sampling line segment according to the coordinates of the starting point and the ending point of the sampling line segment;

[0145] A second vector construction subunit, used to construct a second vector according to the coordinates of the starting point and the coordinates of the sampling center point;

[0146] A contact determination subunit, used for determining whether the sampling line segment is in contact with the plane where the target section is located according to the unit normal vector, the first vector and the second vector;

[0147] A position detection subunit is used to determine the coordinates of the contact point if the sampling line segment contacts the plane where the target section is located, and to detect whether the contact point falls within the target section surrounded by all surface sampling points;

[0148] The intersection judgment subunit is used to determine that the contact point is an intersection point if it is detected that the contact point falls within the target section surrounded by all surface sampling points, and to determine that the contact point is not an intersection point if it is detected that the contact point does not fall within the target section surrounded by all surface sampling points.

[0149] Optionally, the contact determination subunit is specifically used for:

[0150] The unit normal vector is multiplied by the first vector to obtain the first dot product result, and the unit normal vector is multiplied by the second vector to obtain the second dot product result;

[0151] Compare the second dot product result with the first dot product result to obtain a ratio. If the ratio is in the interval [0,1], it is determined that the sampling line segment is in contact with the plane where the target section is located. If the ratio is not in the interval [0,1], it is determined that the sampling line segment is not in contact with the plane where the target section is located.

[0152] Optionally, the position detection subunit is specifically used for:

[0153] Determine a first coordinate difference between the starting point and the ending point according to the coordinates of the starting point and the coordinates of the ending point;

[0154] The ratio is multiplied by the first coordinate difference, and the multiplication result is the second coordinate difference between the starting point and the contact point;

[0155] The coordinates of the starting point and the difference of the second coordinates are added, and the added result is the coordinates of the contact point.

[0156] Optionally, the position detection subunit is specifically used for:

[0157] Construct vectors between the contact points and each surface sampling point to obtain a vector set;

[0158] Normalize all vectors in the vector set to obtain a unit vector set;

[0159] Removing duplicate unit vectors from the unit vector set, converting each remaining unit vector into a three-dimensional data point, and constructing a data point matrix based on all the three-dimensional data points;

[0160] Select any three-dimensional data point from the data point matrix as the target data point, perform point multiplication operations on the remaining three-dimensional data points in the data point matrix and the target data point, and obtain the operation results;

[0161] According to the operation result, the three-dimensional data points in the data point matrix are rearranged to obtain a rearranged matrix;

[0162] Calculate the angle between any two adjacent three-dimensional data points in the rearranged matrix, and sum up all the angles to obtain the vector expansion angle;

[0163] Check whether the vector expansion angle of the vector set is greater than or equal to 180°;

[0164] If the vector expansion angle of the detected vector set is greater than or equal to 180°, it is determined that the contact point falls in the target section surrounded by all surface sampling points. If the vector expansion angle of the detected vector set is less than 180°, it is determined that the contact point does not fall in the target section surrounded by all surface sampling points.

[0165] It should be noted that the information interaction, execution process and other contents between the above-mentioned modules are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0166] Fig.10 This is a schematic diagram of the structure of a computer device provided in Example 8 of the present application. Fig.10 As shown, the computer device of this embodiment includes: at least one processor ( Fig.10Only one is shown in the figure), a memory, and a computer program stored in the memory and executable on at least one processor, wherein when the processor executes the computer program, the steps in any of the above-mentioned embodiments of the method for detecting limb collision of digital characters are implemented.

[0167] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that Fig.10 This is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, it may also include a network interface, a display screen, and an input device.

[0168] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0169] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory may be the memory of a computer device, and the internal memory provides an environment for the operation of an operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be a hard disk of a computer device, and in other embodiments may also be an external storage device of a computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on a computer device. Further, the memory may also include both an internal storage unit of a computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of computer programs, etc. The memory may also be used to temporarily store data that has been output or is to be output.

[0170] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned method embodiment when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0171] The present application implements all or part of the processes in the above-mentioned embodiment method, and may also be completed through a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiment when executing the computer program product.

[0172] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0173] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0174] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as 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 devices or units, which can be electrical, mechanical or other forms.

[0175] 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.

[0176] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for detecting body collision of a digital character, characterized in that: The limb collision detection method comprises: Making a section on the first limb of the first character to be detected in an arbitrary direction to obtain a target section; Select an edge point on the first end section and the last end section of the second limb of the second character to be detected and connect them to obtain a sampling line segment; Detecting whether the sampling line segment intersects the target section; If it is detected that the sampling line segment intersects the target section, it is determined that a limb collision occurs between a first limb of the first character and a second limb of the second character.

2. The body collision detection method according to claim 1, characterized in that: After making a section in any direction on the first limb of the first character to be detected to obtain a target section, the method further includes: Acquire an edge sampling point set composed of edge points of the target section; The detecting whether the sampling line segment intersects the target section plane includes: According to the coordinates of each line sampling point in the sampling line segment and the coordinates of each surface sampling point in the edge sampling point set, it is determined whether there is an intersection point, wherein the intersection point is a line sampling point falling on the target section surrounded by all surface sampling points; If there is an intersection point, it is determined that the sampling line segment is detected to intersect with the target section plane; if there is no intersection point, it is determined that the sampling line segment is detected to not intersect with the target section plane.

3. The body collision detection method according to claim 2, characterized in that: The step of judging whether there is an intersection point according to the coordinates of each line sampling point in the sampling line segment and the coordinates of each surface sampling point in the edge sampling point set includes: Calculate the coordinates of the sampling center point of the target section according to the coordinates of each surface sampling point in the edge sampling point set; Calculate the unit normal vector of the target section according to the coordinates of the sampling center point and the coordinates of any two surface sampling points; Constructing a first vector representing the sampling line segment according to the coordinates of the starting point and the ending point of the sampling line segment; Constructing a second vector according to the coordinates of the starting point and the coordinates of the sampling center point; Determining whether the sampling line segment is in contact with the plane where the target section is located according to the unit normal vector, the first vector and the second vector; If the sampling line segment contacts the plane where the target section is located, the coordinates of the contact point are determined, and whether the contact point falls within the target section surrounded by all surface sampling points is detected; If it is detected that the contact point falls within the target section surrounded by all surface sampling points, the contact point is determined to be an intersection point; if it is detected that the contact point does not fall within the target section surrounded by all surface sampling points, the contact point is determined not to be the intersection point.

4. The body collision detection method according to claim 3, characterized in that: The determining, based on the unit normal vector, the first vector, and the second vector, whether the sampling line segment contacts the plane where the target section is located includes: Multiply the unit normal vector by the first vector to obtain a first dot product result, and multiply the unit normal vector by the second vector to obtain a second dot product result; The second dot product result is compared with the first dot product result to obtain a ratio. If the ratio is in the interval [0, 1], it is determined that the sampling line segment is in contact with the plane where the target section is located. If the ratio is not in the interval [0, 1], it is determined that the sampling line segment is not in contact with the plane where the target section is located.

5. The body collision detection method according to claim 4, characterized in that: The determining the coordinates of the contact point includes: Determine a first coordinate difference between the starting point and the ending point according to the coordinates of the starting point and the coordinates of the ending point; multiplying the ratio by the first coordinate difference to obtain a multiplication result which is a second coordinate difference between the starting point and the contact point; The coordinates of the starting point and the difference between the second coordinates are added, and the added result is the coordinates of the contact point.

6. The body collision detection method according to claim 3, characterized in that: The detecting whether the contact point falls within the target section surrounded by all surface sampling points includes: Construct vectors with the contact points and each surface sampling point to obtain a vector set; Detecting whether the vector expansion angle of the vector set is greater than or equal to 180°; If it is detected that the vector expansion angle of the vector set is greater than or equal to 180°, it is determined that the contact point falls in the target section surrounded by all surface sampling points. If it is detected that the vector expansion angle of the vector set is less than 180°, it is determined that the contact point does not fall in the target section surrounded by all surface sampling points.

7. The body collision detection method according to claim 6, characterized in that: Before detecting whether the vector expansion angle of the vector set is greater than or equal to 180°, the method further includes: Performing unitization processing on all vectors in the vector set to obtain a unit vector set; Removing duplicate unit vectors from the unit vector set, converting each remaining unit vector into a three-dimensional data point, and constructing a data point matrix based on all the three-dimensional data points; Select any three-dimensional data point from the data point matrix as a target data point, and perform point multiplication operations on the remaining three-dimensional data points in the data point matrix and the target data point to obtain operation results; According to the calculation result, the three-dimensional data points in the data point matrix are rearranged to obtain a rearranged matrix; The angle between any two adjacent three-dimensional data points in the rearranged matrix is ​​calculated, and all the angles are summed to obtain the vector expansion angle.

8. A limb collision detection device for a digital character, characterized in that: The limb collision detection device comprises: A section acquisition module, used for making a section on a first limb of a first character to be detected in any direction to obtain a target section; A line segment acquisition module, used for selecting an edge point on the head end section and the end end section of the second limb of the second character to be detected and connecting them to obtain a sampling line segment; An intersection detection module, used to detect whether the sampling line segment intersects the target section; The collision determination module is used to determine that a first limb of the first character and a second limb of the second character collide with each other if it is detected that the sampling line segment intersects the target section.

9. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the limb collision detection method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the limb collision detection method according to any one of claims 1 to 7 is implemented.