Collision simulation method and device of virtual moving object, electronic equipment and medium
By acquiring the attribute parameters of the virtual moving object and the arc-shaped collision area, a collision simulation path is generated, which solves the problems of existing technologies where 3D collision simulation is not suitable for 2D user interfaces and 2D physical collision simulation is too complex. It realizes physical collision simulation in the arc-shaped plane area and improves the user experience.
Patent Information
- Application Number
- CN202510016873.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2045-01-06
AI Technical Summary
Existing 3D collision simulations are not suitable for 2D user interfaces, especially circular areas with curved edges. Furthermore, existing 2D physics collision simulations are highly complex and make it difficult to achieve deterministic stopping at a predetermined position.
A collision simulation method for virtual moving objects is provided. By obtaining the attribute parameters of the virtual moving object and the arc-shaped collision area, collision simulation is performed, and a collision simulation path is generated, simplifying the physical simulation process and realizing physical collision simulation in the arc-shaped plane area.
Physical collision simulation was implemented in the curved plane area, which improved the visual experience and is suitable for game lottery scenarios, increasing the user's sense of realism and the certainty of the lottery process.
Smart Images

Figure CN119830592B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a collision simulation method and device of a virtual moving object, an electronic device and a medium. BACKGROUND
[0002] The collision simulation refers to shooting a virtual moving object in a certain area at a certain speed, and the virtual moving object is reduced in speed after a series of collisions and stops at a certain position.
[0003] In the related art, a common physical collision simulation is a physical simulation method using a 3D physical engine to simulate the collision of a virtual moving object, and another scenario of physical collision simulation is the collision simulation of a virtual moving object on a 2D user interface.
[0004] However, the 3D collision simulation is not applicable to the 2D user interface, and the current physical collision simulation on the 2D user interface is mainly used for a rectangular prize drawing area and is not applicable to a circular area with an arc-shaped edge. SUMMARY
[0005] Therefore, the present application provides a collision simulation method and device of a virtual moving object, and an electronic device and a medium to realize the process of physical collision simulation on an arc-shaped plane area.
[0006] In a first aspect, the present application provides a collision simulation method of a virtual moving object, comprising:
[0007] obtaining attribute parameters of a virtual moving object, attribute parameters of an arc-shaped collision area, and motion parameters of the virtual moving object; the attribute parameters of the virtual moving object include a starting point of the virtual moving object, the attribute parameters of the arc-shaped collision area include a reference point in the arc-shaped collision area, and the motion parameters include a target collision number and a stopping point in the arc-shaped collision area;
[0008] performing collision simulation on the virtual moving object in the arc-shaped collision area according to the starting point, the reference point, the target collision number, and the stopping point, to obtain a plurality of intersection points of the virtual moving object and an arc-shaped edge of the arc-shaped collision area;
[0009] generating a collision simulation path of the virtual moving object according to the starting point, the plurality of intersection points, and the stopping point, to control the virtual moving object to move from the starting point to the stopping point.
[0010] In a second aspect, the present application further provides a collision simulation device of a virtual moving object, comprising:
[0011] The acquisition module is configured to acquire attribute parameters of a virtual moving object, attribute parameters of an arc-shaped collision region, and motion parameters of the virtual moving object. The attribute parameters of the virtual moving object include a starting point of the virtual moving object. The attribute parameters of the arc-shaped collision region include a reference point in the arc-shaped collision region. The motion parameters include a target collision number and a stopping point in the arc-shaped collision region.
[0012] The processing module is configured to perform collision simulation on the virtual moving object in the arc-shaped collision region according to the starting point, the reference point, the target collision number, and the stopping point, to obtain a plurality of intersection points of the virtual moving object and an arc-shaped edge of the arc-shaped collision region.
[0013] The generation module is configured to generate a collision simulation path of the virtual moving object according to the starting point, the plurality of intersection points, and the stopping point, to control the virtual moving object to move from the starting point to the stopping point.
[0014] In a third aspect, an electronic device is provided. The electronic device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory through the bus. The processor executes the machine-readable instructions to perform the method of any one of the first aspect.
[0015] In a fourth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the method of any one of the first aspect is performed.
[0016] The present application provides a collision simulation method and device for a virtual moving object, an electronic device, and a medium. The method includes: acquiring attribute parameters of a virtual moving object, attribute parameters of an arc-shaped collision region, and motion parameters of the virtual moving object. The attribute parameters of the virtual moving object include a starting point of the virtual moving object. The attribute parameters of the arc-shaped collision region include a reference point in the arc-shaped collision region. The motion parameters include a target collision number and a stopping point in the arc-shaped collision region. Collision simulation is performed on the virtual moving object in the arc-shaped collision region according to the starting point, the reference point, the target collision number, and the stopping point, to obtain a plurality of intersection points of the virtual moving object and an arc-shaped edge of the arc-shaped collision region. A collision simulation path of the virtual moving object is generated according to the starting point, the plurality of intersection points, and the stopping point. Thus, the process of physical collision simulation in an arc-shaped planar region is simulated under the premise of determining the stopping point, and the experience is more realistic. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be regarded as a limitation on the scope, and for those of ordinary skill in the art, other related drawings can also be obtained without creative labor.
[0018] Figure 1 Flowchart of the collision simulation method of the virtual sports object provided by the embodiments of the present application Figure One ;
[0019] Figure 2 Schematic diagram of the graphical user interface provided by the embodiments of the present application Figure One ;
[0020] Figure 3 Flowchart of the collision simulation method of the virtual sports object provided by the embodiments of the present application Figure Two ;
[0021] Figure 4 Flowchart of the collision simulation method of the virtual sports object provided by the embodiments of the present application Figure Three ;
[0022] Figure 5 Schematic diagram of the graphical user interface provided by the embodiments of the present application Figure Two ;
[0023] Figure 6 Schematic diagram of the graphical user interface provided by the embodiments of the present application Figure Three ;
[0024] Figure 7 Flowchart of the collision simulation method of the virtual sports object provided by the embodiments of the present application Figure Four ;
[0025] Figure 8 Flowchart of the collision simulation method of the virtual sports object provided by the embodiments of the present application Figure Five ;
[0026] Figure 9 Flowchart of the collision simulation method of the virtual sports object provided by the embodiments of the present application Figure Six ;
[0027] Figure 10 Flowchart of the collision simulation method of the virtual sports object provided by the embodiments of the present application Figure Seven ;
[0028] Figure 11 Flowchart of the collision simulation method of the virtual sports object provided by the embodiments of the present application Figure Eight ;
[0029] Figure 12 A structural schematic diagram of a collision simulation device of a virtual moving object provided by an embodiment of the present application is shown in the figure.
[0030] Figure 13 A structural schematic diagram of an electronic device provided by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0031] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in connection with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the accompanying drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.
[0032] Currently, 3D collision simulation is not applicable to 2D user interfaces, and it is difficult to determine to stop at a pre-required position. The physical collision simulation on the current 2D user interface is mainly used for rectangular prize drawing areas, and is not applicable to circular areas with arc-shaped edges. Moreover, due to the introduction of physical concepts such as mass and friction coefficient of virtual moving objects to calculate the moving speed, the complexity is too high for user interface calculation, affecting the calculation rate.
[0033] Based on this, the present application provides a collision simulation method of a virtual moving object, which can generate a collision simulation path of a virtual moving object for an arc-shaped plane area, thereby realizing the process of physical collision simulation in an arc-shaped plane area and improving the visual experience.
[0034] One possible application scenario of the present application is a game prize drawing scenario. In game development, the prize drawing system is a common player incentive mechanism. Through prize drawing, players can obtain various rewards in the game, such as virtual currency, equipment, character skins, etc. This not only increases the game experience of players, but also encourages players to participate in the game more, improves the activity and retention rate of players.
[0035] Among them, the marble physical simulation prize drawing is a common way in user interface prize drawing, which is to shoot a marble into a designated area at a certain speed. After a series of collisions, the marble slows down and stops at a certain prize.
[0036] The collision simulation method of the virtual motion object in an embodiment of the present application can run on a local terminal device or a server. When the collision simulation method of the virtual motion object runs on the server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system comprises the server and a client device.
[0037] In an optional embodiment, various cloud applications can run under the cloud interaction system, for example, cloud games. Taking the cloud games as an example, the cloud games refer to a game mode based on cloud computing. In the running mode of the cloud games, the running subject of the game program and the presentation subject of the game picture are separated, and the storage and running of the collision simulation method of the virtual motion object are completed on the cloud game server. The client device is used for receiving and sending data and presenting the game picture. For example, the client device can be a display device close to the user side and having a data transmission function, such as a mobile terminal, a television, a computer, a palm computer, etc. However, the cloud game server in the cloud end performs information processing. When playing the game, the player operates the client device to send operation instructions to the cloud game server, the cloud game server runs the game according to the operation instructions, encodes and compresses the game picture and other data, returns the data to the client device through the network, and finally decodes and outputs the game picture through the client device.
[0038] In an optional embodiment, taking the game as an example, the local terminal device stores the game program and is used for presenting the game picture. The local terminal device is used for interacting with the player through the graphical user interface, that is, the conventional game program is downloaded and installed on the electronic device and is run. The way in which the local terminal device provides the graphical user interface to the player can include various ways, for example, the graphical user interface can be rendered and displayed on the display screen of the terminal, or the graphical user interface can be provided to the player through holographic projection. For example, the local terminal device can include a display screen and a processor, the display screen is used for presenting the graphical user interface, the graphical user interface includes the game picture, and the processor is used for running the game, generating the graphical user interface, and controlling the display of the graphical user interface on the display screen.
[0039] In a possible embodiment, the embodiment of the present application provides a collision simulation method of a virtual motion object, which provides a graphical user interface through a terminal device. The terminal device can be the aforementioned local terminal device or the aforementioned client device in the cloud interaction system.
[0040] Figure 1 The collision simulation method of the virtual motion object provided by the embodiment of the present application is shown in the flowchart Figure One The execution subject of the embodiment can be an electronic device.
[0041] As Figure 1 shown, the method can comprise:
[0042] S101, acquire attribute parameters of the virtual moving object, attribute parameters of the arc-shaped collision region, and motion parameters of the virtual moving object.
[0043] The attribute parameters of the virtual moving object include a starting point of the virtual moving object, the attribute parameters of the arc-shaped collision region include a reference point in the arc-shaped collision region, and the motion parameters include a target collision number and a stopping point in the arc-shaped collision region.
[0044] The starting point of the virtual moving object is located outside the arc-shaped collision region, the arc-shaped collision region can be a circular region, an elliptical region, or a region with an arc-shaped edge, the reference point in the arc-shaped collision region can be any point in the arc-shaped collision region, for example, a center point, if the arc-shaped collision region is a circular region, the reference point can be the center of the circle, the target collision number is the number of collisions of the virtual moving object in the arc-shaped collision region, and the stopping point in the arc-shaped collision region is a point where the virtual moving object stops in the arc-shaped collision region after being shot from the starting point to the arc-shaped collision region and colliding with the arc-shaped edge of the arc-shaped collision region for the target collision number of times.
[0045] It is worth noting that the attribute parameters of the virtual moving object, the attribute parameters of the arc-shaped collision region, and the motion parameters of the virtual moving object can be pre-set according to actual needs.
[0046] In the game lottery scene, the arc-shaped collision region can be a lottery restriction region, a plurality of reward positions are provided in the lottery restriction region, different reward positions correspond to different rewards, and the virtual moving object can be a circular marble, for example. When the circular marble is shot at a high speed from a certain direction to the lottery restriction region, after multiple collisions and rebounds and speed attenuation of the arc-shaped edge of the lottery restriction region, the marble finally stops at a certain reward position, it is determined that the player's lottery reward is the reward corresponding to the reward position.
[0047] It is worth noting that the stopping point in the lottery restriction region can be determined according to the game level of the player, the game equipment owned by the player, or randomly, and this embodiment does not make special limitations.
[0048] Taking the virtual moving object as a marble and the arc-shaped collision region as a lottery restriction region as an example, Figure 2 a schematic diagram of a graphical user interface provided by an embodiment of the present application Figure One As shown in Figure 2 , four lottery positions X1, X2, X3, and X4 are provided in the arc-shaped collision region, the stopping point in the arc-shaped collision region is X4, and the marble stops at X4 after being shot from the entrance of the arc-shaped collision region to the arc-shaped collision region through the starting point and colliding with the arc-shaped edge of the arc-shaped collision region, it is determined that the reward corresponding to X4 is the lottery reward of the player.
[0049] S102, according to the starting point, the reference point, the target collision times and the stopping point, simulating the collision of the virtual moving object in the arc-shaped collision region to obtain a plurality of intersection points of the virtual moving object and the arc-shaped edge of the arc-shaped collision region.
[0050] According to the reference point, the position of the arc-shaped collision region can be determined. After the virtual moving object is shot from the starting point to the arc-shaped collision region, and after the target collision times of collision with the arc-shaped edge of the arc-shaped collision region, the virtual moving object stops at the stopping point in the arc-shaped collision region. The collision of the virtual moving object in the arc-shaped collision region is simulated to obtain a plurality of intersection points of the virtual moving object and the arc-shaped edge of the arc-shaped collision region. The number of intersection points is consistent with the target collision times, that is, the virtual moving object collides with the arc-shaped edge once, and an intersection point is generated.
[0051] Here, the arc-shaped edge refers to the arc-shaped edge in the arc-shaped collision region.
[0052] S103, according to the starting point, the plurality of intersection points and the stopping point, generating a collision simulation path of the virtual moving object to control the movement of the virtual moving object from the starting point to the stopping point.
[0053] The starting point, the plurality of intersection points and the stopping point are sequentially connected to generate a collision simulation path of the virtual moving object, so as to control the movement of the virtual moving object from the starting point to the stopping point through the plurality of intersection points based on the collision simulation path. The movement path of the virtual moving object from the starting point to the stopping point is the collision simulation path.
[0054] It is worth noting that the point mentioned in the embodiment refers to the position (x, y) of the point. For example, obtaining the starting point of the virtual moving object refers to obtaining the position of the starting point of the virtual moving object. For example, determining the intersection point refers to determining the position of the intersection point.
[0055] In the embodiment, under the premise of determining the stopping point, the launching, rebounding and stopping point of the virtual moving object are simulated on the user interface by simplifying various physical simulation coefficients, so as to simulate the process of physical collision simulation of the arc-shaped plane region, and the experience is more realistic. For the game lottery scene, the physical collision lottery process is simulated to a certain extent under the premise of ensuring the final lottery result, so that the player can feel the real experience.
[0056] Figure 3 Flowchart of the collision simulation method of the virtual moving object provided by the embodiment of the application Figure TwoIn an optional embodiment, the target collision times include: a first collision time and a second collision time, wherein the first collision time is the number of collisions between the virtual moving object and the arc-shaped edge of the arc-shaped collision region after the virtual moving object is shot from the starting point to the arc-shaped collision region, and the second collision time is the number of collisions between the virtual moving object and the arc-shaped edge of the arc-shaped collision region after the virtual moving object is shot from the stopping point to the arc-shaped collision region.
[0057] As shown in Figure 3 The step S102 of simulating the collision of the virtual moving object in the arc-shaped collision region according to the starting point, the reference point, the target collision times and the stopping point can include:
[0058] S201, simulating the forward collision of the virtual moving object in the arc-shaped collision region according to the starting point, the reference point and the first collision time, to obtain a plurality of forward intersection points between the virtual moving object and the arc-shaped edge.
[0059] The forward intersection point is the intersection point obtained after the virtual moving object is shot from the starting point to the arc-shaped collision region and collides with the arc-shaped edge of the arc-shaped collision region for the first collision time.
[0060] The position of the arc-shaped collision region can be determined according to the reference point, and the forward collision simulation of the virtual moving object in the arc-shaped collision region can be understood as obtaining the intersection point between the virtual moving object and the arc-shaped edge after the virtual moving object is shot from the starting point to the arc-shaped collision region and collides with the arc-shaped edge of the arc-shaped collision region for the first collision time, and taking the intersection point as the forward intersection point, wherein the number of the plurality of forward intersection points is consistent with the first collision time.
[0061] S202, simulating the reverse collision of the virtual moving object in the arc-shaped collision region according to the stopping point, the reference point and the second collision time, to obtain a plurality of reverse intersection points between the virtual moving object and the arc-shaped edge.
[0062] The reverse intersection point is the intersection point obtained after the virtual moving object is shot from the stopping point to the arc-shaped collision region and collides with the arc-shaped edge of the arc-shaped collision region for the first collision time.
[0063] The position of the arc-shaped collision region can be determined according to the reference point, and the reverse collision simulation of the virtual moving object in the arc-shaped collision region can be understood as obtaining the intersection point between the virtual moving object and the arc-shaped edge after the virtual moving object is shot from the stopping point to the arc-shaped collision region and collides with the arc-shaped edge of the arc-shaped collision region for the second collision time, and taking the intersection point as the reverse intersection point, wherein the number of the plurality of reverse intersection points is consistent with the second collision time.
[0064] Among them, the multiple intersection points of the virtual moving object and the arc-shaped collision area include: multiple forward intersection points and multiple reverse intersection points.
[0065] In this embodiment, forward and reverse collision simulations are used to obtain forward and reverse intersection points, which facilitates the subsequent generation of forward and reverse collision paths to obtain the complete collision simulation path of the virtual moving object.
[0066] Figure 4 Flowchart of the collision simulation method for virtual moving objects provided in the embodiments of this application Figure Three In an optional implementation, the attribute parameters of the virtual moving object further include: a first size of the virtual moving object, a first incident angle, and a second incident angle, and the attribute parameters of the arc-shaped collision region further include: a second size of the arc-shaped collision region.
[0067] Wherein, the first dimension is the size of the virtual moving object, which may include, for example, the radius of the virtual moving object, and the first incident angle is the angle between the first incident ray and a preset horizontal line when the virtual moving object is launched from the starting point into the arc-shaped collision area. Figure 5 A schematic diagram of the graphical user interface provided in the embodiments of this application. Figure Two ,like Figure 5 As shown, the starting point is P, the first incident ray is PA1, and the preset horizontal line is EF. Then the first incident angle is ∠A1PF.
[0068] The second incident angle is the angle between the second incident ray and the preset horizontal line when the virtual moving object is shot from the stopping point into the arc-shaped collision area. Figure 6 A schematic diagram of the graphical user interface provided in the embodiments of this application. Figure Three ,like Figure 6 As shown, the stopping point is Q, the second incident ray is QA2, and the preset horizontal line is EF. Then the second incident angle is ∠A2QF.
[0069] It is worth noting that the first and second incident angles can be preset, and the first and second incident angles are values between 0° and 360°.
[0070] The second dimension is the size of the arc-shaped collision region, which may include, for example, the radius of the arc-shaped collision region.
[0071] Understandable, Figure 5 , Figure 6 This is just a collision diagram, illustrating two forward collisions and two reverse collisions. In the simulated collision process, the number of forward collisions is the first collision count, and the number of reverse collisions is the second collision count.
[0072] like Figure 4As shown, step S201 above, based on the starting point, reference point, and the first collision count, performs a forward collision simulation on the virtual moving object within the arc-shaped collision area to obtain multiple forward intersection points between the virtual moving object and the arc-shaped edge, which may include:
[0073] S301. Based on the starting point, reference point, first collision count, first size, second size, and first incident angle, perform forward collision simulation on the virtual moving object within the arc-shaped collision area to obtain multiple forward intersection points.
[0074] The location and range of the arc-shaped collision area can be determined based on the reference point and the second dimension. Based on the starting point, reference point, first number of collisions, first dimension, second dimension and first incident angle, the virtual moving object is launched from the starting point to the arc-shaped collision area based on the first incident angle. After colliding with the arc edge for the first number of collisions, the virtual moving object is simulated to perform a positive collision within the arc-shaped collision area, resulting in multiple positive intersection points between the virtual moving object and the arc edge.
[0075] Step S202 above, based on the stopping point, reference point, and the second collision count, performs a reverse collision simulation on the virtual moving object within the arc-shaped collision area to obtain multiple reverse intersection points between the virtual moving object and the arc-shaped edge, which may include:
[0076] S302. Based on the stopping point, reference point, second collision count, first size, second size, and second incident angle, perform reverse collision simulation on the virtual moving object within the arc-shaped collision area to obtain multiple reverse intersection points.
[0077] The radius of motion of the virtual moving object within the arc-shaped collision area can be determined based on the first and second dimensions. The radius of motion is the difference between the second and first dimensions. The position and range of the arc-shaped collision area can be determined based on the reference point and the second dimension. Based on the stopping point, reference point, second number of collisions, first dimension, second dimension, and second incident angle, the virtual moving object is launched from the stopping point into the arc-shaped collision area based on the second incident angle. After colliding with the arc edge for the second number of collisions, a reverse collision simulation is performed on the virtual moving object within the arc-shaped collision area, resulting in multiple reverse intersection points between the virtual moving object and the arc edge.
[0078] In this embodiment, the size of the virtual moving object, the size of the arc-shaped collision area, the first incident angle, and the second incident angle are further considered to perform forward and reverse collision simulations to obtain forward and reverse intersection points, which improves the accuracy of the collision simulation and makes the subsequently generated collision simulation path more accurate and more realistic.
[0079] Figure 7 Flowchart of the collision simulation method for virtual moving objects provided in the embodiments of this applicationFigure Four ,like Figure 7 As shown, in an optional embodiment, step S301 above, which involves simulating a forward collision of the virtual moving object within the arc-shaped collision area based on the starting point, reference point, first collision count, first size, second size, and first incident angle, to obtain multiple forward intersection points, may include:
[0080] S401. Based on the starting point, reference point, second dimension, and first incident angle, perform a forward collision simulation on the virtual moving object to obtain the first forward intersection point between the virtual moving object and the arc edge.
[0081] The first positive intersection point is the intersection point that is farther from the starting point among the intersection points between the virtual moving object and the arc-shaped edge when the virtual moving object performs its first positive collision simulation. Specifically, when the virtual moving object performs its first positive collision simulation, the virtual moving object and the arc-shaped collision area have two intersection points, and the intersection point that is farther from the starting point is determined as the first positive intersection point.
[0082] The following describes the process of determining the position of the first positive intersection point using specific position and size parameters. The starting point P is (beginX, beginY), the reference point is the center C (centerX, centerY), the second size is the radius of the arc-shaped collision region (oriRadius), and the first incident angle is theta1 (beginRotate). Determining the first incident angle also determines the current direction of motion (dir) of the virtual moving object.
[0083] In the first forward collision simulation of the virtual moving object, the movable radius r of the virtual moving object within the arc-shaped collision region is the radius (oriRadius) of the arc-shaped collision region.
[0084] The first incident angle corresponds to the direction vector of the first incident ray, D = (cos(theta1), sin(theta1)). Let M = PC, b = M × D, d = M[x] × M[x] + M[y] × M[y] - r × r, discr = b × bd, t1 = -b - sqrt(discr), t2 = -b + sqrt(discr).
[0085] Calculate t1 and t2 using the above formula. If t1>t2, let t=t1. If t1>t2, let t=t2. The position of the first positive intersection point IN1 is (P[x]+t×D[x],P[y]+t×D[y]), where P[x] represents the x-coordinate of P, i.e., beginX, P[y] represents the y-coordinate of P, i.e., beginY, D[x] represents the x-coordinate of D, i.e., cos(theta1), and D[y] represents the y-coordinate of D, i.e., sin(theta1).
[0086] S402. Based on the first positive intersection point, the starting point, and the reference point, determine the reflection angle of the first returning ray corresponding to the first incident ray.
[0087] Wherein, the first return ray is the ray containing the first positive intersection point and the second positive intersection point; the second positive intersection point is the point where the virtual moving object, after being bounced off the first positive intersection point, intersects with the arc-shaped edge; and the reflection angle of the first return ray is the angle between the first return ray and the preset horizontal line. (See [reference]). Figure 5 The first positive intersection point is A1, the second positive intersection point is B1, the first return ray is the ray containing A1 and B1, and the reflection angle of the first return ray is ∠A1B1F. The intersection point of the first incident ray and the arc edge is the current position curPos of the virtual moving object.
[0088] Let I = IN1 - P, N = IN1 - C, then the ray vector of the first returning ray is R = (I[x] - 2 × (I × N) × N[x], I[y] - 2 × (I × N) × N[y]). Calculate atan2(R[y], R[x]) and convert it to angle to obtain the reflection angle of the first returning ray.
[0089] S403. Based on the first positive intersection point, the reflection angle of the first return ray, the reference point, the first dimension, and the second dimension, perform a positive collision simulation on the virtual moving object to obtain the second positive intersection point between the virtual moving object and the arc edge, until the number of positive collision simulations reaches the first number of collisions, and take all the positive intersection points obtained when the first number of collisions is reached as multiple positive intersection points.
[0090] The first dimension is the radius of the virtual moving object, the first collision number is reflectNum, and the multiple positive intersection points include: the first positive intersection point.
[0091] The first positive intersection point is taken as the starting point of the virtual moving object, and the reflection angle of the first returning ray is taken as the first incident angle of the virtual moving object. The difference between the second dimension and the first dimension is calculated as the movable radius of the virtual moving object within the arc-shaped collision area, i.e., zoneRadius = oriRadius - radius. Determining the reflection angle of the first returning ray also determines the new direction of motion (newDir) of the virtual moving object.
[0092] Based on the first positive intersection point, the reflection angle of the first returning ray, the reference point, and the movable radius, using the above formula D=(cos(theta1), sin(theta1)), let M=PC, b=M×D, d=M[x]×M[x]+M[y]×M[y]-r×r, discr=b×bd, t1=-b-sqrt(discr), t2=-b+sqrt(discr), the second positive intersection point between the virtual moving object and the arc edge is calculated.
[0093] Then, referring to the steps above, based on the second forward intersection point, the first forward intersection point, and the reference point, determine the reflection angle of the return ray corresponding to the first return ray. Repeat this process until the number of forward collision simulations reaches the first number of collisions. All forward intersection points obtained when the first number of collisions is reached are taken as multiple forward intersection points. Among them, all forward intersection points obtained when the first number of collisions is reached include: the first forward intersection point and the second forward intersection point.
[0094] It is worth noting that the starting point and multiple forward intersection points form a list of key points for the forward collision path (posList1). The forward collision path (posList1) is generated by connecting the points in the list of key points in sequence.
[0095] In this embodiment, based on the starting point, reference point, second dimension, and first incident angle, a first number of forward collision simulations are performed on the virtual moving object to obtain the first forward intersection point between the virtual moving object and the curved edge. This process is iteratively executed until multiple forward intersection points are obtained. This improves the accuracy of the forward intersection points, making the collision simulation path of the virtual moving object more realistic.
[0096] Figure 8 Flowchart of the collision simulation method for virtual moving objects provided in the embodiments of this application Figure Five ,like Figure 8 As shown, in an optional embodiment, step S302 above involves performing a reverse collision simulation on the virtual moving object within the arc-shaped collision area based on the stopping point, reference point, second collision count, first size, second size, and second incident angle, to obtain multiple reverse intersection points, including:
[0097] S501. Based on the stop point, reference point, first dimension, second dimension, and second incident angle, perform reverse collision simulation on the virtual moving object to obtain the first reverse intersection point between the virtual moving object and the arc edge.
[0098] The first reverse intersection point is the intersection point between the virtual moving object and the curved edge when the first reverse collision simulation is performed on the virtual moving object.
[0099] The following describes the process of determining the position of the first positive intersection point using specific position and size parameters. The stopping point Q is (targetX, targetY), the reference point is the center C (centerX, centerY), the first dimension is the radius of the virtual moving object (radius), the second dimension is the radius of the arc-shaped collision area (oriRadius), and the second incident angle is theta2 (targetRotate). Determining the second incident angle also determines the current direction of motion (dir) of the virtual moving object.
[0100] In the first reverse collision simulation of the virtual moving object, the stopping point is taken as the starting point of the virtual moving object. The movable radius r of the virtual moving object in the arc-shaped collision area is the difference between the second dimension and the first dimension, that is, zoneRadius = oriRadius - radius.
[0101] The direction vector of the second incident ray corresponding to the second incident angle is D = (cos(theta2), sin(theta2)). Let M = QC, b = M × D, d = M[x] × M[x] + M[y] × M[y] - r × r, discr = b × bd, t1 = -b - sqrt(discr), t2 = -b + sqrt(discr).
[0102] Calculate t1 and t2 using the above formula. If t1>t2, let t=t1. If t1>t2, let t=t2. The position of the first reverse intersection point IN2 is (Q[x]+t×D[x],Q[y]+t×D[y]), where Q[x] represents the x-coordinate of Q, i.e., beginX, Q[y] represents the y-coordinate of Q, i.e., beginY, D[x] represents the x-coordinate of D, i.e., cos(theta2), and D[y] represents the y-coordinate of D, i.e., sin(theta2).
[0103] S502. Based on the first reverse intersection point, the stopping point, and the reference point, determine the reflection angle of the second returning ray corresponding to the second incident ray.
[0104] The second return ray is the ray containing the first and second reverse intersection points. The second reverse intersection point is the point where the virtual moving object, after being bounced off the first reverse intersection point, intersects the curved edge. The reflection angle of the second return ray is the angle between the second return ray and the preset horizontal line. (See [reference]). Figure 6 The first reverse intersection point is A1, the second reverse intersection point is B2, the second return ray is the ray containing A2 and B2, and the reflection angle of the second return ray is ∠A2B2F. The intersection point of the second incident ray and the arc edge is the current position curPos of the virtual moving object.
[0105] Let I = IN2 - Q and N = IN2 - C. Then the ray vector of the first returning ray is R = (I[x] - 2 × (I × N) × N[x], I[y] - 2 × (I × N) × N[y]). Calculate atan2(R[y], R[x]) and convert it to angle to obtain the reflection angle of the second returning ray.
[0106] S503. Based on the first reverse intersection point, the reflection angle of the second return ray, the reference point, the first dimension, and the second dimension, perform a reverse collision simulation on the virtual moving object to obtain the second reverse intersection point between the virtual moving object and the arc edge, until the number of reverse collision simulations reaches the second collision count, and take all the reverse intersection points obtained when the second collision count is reached as multiple reverse intersection points.
[0107] The second collision count is forward_rebound, and multiple reverse intersection points include: the first reverse intersection point.
[0108] The first reverse intersection point is taken as the starting and stopping point of the virtual moving object, and the reflection angle of the second returning ray is taken as the second incident angle of the virtual moving object. The movable radius r is the difference between the second dimension and the first dimension. Determining the reflection angle of the second returning ray also determines the current motion direction (newDir) of the virtual moving object.
[0109] Based on the first reverse intersection point, the reflection angle of the second returning ray, the reference point, and the movable radius, using the above formula D=(cos(theta2), sin(theta2)), let M=PC, b=M×D, d=M[x]×M[x]+M[y]×M[y]-r×r, discr=b×bd, t1=-b-sqrt(discr), t2=-b+sqrt(discr), the second reverse intersection point between the virtual moving object and the arc edge is calculated.
[0110] Then, referring to the steps above, based on the second reverse intersection point, the first reverse intersection point, and the reference point, determine the reflection angle of the return ray corresponding to the second return ray. Repeat this process until the number of reverse collision simulations reaches the second collision count. All reverse intersection points obtained when the second collision count is reached are taken as multiple reverse intersection points. Among them, all reverse intersection points obtained when the second collision count is reached include: the first reverse intersection point and the second reverse intersection point.
[0111] It is worth noting that the stopping point and multiple reverse intersection points form the key point list of the reverse collision path (posList2). By connecting the points in the key point list in sequence, the forward collision path (posList2) is generated.
[0112] In this embodiment, based on the stopping point, reference point, first dimension, second dimension, and first incident angle, a second number of reverse collision simulations are performed on the virtual moving object to obtain the first reverse intersection point between the virtual moving object and the curved edge. This process is iteratively executed until multiple reverse intersection points are obtained. This improves the accuracy of the reverse intersection points, making the collision simulation path of the virtual moving object more realistic.
[0113] Figure 9 Flowchart of the collision simulation method for virtual moving objects provided in the embodiments of this application Figure Six ,like Figure 9 As shown, in an optional implementation, step S103 above, which generates a collision simulation path for the virtual moving object based on the starting point, multiple intersection points, and the stopping point, may include:
[0114] S601. Generate the forward collision path of the virtual moving object based on the starting point and multiple forward intersection points.
[0115] By sequentially connecting the starting point and multiple positive intersection points, a positive collision path is generated for the virtual moving object. The positive collision path refers to the path formed after the virtual moving object is launched from the starting point into the arc-shaped collision area and undergoes multiple reflections (collisions) with the arc-shaped edge within the arc-shaped collision area.
[0116] Connecting the starting point and multiple positive intersection points in sequence can be understood as connecting the starting point P with the positive intersection point A1 obtained from the first collision, connecting the positive intersection point A1 obtained from the first collision with the positive intersection point B1 obtained from the second collision, connecting the positive intersection point B1 obtained from the second collision with the positive intersection point C1 obtained from the third collision, and so on, to obtain the positive collision path.
[0117] S602. Generate the reverse collision path of the virtual moving object based on the stopping point and multiple reverse intersection points.
[0118] By sequentially connecting the stopping point and multiple reverse intersection points, a reverse collision path is generated for the virtual moving object. The reverse collision path refers to the path formed after the virtual moving object is launched from the stopping point into the arc-shaped collision area and undergoes multiple reflections (collisions) with the arc-shaped edge within the arc-shaped collision area.
[0119] Connecting the stopping point and multiple reverse intersection points in sequence can be understood as connecting the stopping point Q with the reverse intersection point A2 obtained from the first collision, connecting the reverse intersection point A2 obtained from the first collision with the reverse intersection point B2 obtained from the second collision, connecting the reverse intersection point B2 obtained from the second collision with the reverse intersection point C2 obtained from the third collision, and so on, to obtain the reverse collision path.
[0120] S603. Generate a collision simulation path based on the forward collision path and the reverse collision path.
[0121] In some embodiments, the endpoints of the forward collision path and the reverse collision path are connected to generate a collision simulation path, with the starting point of the collision simulation path being the starting point and the ending point being the stopping point.
[0122] In an optional implementation, step S603 above, generating a collision simulation path based on the forward collision path and the reverse collision path, includes:
[0123] Reverse the order of the stopping point and multiple reverse intersection points in the reverse collision path to generate a reverse collision path;
[0124] Based on the forward collision path and the reverse collision path, a collision simulation path is generated.
[0125] Reversing the order of the stopping point and multiple reverse intersections in a reverse collision path can be understood as taking the stopping point as the end point of the reverse collision path and the last reverse intersection as the starting point, with the other reverse intersections following the same logic. For example, connecting the stopping point Q, reverse intersections A2, B2, C2... sequentially to generate a reverse collision path, and then reversing it, connecting the reverse intersections...C2, B2, A2, and stopping point Q sequentially to generate the reverse collision path.
[0126] Then, based on the points on the forward collision path and the points on the reverse collision path, a collision simulation path is generated. The points on the forward collision path and the points on the reverse collision path are merged to obtain merged points, and the merged points are connected sequentially to generate the collision simulation path.
[0127] For example, the points on the forward collision path are P, A1, B1, C1..., and the points on the reverse collision path are C2, B2, A2, Q. The merged points are P, A1, B1, C1..., C2, B2, A2, Q. Then, P, A1, B1, C1..., C2, B2, A2, Q are connected in sequence to generate a collision simulation path. The starting point of the simulation collision path is M, and the ending point is N.
[0128] In some embodiments, to reduce the amount of data, points on the forward collision path and points on the reverse collision path are filtered based on preset filtering rules. The end point of the filtered forward collision path and the start point of the filtered reverse collision path are connected to reverse the points on the reverse collision path and splice them onto the forward collision path, thereby forming a collision simulation path for the virtual moving object.
[0129] In this embodiment, in order to ensure that the virtual moving object can eventually stop at the stopping point, a forward collision path is determined from the initial point, and a reverse collision path is determined from the stopping point. The complete collision simulation path of the virtual moving object is determined by combining the forward collision path and the reverse collision path.
[0130] Figure 10 Flowchart of the collision simulation method for virtual moving objects provided in the embodiments of this application Figure Seven ,like Figure 10 As shown, in an optional implementation, the motion parameters further include: a preset speed threshold and a speed control coefficient.
[0131] The preset speed threshold is the minimum speed end_speed before the virtual moving object stops, and the speed control coefficient is speed_arg.
[0132] After generating the collision simulation path of the virtual moving object based on the starting point, multiple intersection points, and the stopping point in step S103 above, the method may further include:
[0133] S701, In response to a collision motion trigger event for a virtual motion object, set the virtual motion object at the starting point.
[0134] Among them, the collision motion trigger event is a collision motion trigger event for virtual moving objects that is input by the player through the user interface. For example, the player clicks the "lottery control" in the user interface to trigger the collision motion trigger event.
[0135] In response to the collision motion trigger event, render the virtual motion object based on the starting point to set the virtual motion object at the starting point.
[0136] S702. Determine the current speed of the virtual moving object based on the target distance of the collision simulation path, the preset speed threshold, and the speed control coefficient.
[0137] Based on the positions of the starting point, multiple intersection points, and the stopping point, the sum of the Euclidean distances between any two adjacent points is calculated as the target distance for the collision simulation path.
[0138] Based on the target distance, preset speed threshold, and speed control coefficient, the current speed of the virtual moving object is calculated. The current speed is:
[0139] speed=sqrt(end_speed×end_speed-2×speed_arg×distance)
[0140] In some embodiments, the vector of the current motion direction of the virtual motion is curMoveDir = posList[2] - posList[1], where posList[1] is the starting point, posList[2] is the next point after the starting point among multiple intersection points, the index of the starting point (current index curIndex) is 1, and the index of the next point is 2.
[0141] S703. Determine the target movement position of the virtual moving object based on the incremental time of the current frame and the current speed.
[0142] The current frame increment time (delta_time) is the preset time elapsed from the previous frame to the current frame.
[0143] Based on the incremental time of the current frame and the current speed, determine the movement distance (horizontal movement distance and vertical movement distance) of the virtual moving object, and determine the target movement position based on the starting point and the movement distance.
[0144] Where the lateral movement distance is xDis = speed × delta_time × curMoveDir[x], and the longitudinal movement distance is yDis = speed × delta_time × curMoveDir[y], where curMoveDir[x] is the x-coordinate of the vector curMoveDir in the current movement direction, and curMoveDir[y] is the y-coordinate of the vector curMoveDir in the current movement direction. Then the position of the target movement is tPos = (curPos[x] + xDis, curPos[y] + yDis), where curPos[x] is the x-coordinate of the starting point, and curPos[y] is the y-coordinate of the starting point.
[0145] S704. Update the position of the virtual moving object in the current frame according to the target's movement position until the virtual moving object moves to the stop point.
[0146] Based on the target's movement position, update the position of the virtual moving object in the current frame. Then, based on the incremental time of the next frame and the current speed, determine the movement point of the virtual moving object in the next frame, and update the position of the virtual moving object in the next frame accordingly. Repeat this process until the virtual moving object moves to the stopping point.
[0147] In an optional implementation, step S704 above, updating the position of the virtual moving object in the current frame according to the target movement position until the virtual moving object moves to a stopping point, may include:
[0148] If the target's movement position is on the path segment between the starting point and the first target point, then the virtual moving object will be moved to the target's movement position in the current frame. The first target point is the point following the starting point among multiple intersection points and stopping points.
[0149] The path segment between the starting point and the first target point is the line segment between the starting point and the first target point on the collision simulation path.
[0150] posList[1] is the starting point and posList[2] is the first target point. It is determined whether the target movement position is on the path segment formed by posList[1] and posList[2]. If it is, the virtual motion object is moved to the target movement position in the current frame to update the position of the virtual motion object.
[0151] In other words, during the iteration process, after determining the movement point of the virtual motion object in each frame, it is necessary to determine whether the movement point is on the path segment composed of posList[curIndex] and posList[curIndex+1]. If it is, the position of the virtual motion object in each frame is updated using the movement point, so as to move the virtual motion object to the corresponding movement point in each frame. For example, if the movement position in the next frame is on the path segment between the first target point and the next point of the first target point, the position of the virtual motion object in the next frame is updated based on the movement position in the next frame. Here, the next point is the next point of the first target point among multiple intersection points and stopping points.
[0152] It is worth noting that if the virtual moving object moves to the path segment between the stop point and the point before the stop point, the virtual moving object can be directly controlled to move to the stop point in the next frame.
[0153] In an optional implementation, step S704 above, updating the position of the virtual moving object in the current frame according to the target's movement position, may include:
[0154] If the target's location is not on the path segment, then the second target point is determined from multiple intersection points, and the second target point is the next point after the first target point;
[0155] Move the virtual moving object to the second target point in the current frame.
[0156] If the target's movement position is not on the path segment between the starting point and the first target point, it means that the virtual moving object has already completed the path segment between the starting point posList[1] and the first target point posList[2]. Then, the next point of the first target point is determined from multiple intersection points and stopping points as the second target point, and the virtual moving object is moved to the second target point in the current frame.
[0157] It is worth noting that during the iteration process, if the moving position is not on the corresponding path segment, the index curIndex of the current point is incremented by 1, and it is determined whether the index after incrementing by 1 exceeds the index range of points on the collision simulation path. The index range is [1]-[X], where 1 is the index of the starting point and X is the index of the stopping point. If the index after incrementing by 1 exceeds X, it means that the collision simulation path has been completed and the simulation journey has ended. In the next frame, the virtual moving object can be controlled to move to the stopping point. Here, the index is an integer from 1 to X.
[0158] If the number of moving objects does not exceed N, then the virtual moving object is determined to have moved to posList[curIndex] in the current frame. posList[curIndex] is the point corresponding to the index after adding 1. The vector of the current motion direction is curMoveDir = posList[curIndex+1] - posList[curIndex], where posList[curIndex+1] is the point corresponding to the index after adding 2.
[0159] In this embodiment, based on the collision simulation path, the target movement position of the virtual moving object is determined in different screen frames, and the movement of the virtual moving object is controlled until it reaches the stopping point. This allows the virtual moving object to be rendered along the collision simulation path on the interface, resulting in a more realistic experience.
[0160] Figure 11 Flowchart of the collision simulation method for virtual moving objects provided in the embodiments of this application Figure Eight ,like Figure 11 As shown, in an optional embodiment, the motion parameters further include: multiple motion velocities and accelerations corresponding to each motion velocity.
[0161] The multiple motion speeds and their corresponding accelerations are contained in the acceleration segment list delay_speed. delay_speed contains multiple (speed, acc_speed), indicating that when the motion speed reaches speed, acc_speed is used as the acceleration.
[0162] Step S703 above, which determines the target movement position of the virtual moving object based on the incremental time of the current frame and the current speed, may include:
[0163] S801. If the current speed does not exceed the preset speed threshold, the target's moving position is determined based on the incremental time of the current frame and the preset speed threshold.
[0164] Determine whether the current speed exceeds the preset speed threshold (end_speed). If the current speed is less than or equal to the preset speed threshold, it is determined that the current speed does not exceed the preset speed threshold. Then, the preset speed threshold is used as the current speed. The calculation formula in step S703 above is used to substitute the preset speed threshold into the formula to determine the target movement position.
[0165] S802. If the current speed exceeds the preset speed threshold, the current speed is re-determined based on the acceleration corresponding to the current speed, the current speed, and the incremental time. The target's moving position is then determined based on the incremental time and the re-determined current speed.
[0166] If the current speed exceeds the preset speed threshold, the acceleration corresponding to the current speed is determined by querying and determining the current speed. Based on the acceleration corresponding to the current speed, the current speed, and the incremental time, the current speed is re-determined as: -speed×delay_speed×delta_time.
[0167] Where speed is the current speed, delay_speed is the acceleration corresponding to the current speed, and delta_time is the increment time.
[0168] Then, based on the incremental time and the newly determined current speed, the target's moving position is determined. That is, the calculation formula in step S703 above is used, and the newly determined current speed is substituted into the formula to determine the target's moving position.
[0169] In this embodiment, a multi-layer acceleration method is used to adjust the speed change of the virtual moving object. That is, the speed decay acceleration of the virtual moving object is different in different speed ranges, so as to control the visual decay change of the virtual moving object at different speeds and thus achieve a better visual rhythm effect.
[0170] Figure 12 This is a schematic diagram of the structure of a collision simulation device for virtual moving objects provided in an embodiment of this application. This device can be integrated into an electronic device.
[0171] like Figure 12 As shown, the device may include:
[0172] The acquisition module 901 is used to acquire the attribute parameters of the virtual moving object, the attribute parameters of the arc-shaped collision region, and the motion parameters of the virtual moving object. The attribute parameters of the virtual moving object include the starting point of the virtual moving object, the attribute parameters of the arc-shaped collision region include the reference point within the arc-shaped collision region, and the motion parameters include the number of target collisions and the stopping point within the arc-shaped collision region.
[0173] The processing module 902 is used to perform collision simulation on the virtual moving object in the arc-shaped collision area based on the starting point, reference point, target collision count and stopping point, and obtain multiple intersection points between the virtual moving object and the arc edge of the arc-shaped collision area;
[0174] The generation module 903 is used to generate a collision simulation path for a virtual moving object based on the starting point, multiple intersection points, and the stopping point, so as to control the virtual moving object to move from the starting point to the stopping point.
[0175] In an optional implementation, the target collision count includes: a first collision count and a second collision count;
[0176] Processing module 902 is specifically used for:
[0177] Based on the starting point, reference point, and the first collision count, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple forward intersection points between the virtual moving object and the arc-shaped edge.
[0178] Based on the stopping point, reference point, and the second collision count, a reverse collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple reverse intersection points between the virtual moving object and the arc-shaped edge; the multiple intersection points include multiple forward intersection points and multiple reverse intersection points.
[0179] In an optional implementation, the attribute parameters of the virtual moving object further include: a first size of the virtual moving object, a first incident angle, and a second incident angle; the attribute parameters of the arc-shaped collision region further include: a second size of the arc-shaped collision region; wherein, the first incident angle is the angle between a first incident ray and a preset horizontal line when the virtual moving object is shot from the starting point into the arc-shaped collision region, and the second incident angle is the angle between a second incident ray and a preset horizontal line when the virtual moving object is shot from the stopping point into the arc-shaped collision region;
[0180] Processing module 902 is specifically used for:
[0181] Based on the starting point, reference point, first collision count, first size, second size, and first incident angle, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple forward intersection points;
[0182] Based on the stopping point, reference point, second collision count, first size, second size, and second incident angle, reverse collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple reverse intersection points.
[0183] In an optional implementation, the processing module 902 is specifically used for:
[0184] Based on the starting point, reference point, second dimension, and first incident angle, a forward collision simulation is performed on the virtual moving object to obtain the first forward intersection point between the virtual moving object and the arc edge.
[0185] Based on the first positive intersection point, the starting point, and the reference point, determine the reflection angle of the first returning ray corresponding to the first incident ray;
[0186] Based on the first positive intersection point, the reflection angle of the first return ray, the reference point, the first dimension, and the second dimension, a positive collision simulation is performed on the virtual moving object to obtain the second positive intersection point between the virtual moving object and the arc edge. This process continues until the number of positive collision simulations reaches the first number of collisions, and all positive intersection points obtained when the first number of collisions is reached are taken as multiple positive intersection points.
[0187] In an optional implementation, the processing module 902 is specifically used for:
[0188] Based on the stopping point, reference point, first dimension, second dimension, and second incident angle, a reverse collision simulation is performed on the virtual moving object to obtain the first reverse intersection point between the virtual moving object and the arc edge;
[0189] Based on the first reverse intersection point, the stopping point, and the reference point, determine the reflection angle of the second return ray corresponding to the second incident ray;
[0190] Based on the first reverse intersection point, the reflection angle of the second return ray, the reference point, the first dimension, and the second dimension, a reverse collision simulation is performed on the virtual moving object to obtain the second reverse intersection point between the virtual moving object and the arc edge. This process continues until the number of reverse collision simulations reaches the second collision count, and all reverse intersection points obtained when the second collision count is reached are taken as multiple reverse intersection points.
[0191] In an optional implementation, the generation module 903 is specifically used for:
[0192] Generate a forward collision path for the virtual moving object based on the starting point and multiple forward intersection points;
[0193] Based on the stopping point and multiple reverse intersection points, generate the reverse collision path of the virtual moving object;
[0194] Based on the forward and reverse collision paths, a collision simulation path is generated.
[0195] In an optional implementation, the generation module 903 is specifically used for:
[0196] Reverse the order of the stopping point and multiple reverse intersection points in the reverse collision path to generate a reverse collision path;
[0197] Based on the forward collision path and the reverse collision path, a collision simulation path is generated.
[0198] In an optional implementation, the motion parameters further include: a preset speed threshold and a speed control coefficient; the processing module 902 is further configured to:
[0199] In response to a collision-triggered event for a virtual moving object, set the virtual moving object at the starting point;
[0200] The current speed of the virtual moving object is determined based on the target distance of the collision simulation path, the preset speed threshold, and the speed control coefficient.
[0201] The target movement position of the virtual moving object is determined based on the incremental time of the current frame and the current speed.
[0202] Update the position of the virtual moving object in the current frame based on the target's movement position until the virtual moving object moves to the stopping point.
[0203] In an optional implementation, the processing module 902 is specifically used for:
[0204] If the target's movement position is on the path segment between the starting point and the first target point, then the virtual moving object will be moved to the target's movement position in the current frame. The first target point is the point following the starting point among multiple intersection points and stopping points.
[0205] In an optional implementation, the processing module 902 is specifically used for:
[0206] If the target's location is not on the path segment, then the second target point is determined from multiple intersection points, and the second target point is the next point after the first target point;
[0207] Move the virtual moving object to the second target point in the current frame.
[0208] In an optional implementation, the motion parameters further include: multiple motion velocities and accelerations corresponding to each motion velocity; the processing module 902 is specifically used for:
[0209] If the current speed does not exceed the preset speed threshold, the target's movement position is determined based on the incremental time of the current frame and the preset speed threshold.
[0210] If the current speed exceeds the preset speed threshold, the current speed is re-determined based on the acceleration corresponding to the current speed, the current speed, and the incremental time. The target's moving position is then determined based on the incremental time and the re-determined current speed.
[0211] In this embodiment, the acquisition module is used to acquire the attribute parameters of the virtual moving object, the attribute parameters of the arc-shaped collision region, and the motion parameters of the virtual moving object. The attribute parameters of the virtual moving object include the starting point of the virtual moving object, and the attribute parameters of the arc-shaped collision region include the reference point within the arc-shaped collision region. The motion parameters include the target collision count and the stopping point within the arc-shaped collision region. The processing module is used to perform collision simulation on the virtual moving object within the arc-shaped collision region based on the starting point, reference point, target collision count, and stopping point, obtaining multiple intersection points between the virtual moving object and the arc-shaped edge of the arc-shaped collision region. The generation module is used to generate a collision simulation path for the virtual moving object based on the starting point, multiple intersection points, and stopping point, so as to control the virtual moving object to move from the starting point to the stopping point. Thus, under the premise of determining the stopping point, the process of simulating physical collision in the arc-shaped plane region is simulated, resulting in a more realistic experience.
[0212] Figure 13 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 13 As shown, the device may include: a processor 1001, a memory 1002, and a bus 1003. The memory 1002 stores machine-readable instructions executable by the processor 1001. When the electronic device is running, the processor 1001 communicates with the memory 1002 via the bus 1003. The processor 1001 executes the machine-readable instructions to perform the following steps:
[0213] Obtain the attribute parameters of the virtual moving object, the attribute parameters of the arc-shaped collision region, and the motion parameters of the virtual moving object; the attribute parameters of the virtual moving object include: the starting point of the virtual moving object, the attribute parameters of the arc-shaped collision region include: the reference point within the arc-shaped collision region, and the motion parameters include: the number of target collisions and the stopping point within the arc-shaped collision region;
[0214] Based on the starting point, reference point, number of target collisions, and stopping point, a collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple intersection points between the virtual moving object and the arc-shaped edge of the arc-shaped collision area.
[0215] Based on the starting point, multiple intersection points, and the stopping point, a collision simulation path for the virtual moving object is generated to control the virtual moving object's movement from the starting point to the stopping point.
[0216] In an optional implementation, the target collision count includes: a first collision count and a second collision count;
[0217] Based on the starting point, reference point, target collision count, and stopping point, a collision simulation is performed on the virtual moving object within the arc-shaped collision region, resulting in multiple intersection points between the virtual moving object and the arc-shaped edge of the collision region, including:
[0218] Based on the starting point, reference point, and the first collision count, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple forward intersection points between the virtual moving object and the arc-shaped edge.
[0219] Based on the stopping point, reference point, and the second collision count, a reverse collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple reverse intersection points between the virtual moving object and the arc-shaped edge; the multiple intersection points include multiple forward intersection points and multiple reverse intersection points.
[0220] In an optional implementation, the attribute parameters of the virtual moving object further include: a first size of the virtual moving object, a first incident angle, and a second incident angle; the attribute parameters of the arc-shaped collision region further include: a second size of the arc-shaped collision region; wherein, the first incident angle is the angle between a first incident ray and a preset horizontal line when the virtual moving object is shot from the starting point into the arc-shaped collision region, and the second incident angle is the angle between a second incident ray and a preset horizontal line when the virtual moving object is shot from the stopping point into the arc-shaped collision region;
[0221] Based on the starting point, reference point, and the first collision count, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision region, resulting in multiple forward intersection points between the virtual moving object and the arc-shaped edge, including:
[0222] Based on the starting point, reference point, first collision count, first size, second size, and first incident angle, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple forward intersection points;
[0223] Based on the stopping point, reference point, and the second collision count, a reverse collision simulation is performed on the virtual moving object within the arc-shaped collision region, resulting in multiple reverse intersection points between the virtual moving object and the arc-shaped edge, including:
[0224] Based on the stopping point, reference point, second collision count, first size, second size, and second incident angle, reverse collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple reverse intersection points.
[0225] In an optional implementation, based on the starting point, reference point, first collision count, first size, second size, and first incident angle, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision region to obtain multiple forward intersection points, including:
[0226] Based on the starting point, reference point, second dimension, and first incident angle, a forward collision simulation is performed on the virtual moving object to obtain the first forward intersection point between the virtual moving object and the arc edge.
[0227] Based on the first positive intersection point, the starting point, and the reference point, determine the reflection angle of the first returning ray corresponding to the first incident ray;
[0228] Based on the first positive intersection point, the reflection angle of the first return ray, the reference point, the first dimension, and the second dimension, a positive collision simulation is performed on the virtual moving object to obtain the second positive intersection point between the virtual moving object and the arc edge. This process continues until the number of positive collision simulations reaches the first number of collisions, and all positive intersection points obtained when the first number of collisions is reached are taken as multiple positive intersection points.
[0229] In an optional implementation, based on the stopping point, reference point, second collision count, first size, second size, and second incident angle, a reverse collision simulation is performed on the virtual moving object within the arc-shaped collision region to obtain multiple reverse intersection points, including:
[0230] Based on the stopping point, reference point, first dimension, second dimension, and second incident angle, a reverse collision simulation is performed on the virtual moving object to obtain the first reverse intersection point between the virtual moving object and the arc edge;
[0231] Based on the first reverse intersection point, the stopping point, and the reference point, determine the reflection angle of the second return ray corresponding to the second incident ray;
[0232] Based on the first reverse intersection point, the reflection angle of the second return ray, the reference point, the first dimension, and the second dimension, a reverse collision simulation is performed on the virtual moving object to obtain the second reverse intersection point between the virtual moving object and the arc edge. This process continues until the number of reverse collision simulations reaches the second collision count, and all reverse intersection points obtained when the second collision count is reached are taken as multiple reverse intersection points.
[0233] In an optional implementation, a collision simulation path for the virtual moving object is generated based on the starting point, multiple intersection points, and the stopping point, including:
[0234] Generate a forward collision path for the virtual moving object based on the starting point and multiple forward intersection points;
[0235] Based on the stopping point and multiple reverse intersection points, generate the reverse collision path of the virtual moving object;
[0236] Based on the forward and reverse collision paths, a collision simulation path is generated.
[0237] In an optional implementation, a collision simulation path is generated based on the forward collision path and the reverse collision path, including:
[0238] Reverse the order of the stopping point and multiple reverse intersection points in the reverse collision path to generate a reverse collision path;
[0239] Based on the forward collision path and the reverse collision path, a collision simulation path is generated.
[0240] In an optional implementation, the motion parameters further include: a preset speed threshold and a speed control coefficient; after generating a collision simulation path for the virtual moving object based on the starting point, multiple intersection points, and stopping points, the method further includes:
[0241] In response to a collision-triggered event for a virtual moving object, set the virtual moving object at the starting point;
[0242] The current speed of the virtual moving object is determined based on the target distance of the collision simulation path, the preset speed threshold, and the speed control coefficient.
[0243] The target movement position of the virtual moving object is determined based on the incremental time of the current frame and the current speed.
[0244] Update the position of the virtual moving object in the current frame based on the target's movement position until the virtual moving object moves to the stopping point.
[0245] In an optional implementation, updating the position of the virtual moving object in the current frame based on the target's movement position includes:
[0246] If the target's movement position is on the path segment between the starting point and the first target point, then the virtual moving object will be moved to the target's movement position in the current frame. The first target point is the point following the starting point among multiple intersection points and stopping points.
[0247] In an optional implementation, updating the position of the virtual moving object in the current frame based on the target's movement position includes:
[0248] If the target's location is not on the path segment, then the second target point is determined from multiple intersection points, and the second target point is the next point after the first target point;
[0249] Move the virtual moving object to the second target point in the current frame.
[0250] In an optional implementation, the motion parameters further include: multiple motion speeds and accelerations corresponding to each motion speed; determining the target movement position of the virtual moving object based on the incremental time of the current frame and the current speed, including:
[0251] If the current speed does not exceed the preset speed threshold, the target's movement position is determined based on the incremental time of the current frame and the preset speed threshold.
[0252] If the current speed exceeds the preset speed threshold, the current speed is re-determined based on the acceleration corresponding to the current speed, the current speed, and the incremental time. The target's moving position is then determined based on the incremental time and the re-determined current speed.
[0253] In this embodiment, the processor executes machine-readable instructions to acquire the attribute parameters of the virtual moving object, the attribute parameters of the arc-shaped collision region, and the motion parameters of the virtual moving object. The attribute parameters of the virtual moving object include its starting point. The attribute parameters of the arc-shaped collision region include a reference point within the arc-shaped collision region. The motion parameters include the target collision count and a stopping point within the arc-shaped collision region. Based on the starting point, reference point, target collision count, and stopping point, a collision simulation is performed on the virtual moving object within the arc-shaped collision region to obtain multiple intersection points between the virtual moving object and the arc-shaped edge of the arc-shaped collision region. Based on the starting point, multiple intersection points, and stopping point, a collision simulation path for the virtual moving object is generated. Thus, given a determined stopping point, the process of physical collision simulation in an arc-shaped planar region is simulated, resulting in a more realistic experience.
[0254] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the following steps:
[0255] Obtain the attribute parameters of the virtual moving object, the attribute parameters of the arc-shaped collision region, and the motion parameters of the virtual moving object; the attribute parameters of the virtual moving object include: the starting point of the virtual moving object, the attribute parameters of the arc-shaped collision region include: the reference point within the arc-shaped collision region, and the motion parameters include: the number of target collisions and the stopping point within the arc-shaped collision region;
[0256] Based on the starting point, reference point, number of target collisions, and stopping point, a collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple intersection points between the virtual moving object and the arc-shaped edge of the arc-shaped collision area.
[0257] Based on the starting point, multiple intersection points, and the stopping point, a collision simulation path for the virtual moving object is generated to control the virtual moving object's movement from the starting point to the stopping point.
[0258] In an optional implementation, the target collision count includes: a first collision count and a second collision count;
[0259] Based on the starting point, reference point, target collision count, and stopping point, a collision simulation is performed on the virtual moving object within the arc-shaped collision region, resulting in multiple intersection points between the virtual moving object and the arc-shaped edge of the collision region, including:
[0260] Based on the starting point, reference point, and the first collision count, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple forward intersection points between the virtual moving object and the arc-shaped edge.
[0261] Based on the stopping point, reference point, and the second collision count, a reverse collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple reverse intersection points between the virtual moving object and the arc-shaped edge; the multiple intersection points include multiple forward intersection points and multiple reverse intersection points.
[0262] In an optional implementation, the attribute parameters of the virtual moving object further include: a first size of the virtual moving object, a first incident angle, and a second incident angle; the attribute parameters of the arc-shaped collision region further include: a second size of the arc-shaped collision region; wherein, the first incident angle is the angle between a first incident ray and a preset horizontal line when the virtual moving object is shot from the starting point into the arc-shaped collision region, and the second incident angle is the angle between a second incident ray and a preset horizontal line when the virtual moving object is shot from the stopping point into the arc-shaped collision region;
[0263] Based on the starting point, reference point, and the first collision count, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision region, resulting in multiple forward intersection points between the virtual moving object and the arc-shaped edge, including:
[0264] Based on the starting point, reference point, first collision count, first size, second size, and first incident angle, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple forward intersection points;
[0265] Based on the stopping point, reference point, and the second collision count, a reverse collision simulation is performed on the virtual moving object within the arc-shaped collision region, resulting in multiple reverse intersection points between the virtual moving object and the arc-shaped edge, including:
[0266] Based on the stopping point, reference point, second collision count, first size, second size, and second incident angle, reverse collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple reverse intersection points.
[0267] In an optional implementation, based on the starting point, reference point, first collision count, first size, second size, and first incident angle, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision region to obtain multiple forward intersection points, including:
[0268] Based on the starting point, reference point, second dimension, and first incident angle, a forward collision simulation is performed on the virtual moving object to obtain the first forward intersection point between the virtual moving object and the arc edge.
[0269] Based on the first positive intersection point, the starting point, and the reference point, determine the reflection angle of the first returning ray corresponding to the first incident ray;
[0270] Based on the first positive intersection point, the reflection angle of the first return ray, the reference point, the first dimension, and the second dimension, a positive collision simulation is performed on the virtual moving object to obtain the second positive intersection point between the virtual moving object and the arc edge. This process continues until the number of positive collision simulations reaches the first number of collisions, and all positive intersection points obtained when the first number of collisions is reached are taken as multiple positive intersection points.
[0271] In an optional implementation, based on the stopping point, reference point, second collision count, first size, second size, and second incident angle, a reverse collision simulation is performed on the virtual moving object within the arc-shaped collision region to obtain multiple reverse intersection points, including:
[0272] Based on the stopping point, reference point, first dimension, second dimension, and second incident angle, a reverse collision simulation is performed on the virtual moving object to obtain the first reverse intersection point between the virtual moving object and the arc edge;
[0273] Based on the first reverse intersection point, the stopping point, and the reference point, determine the reflection angle of the second return ray corresponding to the second incident ray;
[0274] Based on the first reverse intersection point, the reflection angle of the second return ray, the reference point, the first dimension, and the second dimension, a reverse collision simulation is performed on the virtual moving object to obtain the second reverse intersection point between the virtual moving object and the arc edge. This process continues until the number of reverse collision simulations reaches the second collision count, and all reverse intersection points obtained when the second collision count is reached are taken as multiple reverse intersection points.
[0275] In an optional implementation, a collision simulation path for the virtual moving object is generated based on the starting point, multiple intersection points, and the stopping point, including:
[0276] Generate a forward collision path for the virtual moving object based on the starting point and multiple forward intersection points;
[0277] Based on the stopping point and multiple reverse intersection points, generate the reverse collision path of the virtual moving object;
[0278] Based on the forward and reverse collision paths, a collision simulation path is generated.
[0279] In an optional implementation, a collision simulation path is generated based on the forward collision path and the reverse collision path, including:
[0280] Reverse the order of the stopping point and multiple reverse intersection points in the reverse collision path to generate a reverse collision path;
[0281] Based on the forward collision path and the reverse collision path, a collision simulation path is generated.
[0282] In an optional implementation, the motion parameters further include: a preset speed threshold and a speed control coefficient; after generating a collision simulation path for the virtual moving object based on the starting point, multiple intersection points, and stopping points, the method further includes:
[0283] In response to a collision-triggered event for a virtual moving object, set the virtual moving object at the starting point;
[0284] The current speed of the virtual moving object is determined based on the target distance of the collision simulation path, the preset speed threshold, and the speed control coefficient.
[0285] The target movement position of the virtual moving object is determined based on the incremental time of the current frame and the current speed.
[0286] Update the position of the virtual moving object in the current frame based on the target's movement position until the virtual moving object moves to the stopping point.
[0287] In an optional implementation, updating the position of the virtual moving object in the current frame based on the target's movement position includes:
[0288] If the target's movement position is on the path segment between the starting point and the first target point, then the virtual moving object will be moved to the target's movement position in the current frame. The first target point is the point following the starting point among multiple intersection points and stopping points.
[0289] In an optional implementation, updating the position of the virtual moving object in the current frame based on the target's movement position includes:
[0290] If the target's location is not on the path segment, then the second target point is determined from multiple intersection points, and the second target point is the next point after the first target point;
[0291] Move the virtual moving object to the second target point in the current frame.
[0292] In an optional implementation, the motion parameters further include: multiple motion speeds and accelerations corresponding to each motion speed; determining the target movement position of the virtual moving object based on the incremental time of the current frame and the current speed, including:
[0293] If the current speed does not exceed the preset speed threshold, the target's movement position is determined based on the incremental time of the current frame and the preset speed threshold.
[0294] If the current speed exceeds the preset speed threshold, the current speed is re-determined based on the acceleration corresponding to the current speed, the current speed, and the incremental time. The target's moving position is then determined based on the incremental time and the re-determined current speed.
[0295] In this embodiment, the computer program, executed by the processor, acquires the attribute parameters of the virtual moving object, the attribute parameters of the arc-shaped collision region, and the motion parameters of the virtual moving object. The attribute parameters of the virtual moving object include its starting point. The attribute parameters of the arc-shaped collision region include a reference point within the arc-shaped collision region. The motion parameters include the target collision count and a stopping point within the arc-shaped collision region. Based on the starting point, reference point, target collision count, and stopping point, a collision simulation is performed on the virtual moving object within the arc-shaped collision region, obtaining multiple intersection points between the virtual moving object and the arc-shaped edge of the arc-shaped collision region. Based on the starting point, multiple intersection points, and stopping point, a collision simulation path for the virtual moving object is generated. Thus, given a determined stopping point, the process of physical collision simulation in an arc-shaped planar region is simulated, resulting in a more realistic experience.
[0296] In this embodiment, the computer program, when run by the processor, can also execute other machine-readable instructions to perform other methods as described in the embodiments. For details on the specific execution steps and principles, please refer to the description of the embodiments, which will not be repeated here.
[0297] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0298] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0299] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0300] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0301] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0302] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A collision simulation method for virtual moving objects, characterized in that, include: Obtain the attribute parameters of the virtual motion object, the attribute parameters of the arc-shaped collision region, and the motion parameters of the virtual motion object; The attribute parameters of the virtual motion object include: the starting point of the virtual motion object; the attribute parameters of the arc-shaped collision region include: the reference point within the arc-shaped collision region; and the motion parameters include: the number of target collisions and the stopping point within the arc-shaped collision region. Based on the starting point, the reference point, the number of target collisions, and the stopping point, a collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple intersection points between the virtual moving object and the arc-shaped edge of the arc-shaped collision area. Based on the starting point, the plurality of intersection points, and the stopping point, a collision simulation path for the virtual moving object is generated to control the virtual moving object to move from the starting point to the stopping point; The target collision count includes: the first collision count and the second collision count; The method involves simulating collisions between the virtual moving object and the arc-shaped collision region based on the starting point, the reference point, the target collision count, and the stopping point, to obtain multiple intersection points between the virtual moving object and the arc-shaped edge of the arc-shaped collision region, including: Based on the starting point, the reference point, and the first number of collisions, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple forward intersection points between the virtual moving object and the arc-shaped edge; Based on the stopping point, the reference point, and the second number of collisions, a reverse collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple reverse intersection points between the virtual moving object and the arc-shaped edge; the multiple intersection points include: the multiple forward intersection points and the multiple reverse intersection points.
2. The method according to claim 1, characterized in that, The attribute parameters of the virtual motion object further include: the first size, the first incident angle, and the second incident angle of the virtual motion object; the attribute parameters of the arc-shaped collision region further include: the second size of the arc-shaped collision region; wherein, the first incident angle is the angle between the first incident ray and the preset horizontal line when the virtual motion object is shot from the starting point into the arc-shaped collision region; the second incident angle is the angle between the second incident ray and the preset horizontal line when the virtual motion object is shot from the stopping point into the arc-shaped collision region. The step involves simulating a forward collision of the virtual moving object within the arc-shaped collision area based on the starting point, the reference point, and the first number of collisions, to obtain multiple forward intersection points between the virtual moving object and the arc-shaped edge, including: Based on the starting point, the reference point, the first number of collisions, the first size, the second size, and the first incident angle, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain the plurality of forward intersection points; The step involves performing a reverse collision simulation on the virtual moving object within the arc-shaped collision area based on the stopping point, the reference point, and the second number of collisions, to obtain multiple reverse intersection points between the virtual moving object and the arc-shaped edge, including: Based on the stopping point, the reference point, the second number of collisions, the first size, the second size, and the second incident angle, a reverse collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain the multiple reverse intersection points.
3. The method according to claim 2, characterized in that, The virtual moving object is simulated for forward collision within the arc-shaped collision area based on the starting point, the reference point, the first number of collisions, the first size, the second size, and the first incident angle to obtain the plurality of forward intersection points, including: Based on the starting point, the reference point, the second dimension, and the first incident angle, a forward collision simulation is performed on the virtual moving object to obtain the first forward intersection point between the virtual moving object and the arc edge. Based on the first positive intersection point, the starting point, and the reference point, determine the reflection angle of the first returning ray corresponding to the first incident ray; Based on the first positive intersection point, the reflection angle of the first return ray, the reference point, the first size, and the second size, a positive collision simulation is performed on the virtual moving object to obtain a second positive intersection point between the virtual moving object and the arc edge. This process continues until the number of positive collision simulations reaches the first number of collisions, and all positive intersection points obtained when the first number of collisions is reached are taken as the plurality of positive intersection points.
4. The method according to claim 2, characterized in that, The method involves performing a reverse collision simulation on the virtual moving object within the arc-shaped collision area based on the stopping point, the reference point, the second number of collisions, the first size, the second size, and the second incident angle, to obtain the plurality of reverse intersection points, including: Based on the stopping point, the reference point, the first dimension, the second dimension, and the second incident angle, a reverse collision simulation is performed on the virtual moving object to obtain the first reverse intersection point between the virtual moving object and the arc edge; Based on the first reverse intersection point, the stopping point, and the reference point, determine the reflection angle of the second return ray corresponding to the second incident ray; Based on the first reverse intersection point, the reflection angle of the second return ray, the reference point, the first dimension, and the second dimension, a reverse collision simulation is performed on the virtual moving object to obtain the second reverse intersection point between the virtual moving object and the arc edge. This process continues until the number of reverse collision simulations reaches the second collision count, and all reverse intersection points obtained when the second collision count is reached are taken as the plurality of reverse intersection points.
5. The method according to claim 1, characterized in that, The step of generating a collision simulation path for the virtual moving object based on the starting point, the plurality of intersection points, and the stopping point includes: Based on the starting point and the plurality of positive intersection points, a positive collision path for the virtual moving object is generated; Based on the stopping point and the plurality of reverse intersection points, a reverse collision path for the virtual moving object is generated; The collision simulation path is generated based on the forward collision path and the reverse collision path.
6. The method according to claim 5, characterized in that, The step of generating the collision simulation path based on the forward collision path and the reverse collision path includes: The stopping point and the plurality of reverse intersection points in the reverse collision path are reversed in sequence to generate a reverse collision path; The collision simulation path is generated based on the forward collision path and the reverse collision path.
7. The method according to claim 1, characterized in that, The motion parameters further include: a preset speed threshold and a speed control coefficient; after generating the collision simulation path of the virtual moving object based on the starting point, the multiple intersection points, and the stopping point, the method further includes: In response to a collision motion trigger event for the virtual motion object, the virtual motion object is set at the starting point; The current speed of the virtual moving object is determined based on the target distance of the collision simulation path, the preset speed threshold, and the speed control coefficient. The target movement position of the virtual moving object is determined based on the incremental time of the current frame and the current speed. Based on the target movement position, update the position of the virtual moving object in the current frame until the virtual moving object moves to the stopping point.
8. The method according to claim 7, characterized in that, The step of updating the position of the virtual moving object in the current frame based on the target movement position includes: If the target movement position is on the path segment between the starting point and the first target point, then in the current frame, the virtual moving object is moved to the target movement position, where the first target point is the point following the starting point among the plurality of intersection points and stopping points.
9. The method according to claim 8, characterized in that, The step of updating the position of the virtual moving object in the current frame based on the target movement position includes: If the target's movement position is not on the path segment, then a second target point is determined from the plurality of intersection points, and the second target point is the next point after the first target point; In the current frame, the virtual moving object is moved to the second target point.
10. The method according to claim 7, characterized in that, The motion parameters further include: multiple motion speeds and accelerations corresponding to each motion speed; determining the target movement position of the virtual moving object based on the incremental time of the current frame and the current speed includes: If the current speed does not exceed the preset speed threshold, the target movement position is determined based on the incremental time of the current frame and the preset speed threshold. If the current speed exceeds the preset speed threshold, the current speed is re-determined based on the acceleration corresponding to the current speed, the current speed, and the incremental time, and the target movement position is determined based on the incremental time and the re-determined current speed.
11. A collision simulation device for a virtual moving object, characterized in that, include: The acquisition module is used to acquire the attribute parameters of the virtual motion object, the attribute parameters of the arc-shaped collision region, and the motion parameters of the virtual motion object. The attribute parameters of the virtual motion object include: the starting point of the virtual motion object; the attribute parameters of the arc-shaped collision region include: the reference point within the arc-shaped collision region; and the motion parameters include: the number of target collisions and the stopping point within the arc-shaped collision region. The processing module is used to perform collision simulation on the virtual moving object within the arc-shaped collision area based on the starting point, the reference point, the number of target collisions, and the stopping point, to obtain multiple intersection points between the virtual moving object and the arc-shaped edge of the arc-shaped collision area; The generation module is used to generate a collision simulation path for the virtual moving object based on the starting point, the multiple intersection points, and the stopping point, so as to control the virtual moving object to move from the starting point to the stopping point; The target collision count includes: the first collision count and the second collision count; The processing module is specifically used for: Based on the starting point, the reference point, and the first number of collisions, a forward collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple forward intersection points between the virtual moving object and the arc-shaped edge; Based on the stopping point, the reference point, and the second number of collisions, a reverse collision simulation is performed on the virtual moving object within the arc-shaped collision area to obtain multiple reverse intersection points between the virtual moving object and the arc-shaped edge; the multiple intersection points include: the multiple forward intersection points and the multiple reverse intersection points.
12. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is in operation, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Trajectory prompting method and device, storage medium and electronic device
CN111249719A