CN111249719B - Track prompting method and device, storage medium and electronic device - Google Patents
Track prompting method and device, storage medium and electronic device Download PDFInfo
- Publication number
- CN111249719B CN111249719B CN202010067341.6A CN202010067341A CN111249719B CN 111249719 B CN111249719 B CN 111249719B CN 202010067341 A CN202010067341 A CN 202010067341A CN 111249719 B CN111249719 B CN 111249719B
- Authority
- CN
- China
- Prior art keywords
- target
- collision
- ball
- collision ball
- track
- 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.)
- Active
Links
Images
Classifications
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F7/00—Indoor games using small moving playing bodies, e.g. balls, discs or blocks
- A63F7/06—Games simulating outdoor ball games, e.g. hockey or football
- A63F7/0668—Games simulating outdoor ball games, e.g. hockey or football the ball being flicked with a finger or hit with a stick, cue or sliding disc which are not connected to the table
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F7/00—Indoor games using small moving playing bodies, e.g. balls, discs or blocks
- A63F7/22—Accessories; Details
- A63F7/30—Details of the playing surface, e.g. obstacles; Goal posts; Targets; Scoring or pocketing devices; Playing-body-actuated sensors, e.g. switches; Tilt indicators; Means for detecting misuse or errors
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F7/00—Indoor games using small moving playing bodies, e.g. balls, discs or blocks
- A63F7/22—Accessories; Details
- A63F7/36—Constructional details not covered by groups A63F7/24 - A63F7/34, i.e. constructional details of rolling boards, rims or play tables, e.g. frame, game boards, guide tracks
- A63F7/38—Playing surfaces movable during play, i.e. games played on a non-stationary surface, e.g. the ball intended to be in permanent motion
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F7/00—Indoor games using small moving playing bodies, e.g. balls, discs or blocks
- A63F7/22—Accessories; Details
- A63F7/30—Details of the playing surface, e.g. obstacles; Goal posts; Targets; Scoring or pocketing devices; Playing-body-actuated sensors, e.g. switches; Tilt indicators; Means for detecting misuse or errors
- A63F2007/3005—Obstacles, obstructions
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F7/00—Indoor games using small moving playing bodies, e.g. balls, discs or blocks
- A63F7/22—Accessories; Details
- A63F7/30—Details of the playing surface, e.g. obstacles; Goal posts; Targets; Scoring or pocketing devices; Playing-body-actuated sensors, e.g. switches; Tilt indicators; Means for detecting misuse or errors
- A63F2007/3025—Details of the playing surface, e.g. obstacles; Goal posts; Targets; Scoring or pocketing devices; Playing-body-actuated sensors, e.g. switches; Tilt indicators; Means for detecting misuse or errors with means for indicating or regulating a start position, e.g. foul line
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Processing Or Creating Images (AREA)
Abstract
The invention discloses a track prompting method and device, a storage medium and an electronic device. Wherein, the method comprises the following steps: acquiring an adjusting instruction triggered by executing operation on a human-computer interaction interface presented in a client of a virtual billiard game, wherein the adjusting instruction is used for adjusting control operation applied to a target collision ball in a virtual desktop control area; responding to the adjusting instruction, and determining a target grid intersected with the target collision ball from a virtual desktop grid set matched with the virtual desktop control area; performing collision detection on the target grid to obtain a collision detection result, wherein the collision detection is used for detecting an object collision ball and/or an object collision edge which collide with the target collision ball; generating a target motion track corresponding to a target collision ball according to a collision detection result; and displaying the target motion trail on the client. The invention solves the technical problem of low auxiliary line generation efficiency in the related technology.
Description
Technical Field
The invention relates to the field of computers, in particular to a track prompting method and device, a storage medium and an electronic device.
Background
In the virtual table game, the movement locus of the white ball after being hit may be displayed in the form of a display auxiliary line before the white ball is hit. The auxiliary line is generally obtained by simulating the movement locus of the white ball after being hit.
In the related art, in acquiring the auxiliary line, it is necessary to detect the collision of the white ball. In the detection process, the white ball and each other ball or each edge are usually required to be detected in each frame, and the detection workload is huge, so that the efficiency of generating the auxiliary line is low.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a track prompting method and device, a storage medium and an electronic device, and aims to at least solve the technical problem of low auxiliary line generation efficiency in the related art.
According to an aspect of an embodiment of the present invention, there is provided a trajectory prompting method, including: acquiring an adjusting instruction triggered by executing operation on a human-computer interaction interface presented in a client of a virtual billiard game, wherein the adjusting instruction is used for adjusting control operation applied to a target collision ball in a virtual desktop control area; responding to the adjusting instruction, and determining a target grid intersected with the target collision ball from a virtual desktop grid set matched with the virtual desktop control area; performing collision detection on the target grid to obtain a collision detection result, wherein the collision detection is used for detecting an object collision ball and/or an object collision edge which collide with the target collision ball; generating a target motion track corresponding to the target collision ball according to the collision detection result; and displaying the target motion trail on the client.
According to another aspect of the embodiments of the present invention, there is also provided a trajectory prompting device, including: the game system comprises an acquisition unit, a processing unit and a control unit, wherein the acquisition unit is used for acquiring an adjustment instruction triggered by executing operation on a human-computer interaction interface presented in a client of a virtual billiard game, and the adjustment instruction is used for adjusting control operation applied to a target collision ball in a virtual desktop control area; a first determining unit, configured to determine, in response to the adjustment instruction, a target grid intersecting with the target collision ball from a set of virtual desktop grids matching the virtual desktop control area; the detection unit is used for carrying out collision detection on the target grid to obtain a collision detection result, wherein the collision detection is used for detecting an object collision ball and/or an object collision edge which collide with the target collision ball; the generating unit is used for generating a target motion track corresponding to the target collision ball according to the collision detection result; and the display unit is used for displaying the target motion trail on the client.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, where the computer program is configured to execute the trajectory prompting method when running.
According to another aspect of the embodiments of the present invention, there is also provided an electronic apparatus, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the trajectory prompting method through the computer program.
In the embodiment of the invention, an adjusting instruction triggered by executing operation on a human-computer interaction interface presented in a client of a virtual billiard game is acquired, wherein the adjusting instruction is used for adjusting control operation applied to a target collision ball in a virtual desktop control area; responding to the adjusting instruction, and determining a target grid intersected with the target collision ball from a virtual desktop grid set matched with the virtual desktop control area; performing collision detection on the target grid to obtain a collision detection result, wherein the collision detection is used for detecting an object collision ball and/or an object collision edge which collide with the target collision ball; generating a target motion track corresponding to the target collision ball according to the collision detection result; in the above manner, in the process of collision detection of the target collision ball, collision detection is performed on the target collision ball and the target mesh intersecting with the target collision ball, so that the detection times and detection workload in the collision detection process are greatly reduced, the collision detection efficiency is improved, and the auxiliary line generation efficiency is further improved. And the technical problem of low auxiliary line generation efficiency in the related technology 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. 1 is a schematic diagram of an application environment of an alternative trajectory prompting method according to an embodiment of the invention;
FIG. 2 is a flow chart illustrating an alternative trajectory prompting method according to an embodiment of the present invention;
FIG. 3 is a diagram of an alternative trajectory prompting method according to an embodiment of the present invention;
FIG. 4 is a diagram of another alternative trajectory prompting method according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of yet another alternative trajectory prompting method according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of yet another alternative trajectory prompting method according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating an alternative trajectory prompting method according to an embodiment of the present invention;
FIG. 8 is a diagram illustrating an alternative trajectory prompting method according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of yet another alternative trajectory prompting method according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of yet another alternative trajectory prompting method according to an embodiment of the present invention;
FIG. 11 is a diagram illustrating an alternative trajectory prompting method according to an embodiment of the present invention;
FIG. 12 is a diagram illustrating an alternative trajectory prompting method according to an embodiment of the present invention;
FIG. 13 is a schematic structural diagram of an alternative trajectory prompting device according to an embodiment of the present invention;
fig. 14 is a schematic structural diagram of an alternative electronic device 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.
According to an aspect of the embodiments of the present invention, there is provided a trajectory prompting method, which may be, but is not limited to, applied in the environment shown in fig. 1 as an optional implementation manner.
Human-computer interaction between the user 102 and the user device 104 in fig. 1 is possible. The user equipment 104 comprises a memory 106 for storing interaction data and a processor 108 for processing the interaction data. User device 104 may interact with server 112 via network 110. The server 112 includes a database 114 for storing interaction data and a processing engine 116 for processing the interaction data.
The user equipment 104 may obtain the adjustment instruction, and determine, in response to the adjustment instruction, a target grid intersecting with the target collision ball from a virtual desktop grid set matched with the virtual desktop control area; performing collision detection on the target grid to obtain a collision detection result, wherein the collision detection is used for detecting an object collision ball and/or an object collision edge which collide with the target collision ball; generating a target motion track corresponding to the target collision ball according to the collision detection result; and displaying the target motion trail on the client. By the method, the workload of collision detection in the process of generating the auxiliary line can be reduced, and the efficiency of generating the auxiliary line is improved.
Alternatively, the user device 104 may be, but is not limited to, a terminal such as a mobile phone, a tablet computer, a notebook computer, a PC, and the like, and the network 110 may include, but is not limited to, a wireless network or a wired network. Wherein, this wireless network includes: WIFI and other networks that enable wireless communication. Such wired networks may include, but are not limited to: wide area networks, metropolitan area networks, and local area networks. The server may include, but is not limited to, any hardware device capable of performing computations. The client may be, but not limited to, software installed on the terminal, a web page or a plug-in running in the software, and the like.
Optionally, as an optional implementation manner, as shown in fig. 2, the trajectory prompting method includes:
s102, acquiring an adjusting instruction triggered by executing operation on a human-computer interaction interface presented in a client of the virtual billiard game, wherein the adjusting instruction is used for adjusting control operation applied to a target collision ball in a virtual desktop control area;
s104, responding to the adjusting instruction, and determining a target grid intersected with the target collision ball from the virtual desktop grid set matched with the virtual desktop control area;
s106, performing collision detection on the target grid to obtain a collision detection result, wherein the collision detection is used for detecting an object collision ball and/or an object collision edge which collide with the target collision ball;
s108, generating a target motion track corresponding to the target collision ball according to the collision detection result;
and S110, displaying the target motion track on the client.
Alternatively, the trajectory prompting method may be applied, but not limited to, in the field of games, such as games that are installed on a terminal in a software form, web games that run through web pages, games that run through plug-ins, cloud games, and the like.
Taking a game running on the terminal as an example, the terminal can be provided with a client, and the client runs a virtual billiard game. And the client displays a human-computer interaction interface. Acquiring an adjusting instruction on a human-computer interaction interface, responding to the adjusting instruction, and determining a target grid intersected with a target collision ball from a virtual desktop grid set matched with a virtual desktop control area; performing collision detection on the target grid to obtain a collision detection result, wherein the collision detection is used for detecting an object collision ball and/or an object collision edge which collide with the target collision ball; generating a target motion track corresponding to a target collision ball according to a collision detection result; and displaying a target motion trail on the client, wherein the target motion trail is an auxiliary line in the virtual table game. The display result may be as shown in fig. 3.
By the method, the efficiency of generating the auxiliary line in the virtual table game is improved.
Optionally, in the present scheme, in the process of obtaining the adjustment instruction, the adjustment instruction may be obtained through a touch instruction received by the human-computer interaction interface. For example, the user may touch the human-computer interface to control the direction of the batting rod and the batting force of the batting rod in the virtual table game, and generate the adjustment instruction. The touch operation may be any operation such as clicking, long-pressing, sliding, dragging, and the like. After receiving the adjustment instruction, the client may determine a virtual desktop grid set, where the virtual desktop may be a billiard sphere in a virtual billiard game, and the billiard sphere is cut to obtain multiple grids, where the cutting method may be an average method, and the virtual desktop is cut into multiple grids of the same size or multiple grids of different sizes. The target mesh is included in the plurality of meshes. Taking the same size of the grid as an example, each grid can record the ball information of the object colliding with the ball intersecting with the grid and the side information of the colliding side of the object. The object collision ball may be a ball other than a white ball, the object collision edge being an edge of the virtual table, or a part of the edge. The target grid intersects with a target collision ball, which is a ball, typically a white ball, struck by the cue. And performing collision detection on the target grid to determine the target motion track of the target collision ball. Then, the target movement locus is displayed, thereby displaying an auxiliary line during the stroke.
Optionally, in the scheme, after the adjustment instruction is obtained, the simulated motion trajectory of the target collision may be determined. The simulated motion trajectory is a trajectory in which the client terminal simulates the motion of the target collision ball under the influence of the force after determining the magnitude and direction of the force to be applied to the target collision ball after receiving the adjustment instruction. The simulation process is a virtual process, and the movement of the target collision ball cannot be displayed on a human-computer interaction interface of the client. During the simulation, the simulated motion trajectory of the target impact ball may be a curve or a straight line. The reason is that the target impact ball may carry an initial angular velocity when subjected to a force. The initial angular velocity is the force that controls the rotation of the target hitting the ball. Alternatively, the target collision ball may collide with the object while simulating the motion trajectory as a curved line after the target collision ball collides with the object. And if the simulated motion track of the target collision ball is a curve, determining a target grid according to the adjustment instruction, and further determining the motion track of the target. And if the simulated motion track is a straight line or a broken line, directly determining the simulated motion track as the target motion track.
In determining whether the simulated motion trajectory is a curved line, it may be determined whether there is a rotational angular velocity applied to the target impact ball. Rotational angular velocity can cause an object impacting the ball to deflect during movement. If the rotation angular velocity does not exist, whether the first collision of the object collision ball is collision with the object collision ball or collision with the object while collision is judged, if the first collision is collision with the object collision ball, the simulation motion track is a straight line or a broken line, and if the first collision is collision with the object while collision is judged, the simulation motion track is a curve.
Optionally, in the scheme, in the process of performing collision detection on the target grid to obtain a collision detection result, it is required to detect whether the target collision ball collides with the object collision ball or collides with the object.
When detecting whether collision occurs with an object collision side, acquiring side information of the object collision side intersecting with the target grid, wherein the side information comprises a first position of a first end point of the object collision side and a second position of a second end point of the object collision side; acquiring a target position of a target collision ball; determining that the target collision ball collides with the object collision edge under the condition that the product of a first vector formed by the target position and the first position and a second vector formed by the target position and the second position is larger than zero and the distance between the target position and the object collision edge is smaller than r, wherein r is the radius of the target collision ball; and determining the track point of the target collision ball as a collision detection result.
Alternatively, the side information may be a portion of the virtual table located in the target grid, the portion being a segment of one side of the virtual table. The side information stores the position information of two end points of the side in the target grid. If the collision of the target collision ball and the object is detected, collision is generated.
When whether collision with an object collision ball occurs or not is detected, ball information of the object collision ball intersected with the target grid is obtained, wherein the ball information comprises a third position of the object collision ball; acquiring a target position of a target collision ball; determining that the target collision ball collides with the object collision ball under the condition that the distance between the third position and the target position is less than 2r, wherein r is the radius of the target collision ball; and determining the track point of the target collision ball as a collision detection result.
The track points can be sampling points obtained by sampling the position of the target collision ball every preset time in the process of simulating the movement of the target collision ball.
Through the method, the collision detection is carried out on the collision edges of the target collision ball, the object collision ball and the object, and the motion track of the target collision ball after collision can be determined.
Optionally, in the process of acquiring the sampling point, if after the position of a target collision ball is acquired, the distance between the position of the target collision ball and the position of the last sampling point is less than twice the radius of the target collision ball, the position of the target collision ball is not used as the sampling point. After a predetermined period of time, the next acquisition of the position of the target impact ball is performed. And if the distance between the position of the target collision ball and the position of the last sampling point is more than or equal to twice the radius of the target collision ball after the position of the target collision ball is obtained, determining the position of the target collision ball as the position of one sampling point. The initial position of the target impact ball may be the first locus point.
If the track points of the target collision ball are obtained, the track points can be connected by using line segments to obtain the target motion track. The target motion trail can be displayed on the client.
Optionally, after the track points are obtained, the track points can be re-sampled for the second time. Acquiring the target number of track points in a collision detection result; under the condition that the target number is larger than a first threshold value, extracting N points from the track points as new track points, wherein N is determined according to the performance of a terminal of an operating client, N is a positive integer, and N is smaller than the target number; and generating a target motion track according to the new track points.
Alternatively, the performance of the terminal may include the computing capability of the hardware of the terminal.
Optionally, in the scheme, the operation amount in the process of generating the auxiliary line can be further reduced through coarse adjustment and fine adjustment. If the target motion trail is roughly adjusted, a drawing request is received before the target motion trail is displayed on the client, the drawing request is used for requesting to display the target motion trail, the drawing request is not adjusted immediately, the preset time duration is waited, and if a new drawing request is received within the preset time duration, the old drawing request is replaced by the new drawing request. And if the new drawing request is not received, executing the original drawing request. And if the fine adjustment is carried out, responding to the drawing request in real time.
The drawing request of the present solution may be included in the adjustment instruction, or may be the same as the adjustment instruction, or the drawing request and the adjustment instruction are obtained separately.
The method in the present embodiment will be described below by taking a virtual billiards game as an example.
Table tennis: also known as billiards, an internationally popular indoor sport, is an indoor entertainment sport that hits balls on a table with a ball bar and determines victory or defeat depending on scores
Hitting: the ball arm aims at the white ball (target collision ball) to make collision, and makes the white ball strike the target ball (target collision ball)
Batting strength: force of ball rod striking white ball
Hitting the ball and aligning the ball: when the club aims at the white ball, the tail end of the club hits the position of the surface of the white ball
Hitting and plugging: the hitting center deviates from the center point of the white ball surface, and the rotating angular velocities in different directions can be generated according to the deviated direction
A ball hitting auxiliary line: after the ball rod aims at the white ball, the motion track of the white ball before the ball meets the ball is accurately predicted according to the force and the blocking condition of the ball rod, and the track is formed by splicing line segment sets connected by position sampling data points.
Real-time physical simulation: in the real table tennis game, the motion state of the white ball after hitting the ball is simulated in real time through physical calculation
Physical frame: time interval of physical computation update
Logical frame: time interval of game logic update
Coarse adjustment: the ball rod is directly dragged in the game, and the direction of the ball rod is adjusted by larger scales
Fine adjustment, namely fine adjustment of the direction of the ball arm by using a graduated scale and a small scale
The mobile terminal equipment: universal finger-held game devices, e.g. cell phones, games, etc
The human-computer interface of the scheme can be as shown in fig. 4, a user can roughly adjust the hitting direction through a hitting rod 404, or finely adjust the hitting direction through a graduated scale 406, and can also adjust the hitting force through a force adjusting groove 402, and adjust the deflection angle speed of the white ball through a blocking area 408.
If the initial angular velocity is added, the motion track of the white ball is a curve. If no initial angular velocity is added, a determination is made as to whether the white ball has collided with the table. After colliding with the table, the motion trail of the white ball is a curve. If the initial angular velocity is not added and the white ball does not collide with the table, the white ball motion trajectory is a straight line.
Fig. 5 is an alternative stoppered interface where the origin on the white ball may be the location at which the ball is struck, which may be adjusted by the stoppered interface. Different shot positions may add different initial angular velocities to the white ball.
Fig. 3 is an alternative motion trajectory of the white ball first hitting other balls without the plug, and the motion trajectory of the white ball is a straight line. Fig. 6 is an alternative motion trajectory of a white ball colliding with the edge of a table without adding a plug, and the motion trajectory after collision is a curve. Fig. 7 is a motion trace of a white ball in a case of plugging, and the trace is a curve.
Fig. 8 is a flow chart of one such scheme. As shown in steps S802 to S842 in fig. 8. In the scheme, firstly, according to step S802, a table is virtualized into N-N grids, then, according to step S804, collision edges of the table are subdivided into M, and according to step 806, the ball information of other balls (object collision balls) which intersect with the grids of each grid and the edge information of the table (object collision edge) are recorded. A drawing request is received through step S808. The drawing request is a drawing request generated by the user when adjusting the ball striking bar. When the drawing request is coarse tuning in S810, the drawing request is not timely responded within a predetermined time period in S812, a predetermined time period is waited, if a new drawing request for coarse tuning is received within the predetermined time period, the old drawing request is replaced with the new drawing request, and when the predetermined time period is up, S814 responds to the new drawing request. For example, in the case of coarse adjustment, as shown in fig. 9, after request 1 is acquired, the request 1 is responded after three fixed frames, and after request 2 is acquired, the request 2 is responded after two fixed frames. Each request, upon receipt, needs to wait for a predetermined length of time, which is the length of time that the request reaches the fixed frame interval at the time of receipt. Every three frames of detection, the request during three frames will be extended to the response at detection. During which multiple requests are received, the new request may overwrite the old request. Request 4 overrides request 3. The fine-tuning case may directly respond to the drawing request.
After receiving the drawing request, it may be determined at S816 whether the drawing request is jammed, and if so, the white ball has an initial angular velocity. Jumping to step S820, the simulation of the trajectory is started. If the ball is not jammed, the process goes to step S818, and it is determined whether the first collision target of the white ball is another ball or an edge of the billiard. In step S818, the object of the first collision may be determined by acquiring the shortest moving distance at which the white ball collides with the ball and the shortest moving distance at which the edge collides.
Calculating the shortest distance of the collision ball: as shown in fig. 10, sport ball a2Along A2D moving in the direction of the other ball A at a future time t1And (6) collision. A. the1F is a ball A1Of (c) is used.
According to the cosine theorem:
at the time of collision A1D is 2r (r is a spherical radius), and the shortest distance a can be obtained2D
Calculating the shortest motion distance of the collision edge:
as shown in fig. 11, the distance AE can be obtained by using the property that the cross product of vectors equals the area of the corresponding parallelogram, where F is the point of collision with the side CD at the future time t when the white ball AG moves in the direction of the arrow. G is the midpoint of AE. C and D are the two end points of the edge of the table that are located in the grid. C1 and D1 are the auxiliary points in the calculation, A is the sphere center. The formula is as follows:
in the case where the first collision is a ball, the vector set method is used, as in step S818, to calculate the target movement trajectory. If the jamming is judged or the first collision is an edge, jumping to step S820 to start simulating the motion track of the white ball.
Initializing physical simulation parameters, converting input parameters such as force F, plugging S and the like into an initial motion state of the white ball, and starting simulation;
unit vector of force: the club faces:
wherein x and y are the horizontal and vertical coordinates of the coordinate system where the table is located, and are used for representing the direction of the force F.
Speed:
wherein a is the acceleration, F is the stress of the white ball, the friction force needs to be calculated, t is the time of one frame, and m is the mass of the white ball.
Angular velocity:
w0=S(8)
updating the motion state change of the white ball within the time interval of one frame per frame through the step S828;
euler integration method:
st=s0+vΔt(9)
wherein s istIs the motion state after one frame time, s0Is the motion state before one frame, v is the velocity, and Δ t is the time of one frame.
And (3) friction force attenuation:
ax=μRollercosα,ay=μRollersinα (12)
v′x=vx+axΔt,v′y=vy+ayΔt (14)
Where w is the white sphere angular velocity and r is the white sphere radius, w or v with subscript x or subscript y represents the projected component on the x or y axis. Mu.sRollerA is a coefficient of rolling friction force, and a is an acceleration generated by the friction force.
The grid where the white ball is located at the latest position is searched, the target grid where the grid is located is obtained in step S830, and the edge expansion check and the ball collision check are performed in steps S832 and S834.
At the time of the edge collision inspection, as shown in fig. 12,when the ball is likely to collide with the edge, then the white ball is determined to collide with the edge when the CD is less than or equal to r. Where A and B are the two end points of the edge of the table in the target grid, V is the speed direction of the white ball, and C is the center of the white ball.
When the distance between the white ball and the center of the other ball is less than 2r in the ball collision inspection, the two balls collide with each other. r is the radius of the sphere.
The white ball position is obtained in step S836, each frame is sampled once, the initial position of the white ball is a track point or a sampling point, and after each frame is sampled once, if the distance between the obtained white ball position and the previous track point is less than 2r, the white ball position obtained by this sampling is discarded, and the next sampling is waited. And if the distance between the position of the sampled white ball and the last track point is greater than or equal to 2r, determining the position of the sampled white ball as a new track point. That is, when the current sampling position and the last trace point position are greater than or equal to 2r, the sampling position is determined as the trace point. Thereby obtaining a plurality of trace points. It is determined whether the exercise is finished through step S840. The simulated motion ends early when the white ball velocity is zero. And performing secondary resampling based on the obtained track points. Aiming at the limitation of the performance of the equipment of a part of low-end machines, the number of sampling points is adjusted based on real-time FPS, and the performance consumption brought by drawing is reduced by sacrificing the smoothness of auxiliary lines. The subsampled data is generated into trajectory data by step S824, and step S826 is performed to draw a target motion trajectory. Namely, the target motion track is displayed on the display interface of the client. When drawing, the track points in the target motion track are connected by line segments, and drawing and displaying are carried out.
Through the embodiment, the method has the advantage that the efficiency of generating the auxiliary line is improved.
As an alternative embodiment, before determining the target mesh intersected with the target collision ball from the set of virtual desktop meshes matched with the virtual desktop control area in response to the adjustment instruction, the method further comprises:
s1, under the condition that the simulation motion track of the target collision ball is a curve, executing the step of responding to the adjusting instruction, wherein the simulation motion track is the motion track of the target collision ball calculated according to the adjusting instruction;
and S2, determining the simulated motion track as the target motion track when the simulated motion track of the target collision ball is a straight line.
That is to say, in this scheme, under the condition that the trajectory of the target collision ball is a curve, the adjustment instruction is responded to perform collision detection on the target collision ball, and if the target motion trajectory of the target collision ball is calculated and is the trajectory of the target collision ball is a straight line or a curve, the target motion trajectory can be directly obtained by using a geometric method, so that the effect of improving the flexibility of obtaining the target motion trajectory is achieved.
As an alternative embodiment, in the case where the simulated motion trajectory of the target impact ball is a curved line, the method further comprises, before the step of responding to the adjustment command:
s1, determining the simulated motion track as a curve under the condition that the adjustment instruction indicates that the target collision ball carries the initial angular velocity;
s2, in a case where the adjustment instruction indicates that the target collision ball does not carry the initial angular velocity, in a case where the primary collision object of the target collision ball is the object collision side, determining the simulated motion trajectory to be a curved line.
By the method, whether the motion track of the target collision ball is a curve or not can be accurately judged, and the effect of improving the efficiency of judging the track type of the target collision ball is realized.
As an alternative embodiment, performing collision detection on the target mesh, and obtaining a collision detection result includes:
s1, side information of an object collision side intersected with the target grid is obtained, wherein the side information comprises a first position of a first end point of the object collision side and a second position of a second end point of the object collision side;
s2, acquiring the target position of the target collision ball;
s3, determining that the collision between the target collision ball and the collision edge of the object occurs under the condition that the product of a first vector formed by the target position and the first position and a second vector formed by the target position and the second position is larger than zero and the distance between the target position and the collision edge of the object is smaller than r, wherein r is the radius of the target collision ball;
and S4, determining the track point of the target collision ball as a collision detection result.
By the method, the collision detection is carried out on the object collision edges in the target grid in the collision detection process, so that the calculation amount of the collision detection is greatly reduced, and the collision detection efficiency is improved. The efficiency of generating the auxiliary line is further improved.
As an alternative embodiment, performing collision detection on the target mesh, and obtaining a collision detection result includes:
s1, acquiring ball information of an object colliding with the ball intersected with the target grid, wherein the ball information comprises a third position of the object colliding with the ball;
s2, acquiring the target position of the target collision ball;
s3, determining that the target collision ball collides with the object collision ball when the distance between the third position and the target position is less than 2r, wherein r is the radius of the target collision ball;
and S4, determining the track point of the target collision ball as a collision detection result.
By the method, the collision detection is carried out on the object collision ball in the target grid in the collision detection process, so that the calculation amount of the collision detection is greatly reduced, and the collision detection efficiency is improved. The efficiency of generating the auxiliary line is further improved.
As an alternative embodiment, generating the target motion trajectory corresponding to the target collision ball according to the collision detection result includes:
and S1, connecting the track points in the collision detection result by using line segments to obtain the target motion track.
Through this embodiment, through using the line segment to connect the track point, obtain the target motion orbit to the effect of the efficiency that the target motion orbit was shown has been realized improving.
As an optional embodiment, before displaying the target motion trajectory on the client, the method further includes:
s1, under the condition that a drawing request is received, waiting for a preset time, wherein within the preset time, the drawing request is not responded, and the drawing request is used for requesting to display a target motion trail;
s2, when a new drawing request is acquired within a predetermined period of time, replaces the old drawing request with the new drawing request.
By the method, the drawing request is not immediately responded after being acquired, but is drawn by waiting for the preset time, so that the purpose of reducing the calculation amount in the process of generating the auxiliary line is realized.
As an alternative embodiment, generating the target motion trajectory corresponding to the target collision ball according to the collision detection result includes:
s1, acquiring the target number of the track points in the collision detection result;
s2, under the condition that the target number is larger than a first threshold value, extracting N points from the track points as new track points, wherein N is determined according to the performance of a terminal of the operating client, N is a positive integer, and N is smaller than the target number;
and S3, generating a target motion track according to the new track points.
By the method, through secondary resampling, the calculation amount in the process of generating the auxiliary line is reduced, and the effect of improving the efficiency of generating the auxiliary line is achieved.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
According to another aspect of the embodiment of the invention, a track prompting device for implementing the track prompting method is further provided. As shown in fig. 13, the apparatus includes:
(1) an obtaining unit 1302, configured to obtain an adjustment instruction triggered by an operation performed on a human-machine interaction interface presented in a client of a virtual billiard game, where the adjustment instruction is used to adjust a control operation applied to a target collision ball in a control area of a virtual desktop;
(2) a first determining unit 1304, configured to determine, in response to the adjustment instruction, a target grid intersecting with the target collision ball from the set of virtual desktop grids matching the virtual desktop control area;
(3) a detecting unit 1306, configured to perform collision detection on the target grid, and obtain a collision detection result, where the collision detection is used to detect an object collision ball and/or an object collision edge that collides with the target collision ball;
(4) a generating unit 1308, configured to generate a target motion trajectory corresponding to a target collision ball according to a collision detection result;
(5) a display unit 1310 for displaying the target motion trail on the client.
Alternatively, the trajectory prompting device may be, but is not limited to, applied to the field of games, such as a terminal installable in software, or provided on a terminal.
Taking a game running on the terminal as an example, the terminal can be provided with a client, and the client runs a virtual billiard game. And the client displays a human-computer interaction interface. Acquiring an adjusting instruction on a human-computer interaction interface, responding to the adjusting instruction, and determining a target grid intersected with a target collision ball from a virtual desktop grid set matched with a virtual desktop control area; performing collision detection on the target grid to obtain a collision detection result, wherein the collision detection is used for detecting an object collision ball and/or an object collision edge which collide with the target collision ball; generating a target motion track corresponding to a target collision ball according to a collision detection result; and displaying a target motion trail on the client, wherein the target motion trail is an auxiliary line in the virtual table game. The display result may be as shown in fig. 3.
By the method, the efficiency of generating the auxiliary line in the virtual table game is improved.
Optionally, in the present scheme, in the process of obtaining the adjustment instruction, the adjustment instruction may be obtained through a touch instruction received by the human-computer interaction interface. For example, the user may touch the human-computer interface to control the direction of the batting rod and the batting force of the batting rod in the virtual table game, and generate the adjustment instruction. The touch operation may be any operation such as clicking, long-pressing, sliding, dragging, and the like. After receiving the adjustment instruction, the client may determine a virtual desktop grid set, where the virtual desktop may be a billiard sphere in a virtual billiard game, and the billiard sphere is cut to obtain multiple grids, where the cutting method may be an average method, and the virtual desktop is cut into multiple grids of the same size or multiple grids of different sizes. The target mesh is included in the plurality of meshes. Taking the same size of the grid as an example, each grid can record the ball information of the object colliding with the ball intersecting with the grid and the side information of the colliding side of the object. The object collision ball may be a ball other than a white ball, the object collision edge being an edge of the virtual table, or a part of the edge. The target grid intersects with a target collision ball, which is a ball, typically a white ball, struck by the cue. And performing collision detection on the target grid to determine the target motion track of the target collision ball. Then, the target movement locus is displayed, thereby displaying an auxiliary line during the stroke.
Optionally, in the scheme, after the adjustment instruction is obtained, the simulated motion trajectory of the target collision may be determined. The simulated motion trajectory is a trajectory in which the client terminal simulates the motion of the target collision ball under the influence of the force after determining the magnitude and direction of the force to be applied to the target collision ball after receiving the adjustment instruction. The simulation process is a virtual process, and the movement of the target collision ball cannot be displayed on a human-computer interaction interface of the client. During the simulation, the simulated motion trajectory of the target impact ball may be a curve or a straight line. The reason is that the target impact ball may carry an initial angular velocity when subjected to a force. The initial angular velocity is the force that controls the rotation of the target hitting the ball. Alternatively, the target collision ball may collide with the object while simulating the motion trajectory as a curved line after the target collision ball collides with the object. And if the simulated motion track of the target collision ball is a curve, determining a target grid according to the adjustment instruction, and further determining the motion track of the target. And if the simulated motion track is a straight line or a broken line, directly determining the simulated motion track as the target motion track.
In determining whether the simulated motion trajectory is a curved line, it may be determined whether there is a rotational angular velocity applied to the target impact ball. Rotational angular velocity can cause an object impacting the ball to deflect during movement. If the rotation angular velocity does not exist, whether the first collision of the object collision ball is collision with the object collision ball or collision with the object while collision is judged, if the first collision is collision with the object collision ball, the simulation motion track is a straight line or a broken line, and if the first collision is collision with the object while collision is judged, the simulation motion track is a curve.
Optionally, in the scheme, in the process of performing collision detection on the target grid to obtain a collision detection result, it is required to detect whether the target collision ball collides with the object collision ball or collides with the object.
When detecting whether collision occurs with an object collision side, acquiring side information of the object collision side intersecting with the target grid, wherein the side information comprises a first position of a first end point of the object collision side and a second position of a second end point of the object collision side; acquiring a target position of a target collision ball; determining that the target collision ball collides with the object collision edge under the condition that the product of a first vector formed by the target position and the first position and a second vector formed by the target position and the second position is larger than zero and the distance between the target position and the object collision edge is smaller than r, wherein r is the radius of the target collision ball; and determining the track point of the target collision ball as a collision detection result.
Alternatively, the side information may be a portion of the virtual table located in the target grid, the portion being a segment of one side of the virtual table. The side information stores the position information of two end points of the side in the target grid. If the collision of the target collision ball and the object is detected, collision is generated.
When whether collision with an object collision ball occurs or not is detected, ball information of the object collision ball intersected with the target grid is obtained, wherein the ball information comprises a third position of the object collision ball; acquiring a target position of a target collision ball; determining that the target collision ball collides with the object collision ball under the condition that the distance between the third position and the target position is less than 2r, wherein r is the radius of the target collision ball; and determining the track point of the target collision ball as a collision detection result.
The track points can be sampling points obtained by sampling the position of the target collision ball every preset time in the process of simulating the movement of the target collision ball.
Through the method, the collision detection is carried out on the collision edges of the target collision ball, the object collision ball and the object, and the motion track of the target collision ball after collision can be determined.
Optionally, in the process of acquiring the sampling point, if after the position of a target collision ball is acquired, the distance between the position of the target collision ball and the position of the last sampling point is less than twice the radius of the target collision ball, the position of the target collision ball is not used as the sampling point. After a predetermined period of time, the next acquisition of the position of the target impact ball is performed. And if the distance between the position of the target collision ball and the position of the last sampling point is more than or equal to twice the radius of the target collision ball after the position of the target collision ball is obtained, determining the position of the target collision ball as the position of one sampling point. The initial position of the target impact ball may be the first locus point.
If the track points of the target collision ball are obtained, the track points can be connected by using line segments to obtain the target motion track. The target motion trail can be displayed on the client.
Optionally, after the track points are obtained, the track points can be re-sampled for the second time. Acquiring the target number of track points in a collision detection result; under the condition that the target number is larger than a first threshold value, extracting N points from the track points as new track points, wherein N is determined according to the performance of a terminal of an operating client, N is a positive integer, and N is smaller than the target number; and generating a target motion track according to the new track points.
Alternatively, the performance of the terminal may include the computing capability of the hardware of the terminal.
Optionally, in the scheme, the operation amount in the process of generating the auxiliary line can be further reduced through coarse adjustment and fine adjustment. If the target motion trail is roughly adjusted, a drawing request is received before the target motion trail is displayed on the client, the drawing request is used for requesting to display the target motion trail, the drawing request is not adjusted immediately, the preset time duration is waited, and if a new drawing request is received within the preset time duration, the old drawing request is replaced by the new drawing request. And if the new drawing request is not received, executing the original drawing request. And if the fine adjustment is carried out, responding to the drawing request in real time.
The drawing request of the present solution may be included in the adjustment instruction, or may be the same as the adjustment instruction, or the drawing request and the adjustment instruction are obtained separately.
Through the embodiment, the method has the advantage that the efficiency of generating the auxiliary line is improved.
As an alternative embodiment, the apparatus further comprises:
(1) the first execution unit is used for responding to the adjustment instruction, and executing the step of responding to the adjustment instruction under the condition that the simulated motion track of the target collision ball is a curve before determining a target grid intersected with the target collision ball from a virtual desktop grid set matched with a virtual desktop control area in response to the adjustment instruction, wherein the simulated motion track is the motion track of the target collision ball calculated according to the adjustment instruction;
(2) and the second execution unit is used for determining the simulated motion track as the target motion track under the condition that the simulated motion track of the target collision ball is a straight line.
That is to say, in this scheme, under the condition that the trajectory of the target collision ball is a curve, the adjustment instruction is responded to perform collision detection on the target collision ball, and if the target motion trajectory of the target collision ball is calculated and is the trajectory of the target collision ball is a straight line or a curve, the target motion trajectory can be directly obtained by using a geometric method, so that the effect of improving the flexibility of obtaining the target motion trajectory is achieved.
As an alternative embodiment, the apparatus further comprises:
(1) a second determination unit configured to determine that the simulated motion trajectory is a curve in a case where the adjustment instruction indicates that the target collision ball carries an initial angular velocity, before the step of responding to the adjustment instruction is performed in a case where the simulated motion trajectory of the target collision ball is a curve;
(2) and a third determination unit configured to determine that the simulated motion trajectory is a curve in a case where the adjustment instruction indicates that the target collision ball does not carry the initial angular velocity and a first collision object of the target collision ball is an object collision side.
By the method, whether the motion track of the target collision ball is a curve or not can be accurately judged, and the effect of improving the efficiency of judging the track type of the target collision ball is realized.
As an alternative embodiment, the detection unit comprises:
(1) the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring side information of an object collision side intersected with a target grid, and the side information comprises a first position of a first end point of the object collision side and a second position of a second end point of the object collision side;
(2) the second acquisition module is used for acquiring the target position of the target collision ball;
(3) the first determining module is used for determining that the target collision ball collides with the collision edge of the object under the condition that the product of a first vector formed by the target position and the first position and a second vector formed by the target position and the second position is larger than zero and the distance between the target position and the collision edge of the object is smaller than r, wherein r is the radius of the target collision ball;
(4) and the second determining module is used for determining the track point of the target collision ball as a collision detection result.
By the method, the collision detection is carried out on the object collision edges in the target grid in the collision detection process, so that the calculation amount of the collision detection is greatly reduced, and the collision detection efficiency is improved. The efficiency of generating the auxiliary line is further improved.
As an alternative embodiment, the detection unit comprises:
(1) the third acquisition module is used for acquiring ball information of an object collision ball intersected with the target grid, wherein the ball information comprises a third position of the object collision ball;
(2) the fourth acquisition module is used for acquiring the target position of the target collision ball;
(3) the third determining module is used for determining that the target collision ball collides with the object collision ball under the condition that the distance between the third position and the target position is less than 2r, wherein r is the radius of the target collision ball;
(4) and the fourth determining module is used for determining the track point of the target collision ball as a collision detection result.
By the method, the collision detection is carried out on the object collision ball in the target grid in the collision detection process, so that the calculation amount of the collision detection is greatly reduced, and the collision detection efficiency is improved. The efficiency of generating the auxiliary line is further improved.
As an alternative embodiment, the generating unit comprises:
(1) and the splicing module is used for connecting the track points in the collision detection result by using line segments to obtain a target motion track.
Through this embodiment, through using the line segment to connect the track point, obtain the target motion orbit to the effect of the efficiency that the target motion orbit was shown has been realized improving.
As an alternative embodiment, the apparatus further comprises:
(1) the waiting unit is used for waiting for a preset time length under the condition that a drawing request is received before the target motion trail is displayed on the client, wherein the drawing request is not responded within the preset time length and is used for requesting to display the target motion trail;
(2) and the replacing unit is used for replacing the old drawing request with the new drawing request under the condition that the new drawing request is acquired within the preset time length.
By the method, the drawing request is not immediately responded after being acquired, but is drawn by waiting for the preset time, so that the purpose of reducing the calculation amount in the process of generating the auxiliary line is realized.
As an alternative embodiment, the generating unit comprises:
(1) the fifth acquisition module is used for acquiring the target number of the track points in the collision detection result;
(2) the extracting module is used for extracting N points from the track points as new track points under the condition that the number of the targets is larger than a first threshold value, wherein N is determined according to the performance of a terminal of the operating client, N is a positive integer, and N is smaller than the number of the targets;
(3) and the generating module is used for generating the target motion track according to the new track points.
By the method, through secondary resampling, the calculation amount in the process of generating the auxiliary line is reduced, and the effect of improving the efficiency of generating the auxiliary line is achieved.
According to a further aspect of the embodiments of the present invention, there is also provided an electronic device for implementing the trajectory prompting method, as shown in fig. 14, the electronic device includes a memory 1402 and a processor 1404, the memory 1402 stores a computer program, and the processor 1404 is configured to execute the steps in any one of the method embodiments through the computer program.
Optionally, in this embodiment, the electronic apparatus may be located in at least one network device of a plurality of network devices of a computer network.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, acquiring an adjusting instruction triggered by executing operation on a human-computer interaction interface presented in a client of the virtual billiard game, wherein the adjusting instruction is used for adjusting the control operation applied to a target collision ball in a virtual desktop control area;
s2, responding to the adjusting instruction, and determining a target grid intersected with the target collision ball from the virtual desktop grid set matched with the virtual desktop control area;
s3, performing collision detection on the target grid to obtain a collision detection result, wherein the collision detection is used for detecting an object collision ball and/or an object collision edge which collide with the target collision ball;
s4, generating a target motion track corresponding to the target collision ball according to the collision detection result;
and S5, displaying the target motion trail on the client.
Alternatively, it can be understood by those skilled in the art that the structure shown in fig. 14 is only an illustration, and the electronic device may also be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 14 is a diagram illustrating a structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 14, or have a different configuration than shown in FIG. 14.
The memory 1402 may be configured to store software programs and modules, such as program instructions/modules corresponding to the trajectory prompting method and apparatus in the embodiments of the present invention, and the processor 1404 executes various functional applications and data processing by running the software programs and modules stored in the memory 1402, that is, implementing the trajectory prompting method. Memory 1402 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1402 may further include memory located remotely from the processor 1404, which may be connected to a terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 1402 may be, but not limited to, specifically configured to store information such as various items of information in the virtual table game. As an example, as shown in fig. 14, the memory 1402 may include, but is not limited to, an obtaining unit 1302, a first determining unit 1304, a detecting unit 1306, a generating unit 1308, and a display unit 1310 of the trajectory prompting device. In addition, the track prompting device may further include, but is not limited to, other module units in the track prompting device, which is not described in detail in this example.
Optionally, the transmitting device 1406 is used for receiving or sending data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 1406 includes a Network adapter (NIC) that can be connected to a router via a Network cable and other Network devices to communicate with the internet or a local area Network. In one example, the transmitting device 1406 is a Radio Frequency (RF) module, which is used to communicate with the internet by wireless means.
In addition, the electronic device further includes: a display 1408 for displaying a human-computer interaction interface and a target motion track; and a connection bus 1410 for connecting the respective module parts in the above-described electronic apparatus.
According to a further aspect of an embodiment of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the steps in any of the above-mentioned method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, acquiring an adjusting instruction triggered by executing operation on a human-computer interaction interface presented in a client of the virtual billiard game, wherein the adjusting instruction is used for adjusting the control operation applied to a target collision ball in a virtual desktop control area;
s2, responding to the adjusting instruction, and determining a target grid intersected with the target collision ball from the virtual desktop grid set matched with the virtual desktop control area;
s3, performing collision detection on the target grid to obtain a collision detection result, wherein the collision detection is used for detecting an object collision ball and/or an object collision edge which collide with the target collision ball;
s4, generating a target motion track corresponding to the target collision ball according to the collision detection result;
and S5, displaying the target motion trail on the client.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
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.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above 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 several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
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 several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be 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 network 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 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 (16)
1. A trajectory prompting method is characterized by comprising the following steps:
acquiring an adjusting instruction triggered by executing operation on a human-computer interaction interface presented in a client of a virtual billiard game, wherein the adjusting instruction is used for adjusting control operation applied to a target collision ball in a virtual desktop control area;
responding to the adjusting instruction, and determining a target grid intersected with the target collision ball from a virtual desktop grid set matched with the virtual desktop control area;
performing collision detection on the target grid to obtain a collision detection result, wherein the collision detection is used for detecting an object collision ball and/or an object collision edge which collide with the target collision ball; performing collision detection on the target grid to obtain a collision detection result comprises: acquiring side information of the object collision side intersected with the target grid, wherein the side information comprises a first position of a first end point of the object collision side and a second position of a second end point of the object collision side; determining a trajectory point of the target collision ball as the collision detection result when it is determined that the target collision ball collides with the object collision side;
generating a target motion track corresponding to the target collision ball according to the collision detection result;
displaying the target motion trail on the client;
wherein the generating of the target motion trajectory corresponding to the target collision ball according to the collision detection result comprises: and connecting the track points in the collision detection result by using line segments to obtain the target motion track.
2. The method of claim 1, wherein prior to determining the target mesh that intersects the target collision ball from the set of virtual desktop meshes that match the virtual desktop control area in response to the adjustment instruction, the method further comprises:
executing the step of responding to the adjustment instruction when the simulated motion trajectory of the target impact ball is a curve, wherein the simulated motion trajectory is the motion trajectory of the target impact ball calculated according to the adjustment instruction;
and determining the simulated motion track as the target motion track under the condition that the simulated motion track of the target collision ball is a straight line.
3. The method of claim 2, wherein before the step of responding to the adjustment instruction is performed in the case where the simulated motion trajectory of the target impact ball is a curved line, the method further comprises:
determining the simulated motion trajectory to be a curve under the condition that the adjustment instruction indicates that the target collision ball carries an initial angular velocity;
determining that the simulated motion trajectory is a curve if a first collision object of the target collision ball is the object collision edge, in a case where the adjustment instruction indicates that the target collision ball does not carry an initial angular velocity.
4. The method of claim 1, wherein said determining that the target collision ball has collided with the object collision side comprises:
acquiring a target position of the target collision ball;
and determining that the target collision ball collides with the object collision side under the condition that the product of a first vector formed by the target position and the first position and a second vector formed by the target position and the second position is larger than zero and the distance between the target position and the object collision side is smaller than r, wherein the r is the radius of the target collision ball.
5. The method of claim 1, wherein performing collision detection on the target mesh to obtain a collision detection result comprises:
acquiring ball information of the object collision ball intersected with the target grid, wherein the ball information comprises a third position of the object collision ball;
acquiring a target position of the target collision ball;
determining that the target collision ball collides with the object collision ball when the distance between the third position and the target position is less than 2r, where r is a radius of the target collision ball;
and determining the track point of the target collision ball as the collision detection result.
6. The method of claim 1, wherein prior to displaying the target motion trajectory on the client, the method further comprises:
waiting for a preset time length under the condition that a drawing request is received, wherein the drawing request is not responded within the preset time length, and the drawing request is used for requesting to display the target motion trail;
and under the condition that a new drawing request is acquired within the preset time, replacing the old drawing request with the new drawing request.
7. The method of claim 1, wherein the generating of the target motion trajectory corresponding to the target collision ball according to the collision detection result comprises:
acquiring the target number of track points in the collision detection result;
under the condition that the target number is larger than a first threshold value, extracting N points from the track points as new track points, wherein the N is determined according to the performance of a terminal operating the client, the N is a positive integer, and the N is smaller than the target number;
and generating the target motion trail according to the new track points.
8. A trajectory prompting device, comprising:
the game system comprises an acquisition unit, a processing unit and a control unit, wherein the acquisition unit is used for acquiring an adjustment instruction triggered by executing operation on a human-computer interaction interface presented in a client of a virtual billiard game, and the adjustment instruction is used for adjusting control operation applied to a target collision ball in a virtual desktop control area;
a first determining unit, configured to determine, in response to the adjustment instruction, a target grid intersecting with the target collision ball from a set of virtual desktop grids matching the virtual desktop control area;
the detection unit is used for carrying out collision detection on the target grid to obtain a collision detection result, wherein the collision detection is used for detecting an object collision ball and/or an object collision edge which collide with the target collision ball; the detection unit further includes: a first obtaining module, configured to obtain side information of the object collision side intersecting with the target mesh, where the side information includes a first position of a first endpoint of the object collision side and a second position of a second endpoint of the object collision side; a first determination module configured to determine that the target collision ball collides with the object, and a second determination module configured to determine a trajectory point of the target collision ball as the collision detection result, when it is determined that the target collision ball collides with the object;
the generating unit is used for generating a target motion track corresponding to the target collision ball according to the collision detection result;
the display unit is used for displaying the target motion trail on the client;
wherein the generating unit includes: and the splicing module is used for connecting the track points in the collision detection result by using line segments to obtain the target motion track.
9. The apparatus of claim 8, further comprising:
a first execution unit, configured to execute the step of responding to the adjustment instruction if a simulated motion trajectory of the target collision ball is a curve before determining, in response to the adjustment instruction, the target mesh intersecting the target collision ball from a set of virtual desktop meshes matched with the virtual desktop control area, where the simulated motion trajectory is a motion trajectory of the target collision ball calculated according to the adjustment instruction;
and the second execution unit is used for determining the simulated motion track as the target motion track under the condition that the simulated motion track of the target collision ball is a straight line.
10. The apparatus of claim 9, further comprising:
a second determination unit configured to determine that the simulated motion trajectory is a curve in a case where the adjustment instruction indicates that the target collision ball carries an initial angular velocity, before the step of responding to the adjustment instruction is performed in a case where the simulated motion trajectory of the target collision ball is a curve;
a third determination unit, configured to determine that the simulated motion trajectory is a curve in a case where a first collision object of the target collision ball is the object collision edge in a case where the adjustment instruction indicates that the target collision ball does not carry an initial angular velocity.
11. The apparatus of claim 8, wherein the detection unit further comprises:
the second acquisition module is used for acquiring the target position of the target collision ball;
a first determining module, configured to determine that the target collision ball collides with the object collision edge when a product of a first vector formed by the target position and the first position and a second vector formed by the target position and the second position is greater than zero and a distance between the target position and the object collision edge is less than r, where r is a radius of the target collision ball.
12. The apparatus of claim 8, wherein the detection unit comprises:
a third obtaining module, configured to obtain ball information of the object colliding with the ball intersecting with the target grid, where the ball information includes a third position of the object colliding with the ball;
the fourth acquisition module is used for acquiring the target position of the target collision ball;
a third determining module, configured to determine that the target collision ball collides with the object collision ball when a distance between the third position and the target position is less than 2r, where r is a radius of the target collision ball;
and the fourth determining module is used for determining the track point of the target collision ball as the collision detection result.
13. The apparatus of claim 8, further comprising:
a waiting unit, configured to wait for a predetermined time period in a case where a drawing request is received before the target motion trajectory is displayed on the client, where the drawing request is not responded within the predetermined time period, and the drawing request is used to request to display the target motion trajectory;
and the replacing unit is used for replacing the old drawing request with the new drawing request under the condition that the new drawing request is acquired within the preset time length.
14. The apparatus of claim 8, wherein the generating unit comprises:
a fifth obtaining module, configured to obtain the target number of track points in the collision detection result;
an extracting module, configured to extract N points from the trace points as new trace points when the target number is greater than a first threshold, where N is determined according to performance of a terminal that operates the client, where N is a positive integer, and N is smaller than the target number;
and the generating module is used for generating the target motion track according to the new track points.
15. A computer-readable storage medium, in which a computer program is stored, which computer program, when running, performs the method of any one of claims 1 to 7.
16. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 7 by means of the computer program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010067341.6A CN111249719B (en) | 2020-01-20 | 2020-01-20 | Track prompting method and device, storage medium and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010067341.6A CN111249719B (en) | 2020-01-20 | 2020-01-20 | Track prompting method and device, storage medium and electronic device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111249719A CN111249719A (en) | 2020-06-09 |
CN111249719B true CN111249719B (en) | 2021-09-24 |
Family
ID=70942787
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010067341.6A Active CN111249719B (en) | 2020-01-20 | 2020-01-20 | Track prompting method and device, storage medium and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111249719B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112203277B (en) * | 2020-09-21 | 2024-03-15 | 咪咕文化科技有限公司 | Route generation method, verification method, server and electronic equipment |
CN112169338B (en) * | 2020-10-15 | 2024-06-11 | 网易(杭州)网络有限公司 | Sphere motion control method and device, storage medium and computer equipment |
CN116795263A (en) * | 2022-03-15 | 2023-09-22 | 北京字跳网络技术有限公司 | Interaction method, device, equipment and computer readable storage medium |
CN114797106A (en) * | 2022-03-29 | 2022-07-29 | 北京字跳网络技术有限公司 | Image processing method, device, equipment and storage medium |
CN116510295B (en) * | 2023-07-03 | 2023-09-12 | 腾讯科技(深圳)有限公司 | Data processing method, device, equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103871078A (en) * | 2013-07-12 | 2014-06-18 | 北京瑞盖科技有限公司 | Billiard ball hitting key information detection method and system |
CN104954750A (en) * | 2015-06-18 | 2015-09-30 | 北京共创普惠科技有限公司 | Data processing method and device for billiard system |
CN105739855A (en) * | 2016-01-22 | 2016-07-06 | 网易(杭州)网络有限公司 | Virtual object motion control method and apparatus |
KR20170121557A (en) * | 2016-04-25 | 2017-11-02 | 이양길 | Management system for billiard hall |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101593364B (en) * | 2009-06-25 | 2012-02-08 | 北京航空航天大学 | Method for detecting continuous collision based on ellipsoid scanning |
CN108540454B (en) * | 2018-03-16 | 2020-09-15 | 武汉微派网络科技有限公司 | Collision synchronization method, client and storage medium |
-
2020
- 2020-01-20 CN CN202010067341.6A patent/CN111249719B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103871078A (en) * | 2013-07-12 | 2014-06-18 | 北京瑞盖科技有限公司 | Billiard ball hitting key information detection method and system |
CN104954750A (en) * | 2015-06-18 | 2015-09-30 | 北京共创普惠科技有限公司 | Data processing method and device for billiard system |
CN105739855A (en) * | 2016-01-22 | 2016-07-06 | 网易(杭州)网络有限公司 | Virtual object motion control method and apparatus |
KR20170121557A (en) * | 2016-04-25 | 2017-11-02 | 이양길 | Management system for billiard hall |
Non-Patent Citations (2)
Title |
---|
基于网格的碰撞检测;匿名;《https://blog.csdn.net/weixin_30344795/article/details/95275014》;CSDN;20120309;全文 * |
桌球游戏玩一玩;匿名;《https://v.qq.com/x/page/p08672kwpqr.html》;20190505;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN111249719A (en) | 2020-06-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111249719B (en) | Track prompting method and device, storage medium and electronic device | |
CN106215419B (en) | Collision control method and device | |
US10481689B1 (en) | Motion capture glove | |
US9448634B1 (en) | System and method for providing rewards to a user in a virtual space based on user performance of gestures | |
KR101059325B1 (en) | Apparatus and method for virtual golf simulation | |
WO2019062855A1 (en) | Virtual resource data processing method, computer device and storage medium | |
CN110215685B (en) | Method, device, equipment and storage medium for controlling virtual object in game | |
JP2014514946A (en) | Ball motion motion identification method, device and motion support device | |
US20140009384A1 (en) | Methods and systems for determining location of handheld device within 3d environment | |
WO2017110384A1 (en) | Player-versus-player game control method and program | |
CN109758760B (en) | Shooting control method and device in football game, computer equipment and storage medium | |
WO2021038565A1 (en) | Tracking dynamics using a computerized device | |
Cho et al. | Motion recognition with smart phone embedded 3-axis accelerometer sensor | |
JPWO2008016064A1 (en) | Game device, object display method and display program in game device | |
KR101337292B1 (en) | System for providing a ball game and method therefor | |
CN108579080A (en) | The interaction realization method and system of entity racket and virtual ball under mixed reality environment | |
WO2023078272A1 (en) | Virtual object display method and apparatus, electronic device, and readable medium | |
CN102024140B (en) | Drumbeating action identification method based on computer | |
CN111905368B (en) | Method, device, equipment and storage medium for controlling virtual prop in game | |
CN107092492B (en) | The control method and device of virtual objects | |
TWI603768B (en) | Game system, control method and program | |
CN114733189A (en) | Control method, device, medium and electronic equipment for somatosensory ball hitting | |
JP7252915B2 (en) | Game program, method, and information processing device | |
CN107050848B (en) | Somatosensory game implementation method and device based on body area network | |
CN112843706B (en) | Virtual object processing method and device in VR game and electronic device |
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 | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 40023731 Country of ref document: HK |
|
GR01 | Patent grant | ||
GR01 | Patent grant |