CN111773723A - Collision detection method and device - Google Patents

Collision detection method and device Download PDF

Info

Publication number
CN111773723A
CN111773723A CN202010745774.2A CN202010745774A CN111773723A CN 111773723 A CN111773723 A CN 111773723A CN 202010745774 A CN202010745774 A CN 202010745774A CN 111773723 A CN111773723 A CN 111773723A
Authority
CN
China
Prior art keywords
virtual
target
target points
moment
motion
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010745774.2A
Other languages
Chinese (zh)
Inventor
杜志荣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202010745774.2A priority Critical patent/CN111773723A/en
Publication of CN111773723A publication Critical patent/CN111773723A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/55Controlling game characters or game objects based on the game progress
    • A63F13/57Simulating properties, behaviour or motion of objects in the game world, e.g. computing tyre load in a car race game
    • A63F13/577Simulating properties, behaviour or motion of objects in the game world, e.g. computing tyre load in a car race game using determination of contact between game characters or objects, e.g. to avoid collision between virtual racing cars
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program
    • A63F2300/64Methods for processing data by generating or executing the game program for computing dynamical parameters of game objects, e.g. motion determination or computation of frictional forces for a virtual car

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a collision detection method and device. Wherein, the method comprises the following steps: acquiring a first movement position of the virtual object at a first moment and a second movement position of the virtual object at a second moment, wherein the second moment is the next moment adjacent to the first moment; establishing a virtual geometry connected to the first motion location and the second motion location; and performing collision detection on the virtual geometric body and the target object to determine whether the virtual object collides with the target object in the process of moving from the first motion position to the second motion position. The invention solves the technical problem that the detection accuracy is reduced because the detection is easy to be misjudged according to the frame in the collision detection method in the related technology.

Description

Collision detection method and device
Technical Field
The invention relates to the field of internet, in particular to a collision detection method and device.
Background
In action-based games, game characters often have close combat attack skills, and generally the game characters flap toward a target object with close combat weaponry held by the game characters to attack the target object. However, whether the target object can be hit by the attack action of the close-up weaponry depends on a collision detection method, which is a method of determining whether the close-up weaponry and the target object collide with each other.
As shown in FIGS. 1a and 1b, the circles represent target objects and the game character is waving from right to left holding sword weapon equipment. Since the game program is executed by a Central Processing Unit (CPU) in frames formed at regular time intervals, as shown in fig. 1a, in the current xth frame, the sword-shaped weapon equipment does not collide with the target object, and it can be confirmed that the target object is not attacked, and as shown in fig. 1b, in the next frame, i.e. the (x + 1) th frame, the sword-shaped weapon equipment already bypasses the position of the target object, and it can also be confirmed that the target object is not attacked. In the above case, it can be determined that the target object is necessarily attacked by the sword-shaped weapon equipment in this attacking action, that is, the sword-shaped weapon equipment collides with the target object at a certain time between two frames. However, if it is detected only whether the sword-shaped weapon equipment collides with the target object at two positions, the detection result is that no collision occurs, and the current attacking action of the sword-shaped weapon equipment is determined not to attack the target object.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a collision detection method and a collision detection device, which at least solve the technical problem that the detection accuracy is reduced because the detection method in the related technology is easy to carry out misjudgment according to frames.
According to an aspect of an embodiment of the present invention, there is provided a collision detection method including: acquiring a first movement position of the virtual object at a first moment and a second movement position of the virtual object at a second moment, wherein the second moment is the next moment adjacent to the first moment; establishing a virtual geometry connected to the first motion location and the second motion location; and performing collision detection on the virtual geometric body and the target object to determine whether the virtual object collides with the target object in the process of moving from the first motion position to the second motion position.
Optionally, the step of establishing a virtual geometry connected to the first motion location and the second motion location comprises: acquiring first positions of a plurality of target points on the virtual object at a first moment and second positions of the plurality of target points at a second moment, wherein the plurality of target points are target points selected between the head and the tail of the virtual object; and constructing a virtual geometric body between the target points of each group of different positions based on the first position and the second position to obtain a plurality of virtual geometric bodies.
Optionally, the step of constructing a virtual geometric body between the target points at each set of different positions based on the first position and the second position to obtain a plurality of virtual geometric bodies includes: acquiring connecting lines between target points at different positions of each group based on the first position and the second position to obtain a plurality of target connecting lines; and respectively constructing virtual geometric bodies according to the target connecting lines to obtain a plurality of virtual geometric bodies.
Optionally, the target connecting line is a straight line or an arc line between the target points at each group of different positions, wherein the arc line takes a center corresponding to the arc line of the virtual object as a center.
Optionally, in a case that the target connecting line is an arc between target points at different positions of each group, the step of constructing a virtual geometric body according to the target connecting line to obtain a plurality of virtual geometric bodies includes: determining at least one intermediate point on the target link; determining a connecting line between any two adjacent points in each group of target points at different positions and at least one intermediate point to obtain a plurality of sub-straight lines; and constructing virtual geometric bodies according to the sub-straight lines to obtain a plurality of virtual geometric bodies.
Optionally, the virtual geometry is a virtual cylinder, the diameter of the bottom surface of the virtual cylinder being less than or equal to the spacing between adjacent target points.
Optionally, the plurality of target points are target points chosen at equal intervals between the head and the tail of the virtual object.
According to another aspect of the embodiments of the present invention, there is also provided a collision detection apparatus including: the acquisition module is used for acquiring a first motion position of the virtual object at a first moment and a second motion position of the virtual object at a second moment, wherein the second moment is the next moment adjacent to the first moment; the establishing module is used for establishing a virtual geometric body connected with the first motion position and the second motion position; and the detection module is used for performing collision detection on the target object through the virtual geometric body so as to determine whether the virtual object collides with the target object in the process of moving from the first motion position to the second motion position.
Optionally, the establishing module includes: the device comprises an acquisition unit, a judgment unit and a display unit, wherein the acquisition unit is used for acquiring first positions of a plurality of target points on a virtual object at a first moment and second positions of the plurality of target points at a second moment, and the plurality of target points are selected from the head and the tail of the virtual object; and the constructing unit is used for constructing virtual geometric bodies between the target points at each group of different positions based on the first position and the second position to obtain a plurality of virtual geometric bodies.
Optionally, the construction unit is further configured to perform the following steps: determining a connecting line between target points at different positions of each group based on the first position and the second position to obtain a plurality of target connecting lines; and respectively constructing virtual geometric bodies according to the target connecting lines to obtain a plurality of virtual geometric bodies.
Optionally, the target connecting line is a straight line or an arc line between the target points at each group of different positions, wherein the arc line takes a center corresponding to the arc line of the virtual object as a center.
Optionally, in a case that the target link is an arc between target points at each set of different positions, the construction unit is further configured to perform the following steps: determining at least one intermediate point on the target link; determining a connecting line between any two adjacent points in each group of target points at different positions and at least one intermediate point to obtain a plurality of sub-straight lines; and constructing virtual geometric bodies according to the sub-straight lines to obtain a plurality of virtual geometric bodies.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium including a stored program, wherein the apparatus on which the storage medium is located is controlled to execute the above-mentioned collision detection method when the program is executed.
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to execute a program, where the program executes the collision detection method described above.
In the embodiment of the invention, after the first motion position and the second motion position of the virtual object at two adjacent moments, the virtual geometric body connected to the first motion position and the second motion position can be established, and whether the virtual object collides with the target object in the process of moving from the first motion position to the second motion position is determined through collision detection of the virtual geometric body and the target object, so that the purpose of judging whether the virtual object attacks the target object is achieved. It is easy to notice that, because the virtual geometric solid is connected to different motion positions at two adjacent moments and is not established at the position where the virtual object is located at a certain moment, whether the virtual object collides with the target object at a certain moment between two frames of images can be accurately detected, and misjudgment of other non-target objects can be avoided, so that the technical effects of improving the detection accuracy and improving the probability of detecting the collision are achieved, and the technical problem that misjudgment is easily caused by detecting the collision detection method according to frames in the related art, and the detection accuracy is reduced is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1a is a schematic diagram of a display position of a virtual object at a first time according to the prior art;
FIG. 1b is a schematic diagram of a display position of a virtual object at a second time according to the prior art;
FIG. 2a is a schematic illustration of a collision detection method according to the prior art;
FIG. 2b is a schematic illustration of another collision detection method according to the prior art;
FIG. 3 is a flow chart of a collision detection method according to an embodiment of the invention
FIG. 4a is a schematic diagram of an alternative straight connection of target points at different locations in accordance with an embodiment of the present invention;
FIG. 4b is a schematic diagram of an alternative method for constructing a virtual cylinder with a straight line as a central axis according to an embodiment of the present invention;
FIG. 5a is a schematic diagram of an alternative arc connection of target points at different locations in accordance with embodiments of the present invention;
FIG. 5b is a schematic diagram of an alternative method for constructing a virtual cylinder with an arc as a central axis according to an embodiment of the present invention;
FIG. 6 is a schematic view of a collision detection apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a storage medium according to an embodiment of the present invention; and
fig. 8 is a schematic diagram of an apparatus according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Since the game program is executed by the CPU on a frame basis, if it is detected only whether the sword-shaped weapon equipment collides with the target object at two positions, the detection result is that no collision occurs, but in reality, the target object is inevitably attacked by the attacking action of the sword-shaped weapon equipment at this time.
In order to solve the above problem, a cylinder can be virtually created at the position of the sword-shaped weapon equipment during each frame detection, the length of the cylinder is approximately equal to the length of the sword, and the diameter of the bottom surface of the cylinder is larger than the maximum cross-sectional length of the sword-shaped weapon equipment, namely the cylinder is thicker than the sword-shaped weapon equipment and surrounds the sword-shaped weapon equipment. The cylinder may be slightly thicker than the sword weapon equipment, as shown in fig. 2a, or may be much thicker than the body, as shown in fig. 2 b.
The cylinder can be thick or thin, the thinner the current frame, the more accurate the collision detection is, but the probability of detecting the collision is reduced, and the thicker the current frame, although the probability of detecting the collision is improved, the detection accuracy is reduced, and the misjudgment is caused, as shown in fig. 2b, the circle on the left of the sword-shaped weapon equipment represents a non-target object, and the object is detected to intersect with the cylinder because the cylinder is thick.
In order to solve the above problems, the present invention provides a collision detection method, which can prevent target objects from being omitted and can also prevent non-target objects from being misjudged, thereby improving detection accuracy.
In accordance with an embodiment of the present invention, there is provided a collision detection method, it should be noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
Fig. 3 is a flow chart of a collision detection method according to an embodiment of the present invention, as shown in fig. 3, the method including the steps of:
step S302, a first movement position of the virtual object at a first moment and a second movement position of the virtual object at a second moment are obtained, and the second moment is the next moment adjacent to the first moment;
the virtual object in the above step may be weapon equipment that can attack a target at a close distance, such as a sword, a knife, or a dagger used by a game character in an action game, and the attack operation is performed by the game character waving the weapon equipment, but is not limited thereto.
Because the game program is executed by the CPU according to frames, in order to realize more accurate collision detection, the positions of the virtual objects in two adjacent frames of images can be acquired in the process of attacking when the game character waves the virtual objects, and the first motion position and the second motion position of the virtual objects at two adjacent moments are determined, wherein the two motion positions are different.
Step S304, establishing a virtual geometric body connected with the first motion position and the second motion position;
optionally, the virtual geometric solid in the above step may be a virtual cuboid, a virtual cylinder, a virtual ellipsoid, and the like, but is not limited thereto, and in the embodiment of the present invention, the virtual cylinder is taken as an example for description.
In an alternative embodiment, the movement positions of the virtual object at two adjacent moments are different, and a virtual cylinder may be constructed between the two different movement positions, so that the virtual cylinder may cover all areas where the virtual object moves from the first movement position to the second movement position.
Step S306, collision detection is carried out on the target object through the virtual geometric body, so as to determine whether the virtual object collides with the target object in the process of moving from the first motion position to the second motion position.
In an alternative embodiment, after the virtual cylinder is constructed, collision detection may be performed by using the virtual cylinder and the target object, and since the constructed virtual cylinder is connected to the first motion position and the second motion position, that is, the virtual cylinder is located between the motion positions of the virtual object at two adjacent moments, collision detection may be performed by using the virtual cylinder, so that the target object may be prevented from being omitted, and a non-target object may be prevented from being misjudged.
It should be noted that the above-mentioned collision detection method can be implemented by using the existing collision detection method, and the present invention is not limited to this. For example, a virtual geometric body may be constructed at the position of the target object, the virtual geometric body connected to the first movement position and the second movement position is detected with the virtual geometric body constructed at the target object, whether the two virtual geometric bodies intersect with each other in space is determined, if yes, it is determined that a collision occurs, and if not, it is determined that no collision occurs.
Through the above embodiment of the present invention, after the first motion position and the second motion position of the virtual object at two adjacent moments, the virtual geometric object connected to the first motion position and the second motion position may be established, and through performing collision detection on the virtual geometric object and the target object, it is determined whether the virtual object collides with the target object in the process of moving from the first motion position to the second motion position, so as to achieve the purpose of determining whether the virtual object attacks the target object. It is easy to notice that, because the virtual geometric solid is connected to different motion positions at two adjacent moments and is not established at the position where the virtual object is located at a certain moment, whether the virtual object collides with the target object at a certain moment between two frames of images can be accurately detected, and misjudgment of other non-target objects can be avoided, so that the technical effects of improving the detection accuracy and improving the probability of detecting the collision are achieved, and the technical problem that misjudgment is easily caused by detecting the collision detection method according to frames in the related art, and the detection accuracy is reduced is solved.
Alternatively, in the above embodiment of the present invention, the step S304 of establishing a virtual geometry connected to the first moving position and the second moving position includes: acquiring first positions of a plurality of target points on the virtual object in the first image and second positions of the target points in the second image, wherein the target points are selected between the head and the tail of the virtual object; acquiring first positions of a plurality of target points on the virtual object at a first moment and second positions of the plurality of target points at a second moment, wherein the plurality of target points are target points selected between the head and the tail of the virtual object; and constructing a virtual geometric body between the target points of each group of different positions based on the first position and the second position to obtain a plurality of virtual geometric bodies.
Optionally, the target points may be selected at equal intervals between the head and the tail of the virtual object, but not limited thereto, and the target points may also be selected at unequal intervals. Wherein the head may refer to an end of the virtual object that is remote from the game character, and the tail may refer to an end of the virtual object that is held by the game character. Also, in an alternative embodiment, the tail of the virtual object remains substantially stationary during the swinging of the virtual object by the game character.
In order to avoid that the virtual geometry is thicker and affects the detection accuracy, the thickness of the virtual geometry may be determined according to the interval between the target points, wherein, in the case of the virtual cylinder, the diameter of the bottom surface of the virtual cylinder is smaller than or equal to the interval between the adjacent target points.
In an alternative embodiment, a target point may be selected on the virtual object at intervals of a certain length, for example m, from the head to the tail of the virtual object. For example, for a sword-shaped weapon equipment, three target points may be selected equally spaced from the sword head (i.e. the head mentioned above) to the sword handle (i.e. the tail mentioned above), as shown in fig. 4a, and at a first time, the first positions of the three target points are A, B and C, respectively; at a second time, the second positions of the three target points are A ', B ' and C ', respectively. For the same target point, the positions of the first time and the second time are different, so that a virtual cylinder can be constructed between the two different positions, and a plurality of virtual cylinders can be constructed due to the fact that the target points are multiple. For example, for sword weapons, as shown in FIG. 4B, virtual cylinders can be constructed between A and A ', B and B ', C and C ', respectively, resulting in three virtual cylinders, the diameter of the bottom surface of which can be m or slightly less.
Optionally, in the foregoing embodiment of the present invention, the constructing a virtual geometric body between the target points at each set of different positions based on the first position and the second position, and the obtaining a plurality of virtual geometric bodies includes: acquiring connecting lines between target points at different positions of each group based on the first position and the second position to obtain a plurality of target connecting lines; and respectively constructing virtual geometric bodies according to the target connecting lines to obtain a plurality of virtual geometric bodies.
Alternatively, the target connecting line may be a straight line between target points at different positions in each group. In an alternative embodiment, the first position and the second position may be linearly connected to the same target point, and a virtual cylinder may be created with the connecting line as a central axis. For example, for sword weapons, as shown in FIG. 4B, A and A 'may be linearly connected, creating a virtual cylinder centered on line AA', B and B 'may be linearly connected, creating a virtual cylinder centered on line BB', and finally C and C 'may be linearly connected, creating a virtual cylinder centered on line CC'.
It should be noted that, as shown in fig. 4b, if the position of the target object is further away from the position of the gripper handle of the gripper-shaped weapon equipment, and exceeds the diameter of the bottom surface of the cylinder, the detection may fail. In order to further improve the detection accuracy, optionally, the target connecting line may be a straight line arc between each set of target points at different positions, wherein the arc is centered at a center corresponding to the arc of motion of the virtual object. In an alternative embodiment, the arc is centered on the tail of the virtual object while the tail of the virtual object remains substantially stationary.
In an alternative embodiment, for the same target point, the first position and the second position may be connected by an arc having a center corresponding to the arc of motion of the virtual object as a center, and the virtual cylinder may be created by using the arc as a center axis. For example, for sword weaponry, as shown in FIG. 5a, A and A 'are connected around a sword handle O, a virtual cylinder is created around an arc AA', B and B 'are connected around a sword handle O, a virtual cylinder is created around an arc BB', and finally C and C 'are connected around a sword handle O, and a virtual cylinder is created around an arc CC'.
Optionally, in the above embodiment of the present invention, the step of constructing a virtual geometric object according to the target connection line to obtain a plurality of virtual geometric objects includes: determining at least one intermediate point on the target link; determining a connecting line between any two adjacent points in each group of target points at different positions and at least one intermediate point to obtain a plurality of sub-straight lines; and constructing virtual geometric bodies according to the sub-straight lines to obtain a plurality of virtual geometric bodies.
In an alternative embodiment, the virtual cylinders cannot be directly constructed for the arc, so for the same target point, an intermediate point is taken on the arc every length n, the end points of the arc and the intermediate points selected every length n are connected by straight lines, and the straight lines obtained by the connection are used as central axes to create a plurality of virtual cylinders.
It should be noted that, because the distances between different target points and the tail of the virtual object are different, the lengths of the arcs determined by the different target points are different, and on this basis, the number of the intermediate points determined on each arc is different. Further, if the arc length is short, the virtual cylinder may be constructed by directly using the straight line between two different positions as the central axis without selecting the middle point.
For example, for sword-shaped weaponry, as shown in fig. 5b, for arc line AA ', two intermediate points may be selected, A, A' is connected to two adjacent points of the two selected intermediate points to obtain three connecting lines, and further, each connecting line is used as a central axis to construct a virtual cylinder, thereby obtaining three virtual cylinders; for the arc line BB ', which is shorter than the arc line AA ', one intermediate point may be selected, B, B ' is connected to two adjacent points of the two selected intermediate points to obtain two connecting lines, and each connecting line is further used as a central axis to construct a virtual cylinder, thereby obtaining two virtual cylinders; for the arc CC ', since it is shorter than the arc BB ', it is possible to directly connect C and C ' without selecting an intermediate point, and further construct a virtual cylinder with the connecting line as a central axis, thereby obtaining a virtual cylinder.
According to an embodiment of the present invention, there is also provided a collision detection apparatus, which can perform the collision detection method in embodiment 1, and a preferred embodiment is as described in embodiment 1, and details are not described herein.
Fig. 6 is a schematic diagram of a collision detecting apparatus according to an embodiment of the present invention, as shown in fig. 6, the apparatus including:
an obtaining module 62, configured to obtain a first motion position of the virtual object at a first time and a second motion position of the virtual object at a second time, where the second time is a next time adjacent to the first time;
an establishing module 64 for establishing a virtual geometry connected to the first motion position and the second motion position;
and the detection module 66 is configured to perform collision detection with the target object through the virtual geometric body to determine whether the virtual object collides with the target object during moving from the first motion position to the second motion position.
Optionally, in the foregoing embodiment of the present invention, the establishing module includes: the device comprises an acquisition unit, a judgment unit and a display unit, wherein the acquisition unit is used for acquiring first positions of a plurality of target points on a virtual object at a first moment and second positions of the plurality of target points at a second moment, and the plurality of target points are selected from the head and the tail of the virtual object; and the constructing unit is used for constructing virtual geometric bodies between the target points at each group of different positions based on the first position and the second position to obtain a plurality of virtual geometric bodies.
Optionally, in the above embodiment of the present invention, the constructing unit is further configured to perform the following steps: acquiring connecting lines between target points at different positions of each group based on the first position and the second position to obtain a plurality of target connecting lines; and respectively constructing virtual geometric bodies according to the target connecting lines to obtain a plurality of virtual geometric bodies.
Optionally, in a case that the target link is an arc between target points at each set of different positions, the construction unit is further configured to perform the following steps: determining at least one intermediate point on the target link; determining a connecting line between any two adjacent points in each group of target points at different positions and at least one intermediate point to obtain a plurality of sub-straight lines; and constructing virtual geometric bodies according to the sub-straight lines to obtain a plurality of virtual geometric bodies.
According to an embodiment of the present invention, there is also provided a storage medium including a stored program, wherein the apparatus in which the storage medium is located is controlled to execute the collision detection method in embodiment 1 described above when the program runs.
As shown in fig. 7, a program product 700 according to an embodiment of the invention is depicted, on which a computer program is stored which, when being executed by a processor, realizes the program code of the following steps:
acquiring a first movement position of the virtual object at a first moment and a second movement position of the virtual object at a second moment, wherein the second moment is the next moment adjacent to the first moment;
establishing a virtual geometry connected to the first motion location and the second motion location;
and performing collision detection on the virtual geometric body and the target object to determine whether the virtual object collides with the target object in the process of moving from the first motion position to the second motion position.
Optionally, the computer program further realizes program code for, when executed by a processor:
acquiring first positions of a plurality of target points on the virtual object at a first moment and second positions of the plurality of target points at a second moment, wherein the plurality of target points are target points selected between the head and the tail of the virtual object;
and constructing a virtual geometric body between the target points of each group of different positions based on the first position and the second position to obtain a plurality of virtual geometric bodies.
Optionally, the computer program further realizes program code for, when executed by a processor:
acquiring connecting lines between target points at different positions of each group based on the first position and the second position to obtain a plurality of target connecting lines;
and respectively constructing virtual geometric bodies according to the target connecting lines to obtain a plurality of virtual geometric bodies.
Optionally, the computer program further realizes program code for, when executed by a processor:
determining at least one intermediate point on the target link if the target link is an arc between each set of target points at different locations;
determining a connecting line between any two adjacent points in each group of target points at different positions and at least one intermediate point to obtain a plurality of sub-straight lines;
and constructing virtual geometric bodies according to the sub-straight lines to obtain a plurality of virtual geometric bodies.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
A computer readable storage medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable storage medium may transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied in a computer readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
According to an embodiment of the present invention, there is also provided a processor configured to run a program, where the program executes the collision detection method in embodiment 1.
The processor may be arranged to perform the steps of:
acquiring a first movement position of the virtual object at a first moment and a second movement position of the virtual object at a second moment, wherein the second moment is the next moment adjacent to the first moment;
establishing a virtual geometry connected to the first motion location and the second motion location;
and performing collision detection on the virtual geometric body and the target object to determine whether the virtual object collides with the target object in the process of moving from the first motion position to the second motion position.
Optionally, the processor may be further configured to perform the steps of:
acquiring first positions of a plurality of target points on the virtual object at a first moment and second positions of the plurality of target points at a second moment, wherein the plurality of target points are target points selected between the head and the tail of the virtual object;
and constructing a virtual geometric body between the target points of each group of different positions based on the first position and the second position to obtain a plurality of virtual geometric bodies.
Optionally, the processor may be further configured to perform the steps of:
acquiring connecting lines between target points at different positions of each group based on the first position and the second position to obtain a plurality of target connecting lines;
and respectively constructing virtual geometric bodies according to the target connecting lines to obtain a plurality of virtual geometric bodies.
Optionally, the processor may be further configured to perform the steps of:
determining at least one intermediate point on the target link if the target link is an arc between each set of target points at different locations;
determining a connecting line between any two adjacent points in each group of target points at different positions and at least one intermediate point to obtain a plurality of sub-straight lines;
and constructing virtual geometric bodies according to the sub-straight lines to obtain a plurality of virtual geometric bodies.
As shown in fig. 8, the apparatus of the present embodiment includes: the processor 210 and the storage medium 220 are connected by a bus 230. Wherein, the storage medium 220 is used for storing the executable instructions of the processor, and the executable instructions can be computer programs; the processor 210 is configured to implement the following steps via execution of the executable instructions:
acquiring a first movement position of the virtual object at a first moment and a second movement position of the virtual object at a second moment, wherein the second moment is the next moment adjacent to the first moment;
establishing a virtual geometry connected to the first motion location and the second motion location;
and performing collision detection on the virtual geometric body and the target object to determine whether the virtual object collides with the target object in the process of moving from the first motion position to the second motion position.
Optionally, the processor 210 is further configured to implement the following steps via executing the executable instructions:
acquiring first positions of a plurality of target points on the virtual object at a first moment and second positions of the plurality of target points at a second moment, wherein the plurality of target points are target points selected between the head and the tail of the virtual object;
and constructing a virtual geometric body between the target points of each group of different positions based on the first position and the second position to obtain a plurality of virtual geometric bodies.
Optionally, the processor 210 is further configured to implement the following steps via executing the executable instructions:
acquiring connecting lines between target points at different positions of each group based on the first position and the second position to obtain a plurality of target connecting lines;
and respectively constructing virtual geometric bodies according to the target connecting lines to obtain a plurality of virtual geometric bodies.
Optionally, the processor 210 is further configured to implement the following steps via executing the executable instructions:
determining at least one intermediate point on the target link if the target link is an arc between each set of target points at different locations;
determining a connecting line between any two adjacent points in each group of target points at different positions and at least one intermediate point to obtain a plurality of sub-straight lines;
and constructing virtual geometric bodies according to the sub-straight lines to obtain a plurality of virtual geometric bodies.
In alternative embodiments, the device may further include one or more processors, and memory resources, represented by memory, for storing instructions, such as application programs, that are executable by the processing components. The application program stored in the memory may include one or more modules that each correspond to a set of instructions. Further, the processing component is configured to execute the instructions to perform the information processing method described above.
The apparatus may further include: a power component configured to power manage an executing electronic device; a wired or wireless network interface configured to connect the electronic device to a network; and an input-output (I/O) interface. The electronic device may operate based on an operating system stored in memory, such as Android, iOS, Windows, Mac OS X, Unix, Linux, FreeBSD, or the like.
It will be understood by those skilled in the art that the structure shown in fig. 8 is merely illustrative, and the Devices may be smart phones, tablet computers, palmtop computers, Mobile Internet Devices (MIDs), PADs and other electronic Devices. Fig. 8 does not limit the structure of the above-described apparatus. For example, the device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 8, or have a different configuration than shown in FIG. 8.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (14)

1. A collision detection method, characterized by comprising:
acquiring a first movement position of a virtual object at a first moment and a second movement position of the virtual object at a second moment, wherein the second moment is a next moment adjacent to the first moment;
establishing a virtual geometry connected to the first motion location and the second motion location;
and performing collision detection on the virtual geometric body and a target object to determine whether the virtual object collides with the target object in the process of moving from the first motion position to the second motion position.
2. The method of claim 1, wherein the step of establishing a virtual geometry connected to the first motion location and the second motion location comprises:
acquiring first positions of a plurality of target points on the virtual object at the first moment and second positions of the plurality of target points at the second moment, wherein the plurality of target points are selected between the head and the tail of the virtual object;
and constructing virtual geometric bodies between the target points of each group of different positions based on the first position and the second position to obtain a plurality of virtual geometric bodies.
3. The method of claim 2, wherein the step of constructing a virtual geometry between the target points at each of the different positions based on the first and second positions to obtain a plurality of virtual geometries comprises:
determining a connecting line between the target points of each group of different positions based on the first position and the second position to obtain a plurality of target connecting lines;
and respectively constructing virtual geometric bodies according to the target connecting lines to obtain the plurality of virtual geometric bodies.
4. The method of claim 3, wherein the target connecting line is a straight line or an arc between the target points of each set of different positions, and wherein the arc is centered on a center corresponding to the arc of motion of the virtual object.
5. The method of claim 4, wherein in the case that the target connecting line is an arc between the target points in each group of different positions, the step of constructing virtual geometric objects according to the target connecting line to obtain the plurality of virtual geometric objects comprises:
determining at least one intermediate point on the target link;
determining a connecting line between any two adjacent points in each group of target points at different positions and the at least one intermediate point to obtain a plurality of sub-straight lines;
and constructing virtual geometric bodies according to the sub straight lines to obtain the plurality of virtual geometric bodies.
6. The method of any one of claims 1 to 5, wherein the virtual geometric volume is a virtual cylinder having a base diameter less than or equal to the spacing between adjacent target points.
7. The method of claim 6, wherein the plurality of target points are target points chosen at equal intervals between a head and a tail of the virtual object.
8. A collision detecting apparatus, characterized by comprising:
the device comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring a first motion position of a virtual object at a first moment and a second motion position of the virtual object at a second moment, and the second moment is the next moment adjacent to the first moment;
an establishing module for establishing a virtual geometry connected to the first motion position and the second motion position;
and the detection module is used for performing collision detection on the virtual geometric body and a target object so as to determine whether the virtual object collides with the target object in the process of moving from the first motion position to the second motion position.
9. The apparatus of claim 8, wherein the establishing module comprises:
an obtaining unit, configured to obtain first positions, at which a plurality of target points are located at the first time, and second positions, at which the plurality of target points are located at the second time, on the virtual object, where the plurality of target points are target points selected between a head and a tail of the virtual object;
and the constructing unit is used for constructing virtual geometric bodies between the target points at each group of different positions based on the first position and the second position to obtain a plurality of virtual geometric bodies.
10. The apparatus according to claim 9, wherein the construction unit is further configured to perform the steps of:
determining a connecting line between the target points of each group of different positions based on the first position and the second position to obtain a plurality of target connecting lines;
and respectively constructing virtual geometric bodies according to the target connecting lines to obtain the plurality of virtual geometric bodies.
11. The apparatus of claim 10, wherein the target connecting line is a straight line or an arc between the target points of each group of different positions, and wherein the arc is centered on a center corresponding to the arc of motion of the virtual object.
12. The apparatus of claim 11, wherein in the case that the target link is an arc between the target points of each of the different sets of positions, the construction unit is further configured to perform the following steps:
determining at least one intermediate point on the target link;
determining a connecting line between any two adjacent points in each group of target points at different positions and the at least one intermediate point to obtain a plurality of sub-straight lines;
and constructing virtual geometric bodies according to the sub straight lines to obtain the plurality of virtual geometric bodies.
13. A storage medium, characterized in that the storage medium comprises a stored program, wherein a device in which the storage medium is located is controlled to perform the collision detection method according to any one of claims 1 to 7 when the program is run.
14. A processor, characterized in that the processor is configured to run a program, wherein the program is configured to execute the collision detection method according to any one of claims 1 to 7 when running.
CN202010745774.2A 2020-07-29 2020-07-29 Collision detection method and device Pending CN111773723A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010745774.2A CN111773723A (en) 2020-07-29 2020-07-29 Collision detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010745774.2A CN111773723A (en) 2020-07-29 2020-07-29 Collision detection method and device

Publications (1)

Publication Number Publication Date
CN111773723A true CN111773723A (en) 2020-10-16

Family

ID=72765455

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010745774.2A Pending CN111773723A (en) 2020-07-29 2020-07-29 Collision detection method and device

Country Status (1)

Country Link
CN (1) CN111773723A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112774204A (en) * 2021-01-22 2021-05-11 北京字跳网络技术有限公司 Role collision avoidance method, device, equipment and storage medium
CN113134239A (en) * 2021-05-13 2021-07-20 网易(杭州)网络有限公司 Rendering method, rendering device, electronic equipment and computer-readable storage medium
CN113244622A (en) * 2021-06-22 2021-08-13 腾讯科技(深圳)有限公司 Collision data processing method and device, storage medium and electronic equipment
WO2022218104A1 (en) * 2021-04-15 2022-10-20 北京字跳网络技术有限公司 Collision processing method and apparatus for virtual image, and electronic device and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005316927A (en) * 2004-04-29 2005-11-10 Konami Co Ltd Display device, display method and program
US20080129734A1 (en) * 2006-12-05 2008-06-05 Electronics And Telecommunications Research Institute Apparatus and method of ray-triangle collision detection for ray-tracing
US20180040101A1 (en) * 2015-11-30 2018-02-08 Tencent Technology (Shenzhen) Company Limited Method for detecting collision between cylindrical collider and convex body in real-time virtual scenario, terminal, and storage medium
CN108714303A (en) * 2018-05-16 2018-10-30 深圳市腾讯网络信息技术有限公司 Collision checking method, equipment and computer readable storage medium
US20180357817A1 (en) * 2017-06-12 2018-12-13 Colopl, Inc. Information processing method, program, and computer
CN110180182A (en) * 2019-04-28 2019-08-30 腾讯科技(深圳)有限公司 Collision checking method, device, storage medium and electronic device
US20200079370A1 (en) * 2018-09-06 2020-03-12 Zebra Technologies Corporation Dual-mode data capture system for collision detection and object dimensioning
CN110917623A (en) * 2019-11-20 2020-03-27 腾讯科技(深圳)有限公司 Interactive information display method, device, terminal and storage medium
CN111054066A (en) * 2019-12-17 2020-04-24 腾讯科技(深圳)有限公司 Operation method and device of virtual prop, storage medium and electronic device
CN111437606A (en) * 2020-03-30 2020-07-24 腾讯科技(深圳)有限公司 Collision detection method and device, storage medium and electronic device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005316927A (en) * 2004-04-29 2005-11-10 Konami Co Ltd Display device, display method and program
US20080129734A1 (en) * 2006-12-05 2008-06-05 Electronics And Telecommunications Research Institute Apparatus and method of ray-triangle collision detection for ray-tracing
US20180040101A1 (en) * 2015-11-30 2018-02-08 Tencent Technology (Shenzhen) Company Limited Method for detecting collision between cylindrical collider and convex body in real-time virtual scenario, terminal, and storage medium
US20180357817A1 (en) * 2017-06-12 2018-12-13 Colopl, Inc. Information processing method, program, and computer
CN108714303A (en) * 2018-05-16 2018-10-30 深圳市腾讯网络信息技术有限公司 Collision checking method, equipment and computer readable storage medium
US20200079370A1 (en) * 2018-09-06 2020-03-12 Zebra Technologies Corporation Dual-mode data capture system for collision detection and object dimensioning
CN110180182A (en) * 2019-04-28 2019-08-30 腾讯科技(深圳)有限公司 Collision checking method, device, storage medium and electronic device
CN110917623A (en) * 2019-11-20 2020-03-27 腾讯科技(深圳)有限公司 Interactive information display method, device, terminal and storage medium
CN111054066A (en) * 2019-12-17 2020-04-24 腾讯科技(深圳)有限公司 Operation method and device of virtual prop, storage medium and electronic device
CN111437606A (en) * 2020-03-30 2020-07-24 腾讯科技(深圳)有限公司 Collision detection method and device, storage medium and electronic device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112774204A (en) * 2021-01-22 2021-05-11 北京字跳网络技术有限公司 Role collision avoidance method, device, equipment and storage medium
CN112774204B (en) * 2021-01-22 2023-10-20 北京字跳网络技术有限公司 Role collision avoidance method, device, equipment and storage medium
WO2022218104A1 (en) * 2021-04-15 2022-10-20 北京字跳网络技术有限公司 Collision processing method and apparatus for virtual image, and electronic device and storage medium
CN113134239A (en) * 2021-05-13 2021-07-20 网易(杭州)网络有限公司 Rendering method, rendering device, electronic equipment and computer-readable storage medium
CN113134239B (en) * 2021-05-13 2024-06-04 网易(杭州)网络有限公司 Rendering method, rendering device, electronic equipment and computer readable storage medium
CN113244622A (en) * 2021-06-22 2021-08-13 腾讯科技(深圳)有限公司 Collision data processing method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN111773723A (en) Collision detection method and device
CN110246163B (en) Image processing method, image processing device, image processing apparatus, and computer storage medium
CN111228802B (en) Information prompting method and device, storage medium and electronic device
KR102629359B1 (en) Virtual object attack prompt method and device, and terminal and storage medium
CN109670291B (en) Verification code implementation method and device and storage medium
CN111249719B (en) Track prompting method and device, storage medium and electronic device
CN105335064A (en) Information processing method, terminal, and computer storage medium
CN111054066B (en) Operation method and device of virtual prop, storage medium and electronic device
CN111672109B (en) Game map generation method, game testing method and related device
CN110465087B (en) Virtual article control method, device, terminal and storage medium
CN103501287A (en) Method and equipment for determining hit motion object in game operation process
WO2017133584A1 (en) Method of determining spatial location of controlled object and device
CN109983424B (en) Method and device for selecting object in virtual reality scene and virtual reality equipment
CN111773673B (en) Skill releasing method and device, electronic equipment and storage medium
JP2020507847A (en) Object moving method and apparatus, storage medium, and electronic device
CN116310745A (en) Image processing method, data processing method, related device and storage medium
CN113262482B (en) Object control method and device, storage medium and electronic equipment
EP4343699A1 (en) Method and apparatus for controlling virtual object, and computer device and storage medium
CN109920057B (en) Viewpoint transformation method and device, computing equipment and storage medium
CN113713392B (en) Virtual character control method and device, storage medium and electronic equipment
CN113577766B (en) Object processing method and device
CN111773694B (en) Control method and device of virtual operation object and storage medium
CN114011069A (en) Control method of virtual object, storage medium and electronic device
CN114288662A (en) NPC behavior control method and device and electronic equipment
CN113599821A (en) Method and device for displaying current blood volume of virtual character

Legal Events

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