Track model generation method, device, electronic device and readable medium

By generating the track section model based on preset track parameters and fusing coordinates, the problems of low track generation efficiency and unsmooth connection are solved, and a track with customized shapes is quickly generated.

CN114241139BActive Publication Date: 2025-08-19NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111645470.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-08-19
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

The existing track generation methods are inefficient in racing and parkour games, making it difficult to quickly generate tracks of custom shapes, and there are prone to deviations and non-smooth transitions at the track connections.

Method used

Based on the preset track parameters, a track section model adjacent to the previous track section model is generated, and the coordinates of the current track section model and the previous track section model are obtained and integrated to achieve rapid splicing and smooth transition of the track.

Benefits of technology

It realizes rapid generation and smooth transition of track models, improves track generation efficiency, and ensures smooth connections throughout the track.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114241139B_ABST
    Figure CN114241139B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention provide a method, device, electronic device, and readable medium for generating a track model. The method includes: generating a track segment model adjacent to a previous track segment model based on preset track parameters; obtaining a first coordinate of the current track segment model and a second coordinate of the previous track segment model; and fusing the current track segment model with the previous track segment model based on the first and second coordinates to obtain a continuous track model. This method enables the formation of a custom track shape by splicing multiple track segment models. The method is quick to generate, with smooth transitions throughout the track model, resulting in a superior track model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of game technology, and in particular to a method for generating a track model, a device for generating a track model, an electronic device, and a computer-readable medium. Background Art

[0002] In existing racing and parkour games, players can typically manipulate objects such as cars and virtual characters to move around a track. Generally speaking, tracks can be generated using a variety of methods, including curve-based generation and pre-set model generation. For curve-based track generation, since it is often necessary to manually drag points on the curve to adjust parameters such as the curvature, slope, and gradient of the track, errors can easily occur during the adjustment process, resulting in a long time spent going back and forth to adjust the track. For pre-set model-based track generation, since a track typically has multiple different types of sections, such as curves with varying bend angles and straights with varying inclinations, a large number of models would need to be pre-made if different types of sections were to be pre-assembled and then spliced together, resulting in low track production efficiency. Summary of the Invention

[0003] The embodiments of the present invention provide a method, device, electronic device, and computer-readable storage medium for generating a racetrack model to solve the problem of high difficulty in racetrack generation.

[0004] An embodiment of the present invention discloses a method for generating a track model, comprising:

[0005] Based on the preset track parameters, a track section model adjacent to the previous track section model is generated;

[0006] Obtaining a first coordinate of the current race track section model and a second coordinate of the previous race track section model;

[0007] Based on the first coordinate and the second coordinate, the current race track section model and the previous race track section model are fused to obtain a continuous track model.

[0008] Optionally, the step of generating a race track section model adjacent to the previous race track section model based on preset race track parameters includes:

[0009] Taking the end point of the previous track section model as the starting point of the current track section model;

[0010] Based on the preset track parameters, determining the second coordinates of each vertex in the current track section model from the starting point to the end point in sequence;

[0011] The current race track segment model is generated based on the coordinates of each vertex in the current race track segment model.

[0012] Optionally, the track parameters include a turning angle and a turning radius;

[0013] The step of determining the second coordinate of each vertex in the current track section model from the starting point to the end point based on the preset track parameters includes:

[0014] For a current vertex, determining a direction angle of the current vertex relative to the center of the current race track segment model based on the turning angle and the curve radius;

[0015] The second coordinate of the current vertex is determined based on the coordinates of the center of the current race track section model, the direction angle of the current vertex, and the curve radius.

[0016] Optionally, the step of fusing the current race track section model with the previous race track section model based on the first coordinate and the second coordinate to obtain a continuous track model includes:

[0017] When the current race track segment model and the previous race track segment model are in the same plane, determining a coordinate difference between a first coordinate of an end point of the previous race track segment model and a second coordinate of a starting point of the current race track segment model;

[0018] Determining, according to the position of the vertex in the current race track segment model, a fusion weight corresponding to the vertex in the current race track segment model;

[0019] The fusion weights and the coordinate differences are used to adjust the coordinates of the vertices in the current race track segment model to fuse the current race track segment model with the previous race track segment model to obtain a continuous race track model.

[0020] Optionally, the step of fusing the current race track section model with the previous race track section model based on the first coordinate and the second coordinate to obtain a continuous track model includes:

[0021] If the current track segment model and the previous track segment model are not in the same plane, the first coordinates and the second coordinates of the starting point of the previous track segment model and the ending point of the current track segment model are adjusted to approximate the differences between the coordinates of adjacent vertices while maintaining the first coordinates of the starting point of the previous track segment model and the second coordinates of the ending point of the current track segment model unchanged.

[0022] Optionally, the method further includes:

[0023] Get the scaling parameters;

[0024] The scaling parameter is used to adjust the race track segment model to adjust the width of the race track segment.

[0025] Optionally, the method further includes:

[0026] Based on the coordinates of the left and right vertices in the track model, air wall models are generated on the left and right sides of the track model.

[0027] An embodiment of the present invention further provides a device for generating a track model, comprising:

[0028] A model generation module, configured to generate a track section model adjacent to a previous track section model based on preset track parameters;

[0029] A coordinate acquisition module, configured to acquire a first coordinate of the current race track section model and a second coordinate of the previous race track section model;

[0030] A fusion module is configured to fuse the current race track section model with the previous race track section model based on the first coordinate and the second coordinate to obtain a continuous race track model.

[0031] Optionally, the model generation module includes:

[0032] A starting point setting submodule, configured to set the end point of the previous track section model as the starting point of the current track section model;

[0033] A second coordinate determination submodule, configured to determine the second coordinate of each vertex in the current track section model from the starting point to the end point based on preset track parameters;

[0034] The model generation submodule is configured to generate the current race track segment model based on the coordinates of each vertex in the current race track segment model.

[0035] Optionally, the track parameters include a turning angle and a turning radius;

[0036] The second coordinate determination submodule includes:

[0037] a direction angle determination unit, configured to determine, for a current vertex, a direction angle of the current vertex relative to a circle center model generation module of the current race track section model based on the turning angle and the curve radius;

[0038] The second coordinate determining unit is configured to determine the second coordinate of the current vertex based on the coordinates of the center of the current race track section model, the direction angle of the current vertex, and the curve radius.

[0039] Optionally, the fusion module includes:

[0040] a difference calculation submodule, configured to determine, when the current race track segment model and the previous race track segment model are in the same plane, a coordinate difference between a first coordinate of an end point of the previous race track segment model and a second coordinate of a starting point of the current race track segment model;

[0041] a weight determination submodule, configured to determine, based on positions of the vertices in the current race track segment model, fusion weights corresponding to the vertices in the current race track segment model;

[0042] The fusion submodule is configured to adjust the coordinates of vertices in the current track segment model by using the fusion weights and the coordinate differences, so as to fuse the current track segment model with the previous track segment model to obtain a continuous track model.

[0043] Optionally, the fusion module includes:

[0044] a smoothing submodule configured to adjust the first coordinate and the second coordinate of the starting point of the previous track segment model and the ending point of the current track segment model so as to approximate the differences between the coordinates of adjacent vertices when the current track segment model and the previous track segment model are not in the same plane, while maintaining the first coordinate of the starting point of the previous track segment model and the second coordinate of the ending point of the current track segment model unchanged.

[0045] Optionally, the device further comprises:

[0046] A scaling parameter acquisition module is used to obtain scaling parameters;

[0047] A width adjustment module is configured to adjust the race track section model using the scaling parameter to adjust the width of the race track section.

[0048] Optionally, the device further comprises:

[0049] The air wall generation module is used to generate air wall models on the left and right sides of the track model based on the coordinates of the left and right vertices in the track model.

[0050] An embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0051] The memory is used to store computer programs;

[0052] The processor is configured to implement the method described in the embodiment of the present invention when executing the program stored in the memory.

[0053] The embodiments of the present invention further disclose one or more computer-readable media having instructions stored thereon. When executed by one or more processors, the processors are enabled to perform the method according to the embodiments of the present invention.

[0054] The embodiments of the present invention include the following advantages:

[0055] The track model generation method of the embodiment of the present invention generates a track segment model adjacent to a previous track segment model based on preset track parameters, enabling a custom track shape to be formed by splicing multiple track segment models, and the generation is fast. The method also obtains the first coordinates of the current track segment model and the second coordinates of the previous track segment model. Based on the first and second coordinates, the current track segment model and the previous track segment model are fused to obtain a continuous track model. This allows for relatively smooth transitions throughout the track model, resulting in a better generation effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 is a flowchart of the steps of a method for generating a track model provided in an embodiment of the present invention;

[0057] Figure 2 is a schematic diagram of a race track section model provided in an embodiment of the present invention;

[0058] Figure 3 is a schematic diagram of a race track section model provided in an embodiment of the present invention;

[0059] Figure 4 is a schematic diagram of a race track section model provided in an embodiment of the present invention;

[0060] Figure 5 is a flowchart of the steps of a method for generating a track model provided in an embodiment of the present invention;

[0061] Figure 6 is a schematic diagram of a race track section model provided in an embodiment of the present invention;

[0062] Figure 7 is a schematic diagram of a race track section model provided in an embodiment of the present invention;

[0063] Figure 8 This is a structural block diagram of a device for generating a track model provided in an embodiment of the present invention;

[0064] Figure 9 is a block diagram of an electronic device provided in an embodiment of the present invention;

[0065] Figure 10 is a schematic diagram of a computer-readable medium provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0066] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0067] This embodiment of the present invention achieves efficient track generation by generating track segment models in a modular format based on track parameters. Furthermore, to address the issue of smooth transitions between modular track segment models, the current track segment model and the previous track segment model are fused based on the first coordinate of the current track segment model and the second coordinate of the previous track segment model. This allows for a smooth transition between the two models, resulting in a continuous track model.

[0068] Reference Figure 1 , shows a flowchart of a method for generating a track model provided in an embodiment of the present invention, which may specifically include the following steps:

[0069] Step 101: generating a track section model adjacent to a previous track section model based on preset track parameters;

[0070] Specifically, to improve the efficiency of track model generation, different types of track segment models can be sequentially generated using a modular format. Furthermore, to avoid pre-setting a large number of different types of track segment models, embodiments of the present invention can generate track segment models based on preset track parameters. Track parameters can include turning angles, turning radius, track width, track length, bank angle, and the like, though this invention does not impose any limitations on these parameters.

[0071] Based on the track parameters, a variety of different track models can be generated. Setting the current track segment model adjacent to the previous track segment model can achieve a custom track shape by splicing multiple track segment models, and the generation is fast.

[0072] As an example of the present invention, Figure 2 FIG2 is a schematic diagram of a race track segment model according to an embodiment of the present invention. Based on various parameters such as track width, track length, track slope, and bank angle, a race track segment model 201, a race track segment model 202 adjacent to race track segment model 201, and a race track segment model 203 adjacent to race track segment model 202 can be sequentially generated.

[0073] Step 102, obtaining the first coordinates of the current race track section model and the second coordinates of the previous race track section model;

[0074] After setting the current track segment model to be adjacent to the previous track segment model, the adjacent track segment models may not be well connected due to different track parameters. Figure 3 As shown in the schematic diagram of the race track segment model, adjacent race track segment models may be adjacent to each other but cannot be well connected due to different track widths and different inclination angles.

[0075] In this case, in order to better connect the tracks, the first coordinates of the current track segment model and the second coordinates of the previous track segment model may be obtained so as to further fuse the track segment models.

[0076] Step 103 : Based on the first coordinates and the second coordinates, the current race track section model and the previous race track section model are integrated to obtain a continuous track model.

[0077] After obtaining the first coordinate and the second coordinate, the current race section model and the previous race section model can be fused based on the first coordinate and the second coordinate, so that the current race section model and the previous race section model can be well connected to obtain a continuous track model, thereby achieving efficient generation of the track model. Moreover, after the generated track model is fused, all parts of the track can have a relatively smooth transition, and the generation effect is better.

[0078] In a specific implementation, the first coordinate of the previous track segment model can be kept unchanged, and the first coordinate can be used as a reference to adjust the second coordinate of the current track segment model so that the starting point of the current track segment model completely coincides with the end point of the previous track segment model, and the transition is smooth, thereby completing the fusion between the current track segment model and the previous track segment model.

[0079] Alternatively, the starting point of the previous track segment model and the end point of the current track segment model may be kept unchanged, and the previous track segment model and the current track segment model may be treated as a whole. The first coordinate of the previous track segment model and the second coordinate of the current track segment model may be adjusted simultaneously, so that the previous track segment model and the current track segment model have a smooth transition as a whole, thereby completing the fusion between the current track segment model and the previous track segment model.

[0080] As a specific example of the present invention, Figure 3As shown in the schematic diagram of the track segment model, adjacent track segment models may not be able to be merged due to different track widths and different inclination angles. In this case, the first coordinate of the previous track segment model 301 can be kept unchanged, and the first coordinate can be used as a reference to adjust the second coordinate of the current track segment model 302 so that the starting point of the current track segment model 302 completely coincides with the end point of the previous track segment model 301, and the transition is smooth, thereby completing the fusion of the current track segment model 302 and the previous track segment model 301. The fused track segment model is as follows: Figure 4 shown.

[0081] The track model generation method of the embodiment of the present invention generates a track segment model adjacent to a previous track segment model based on preset track parameters, enabling a custom track shape to be formed by splicing multiple track segment models, and the generation is fast. The method also obtains the first coordinates of the current track segment model and the second coordinates of the previous track segment model. Based on the first and second coordinates, the current track segment model and the previous track segment model are fused to obtain a continuous track model. This allows for relatively smooth transitions throughout the track model, resulting in a better generation effect.

[0082] Reference Figure 5 , shows a flowchart of a method for generating a track model provided in an embodiment of the present invention, which may specifically include the following steps:

[0083] Step 501: Using the end point of the previous track segment model as the starting point of the current track segment model;

[0084] To improve track model generation efficiency, different types of track segment models can be generated sequentially using modules. Furthermore, to ensure continuous track model generation, after a track segment model is generated, its endpoint can be used as the starting point for the current track segment model, allowing for subsequent generation of adjacent track segment models.

[0085] In a specific implementation, since a track typically has a certain width, a track segment model may include three curves located on the left, right, and center of the track. Since the positions of the curves on the left and right sides of the track are related to the track segment model's inclination angle, track width, and other factors, to make the current track segment model adjacent to the previous track segment model, the end point of the middle curve of the previous track segment model may be used as the starting point of the middle curve of the current track segment model, thereby placing the previous track segment model and the current track segment model adjacent.

[0086] As a specific example of the present invention, Figure 6 The figure is a schematic diagram of a racetrack section model according to an embodiment of the present invention. The racetrack section model may include curve 601 on the left side of the track, curve 602 in the middle of the track, and curve 603 on the right side of the track. To increase the track distance, the distance between curves 601 and 602 can be increased, and the distance between curve 603 and curve 602 can be increased. To tilt the track, the heights of curves 601 and 603 can be adjusted so that curves 601 and 602 are not on the same horizontal plane, and curves 603 and 602 are not on the same horizontal plane, thereby creating a tilt in the track.

[0087] Step 502, based on preset track parameters, sequentially determine the second coordinates of each vertex in the current track segment model from the starting point to the end point;

[0088] Specifically, to avoid pre-setting a large number of different types of track segment models, embodiments of the present invention can generate track segment models based on preset track parameters. Track parameters may include turning angles, turning radius, track width, track length, bank angle, etc., which are not limited by the present invention.

[0089] Therefore, after determining the starting point of the current race track segment model, the second coordinates of each vertex in the current race track segment model can be determined sequentially from the starting point to the end point based on the preset track parameters, thereby determining the coordinates of the current race track segment model in the three-dimensional scene.

[0090] In a specific implementation, the position change of the second coordinates between adjacent vertices can be determined based on the track parameters, and then the second coordinate of the current vertex can be determined based on the second coordinate of the last determined vertex and the position change information, thereby realizing the sequential determination of the second coordinate of the current track section model.

[0091] In one embodiment of the present invention, the track parameters include a turning angle and a turning radius;

[0092] The step of determining the second coordinate of each vertex in the current track section model from the starting point to the end point based on the preset track parameters includes:

[0093] S11, for a current vertex, determining a direction angle of the current vertex relative to the center of the current race track segment model based on the turning angle and the curve radius;

[0094] Specifically, if the track segment model is a curve, the track parameters may include a turning angle and a curve radius. Thus, the current track segment model may have a corresponding center. Using the center as the origin, the direction angle of a current vertex relative to the current track segment model may be determined.

[0095] In a specific implementation, the single-point rotation angle of each vertex relative to the adjacent vertex can be determined based on the turn angle and the number of vertices in the preset track segment model. For example, if the turn angle is 90 degrees and there are 10 vertices, the single-point rotation angle of each vertex relative to the adjacent vertex is 10 degrees.

[0096] Subsequently, based on the position of the track segment model and the single-point rotation angle, the quadrant of each vertex in the plane coordinate system obtained by projecting the center of the circle onto the ground of the three-dimensional scene can be determined, and the direction angle of the current vertex relative to the center of the current track segment model can be further determined.

[0097] In the specific implementation, the azimuth angle endFop of the current vertex can be calculated as follows:

[0098] endFop=180-(rowVersCount-1)×singleAngle (1)

[0099] endFop=(rowVersCount-1)×singleAngle (2)

[0100] Where rowVersCount is the sequence number of the current vertex starting from the starting point, and singleAngle is the single-point rotation angle. If the current vertex is in the second or third quadrant, the direction angle can be calculated using formula (1). If the current vertex is in the first or fourth quadrant, the direction angle can be calculated using formula (2).

[0101] As a specific example of the present invention, Figure 7Schematic diagram of a race track section model according to an embodiment of the present invention. Point 701 may be the center of the curve-shaped race track section model. Eight vertices may be provided on the middle curve of the race track section model. At the same time, the turning angle of the race track section model is 180 degrees, so that the single-point rotation angle of each vertex relative to the adjacent vertex is 25.71 degrees. On the middle curve, vertex 702 may be used as the starting point, and the vertices may be arranged in sequence from right to left. For vertex 702, its serial number is 1, and it is in the first quadrant relative to the center 701. The azimuth angle of vertex 702 is (1-1)×25.714=0°. For vertex 703, its serial number is 2, and it is in the first quadrant relative to the center 701. The azimuth angle of vertex 703 is (2-1)×25.71=25.714°. Vertex 704, which is numbered 3 and is located in the first quadrant relative to center 701, has an azimuth of (3-1) × 25.714 = 51.428°. Vertex 705, which is numbered 7 and is located in the second quadrant relative to center 701, has an azimuth of 180-(7-1) × 25.714 = 25.714°. Vertex 706, which is numbered 8 and is located in the second quadrant relative to center 701, has an azimuth of 180-(8-1) × 25.714 = 0°.

[0102] S12: Determine the second coordinates of the current vertex based on the coordinates of the center of the current race track section model, the direction angle of the current vertex, and the curve radius.

[0103] After determining the direction angle of each vertex, the second coordinate of the current vertex may be further determined based on the coordinates of the center of the current race track segment model, the direction angle of the current vertex, and the curve radius.

[0104] Specifically, the second coordinate (X A , Y A ) is calculated using the following formula:

[0105] X A =X O +L×Cos(Fop) (3)

[0106] Y A =Y O +L×Sin(Fop) (4)

[0107] Among them, Fop is the direction angle of each vertex relative to the center of the circle, X O is the horizontal coordinate of the center of the circle, Y Ois the ordinate of the circle's center. L is the length, calculated based on the track width and curve radius. Specifically, if the vertex is located on a curve near the center of the circle in the track segment model, the length L is the track width. If the vertex is located on a curve in the middle of the track segment model, the length L is the sum of the track width and 1 / 2 the curve radius. If the vertex is located on a curve away from the center of the circle in the track segment model, the length L is the sum of the track width and the curve radius.

[0108] As a specific example of the present invention, Figure 7 Schematic diagram of a track segment model according to an embodiment of the present invention. If the rotation radius is r and the track width is l, for vertex 702, its direction angle is 0 and it is located in the middle of the track segment model, then its coordinates are (X O +r+l / 2,Y O +r+l / 2). For vertex 707, its direction angle is 0 and it is located on the curve close to the circular side in the track segment model, so its coordinates are (X O +r,Y O +r).

[0109] Alternatively, for a straight-type track segment model, a straight-type track segment model can be directly generated based on a preset track length and width. The starting point of the straight-type track segment model is then aligned with the end point of the previously generated track segment model, thereby placing the straight-type track segment model adjacent to the previously generated track segment model.

[0110] Optionally, if the straight-type track segment model has a slope, the vertical offset of the end point of the straight-type track segment model can be calculated based on the input slope angle and track length using a trigonometric function, and the end point of the straight-type track segment model can be adjusted accordingly to tilt the entire straight-type track segment model by the slope angle.

[0111] Optionally, if the curve-type track segment model has a slope, after determining the plane coordinates of each vertex on the curve-type track segment model, the vertical offset of the vertex can be calculated based on the input slope angle and the track length between adjacent vertices using trigonometric functions, and the vertex can be adjusted accordingly to make the curve-type track segment model have a slope.

[0112] Optionally, if the track segment model is tilted toward the left or right side of the track, the vertical offset of the vertices on the left and right curves of the track segment model can be calculated based on trigonometric functions at the input tilt angle and half the track width. If the track segment model is tilted toward the left side of the track, the vertical offset of the vertex coordinates on the left curve can be offset downward by the offset amount, while the vertical offset of the vertex coordinates on the right curve can be offset upward by the offset amount. If the track segment model is tilted toward the right side of the track, the vertical offset of the vertex coordinates on the right curve can be offset downward by the offset amount, while the vertical offset of the vertex coordinates on the left curve can be offset upward by the offset amount, thereby tilting the track.

[0113] Step 503: Generate the current race track segment model based on the coordinates of each vertex in the current race track segment model.

[0114] After determining the coordinates of each vertex in the current track segment model, the position of each vertex in the current track segment model in the three-dimensional scene can be determined based on the coordinates of each vertex in the current track segment model, and further rendering can be performed to obtain the track segment model.

[0115] In one embodiment of the present invention, the method further comprises:

[0116] S21, obtaining scaling parameters;

[0117] Specifically, after the race track section model is generated, the width of the race track section model can be adjusted according to actual needs, so that the generation process of the race track section model can be more flexible.

[0118] Therefore, the width of the race track segment model can be adjusted by scaling. In order to determine how to scale the race track segment model, a scaling constant can be obtained.

[0119] S22: Use the scaling parameter to adjust the race track section model to adjust the width of the race track section.

[0120] After obtaining the scaling constant, the scaling parameter can be used to adjust the race track section model so that the race track section model is reduced or enlarged as a whole, thereby adjusting the width of the race track section model.

[0121] Specifically, when scaling a track segment model, the starting point of the track segment model can be used as the scaling base point, so that the starting point of the current track segment model can be kept as the end point of the previous track segment model, avoiding the situation where scaling the track segment model may cause the track segment models to be unable to merge.

[0122] Step 504: Obtain the first coordinates of the current race track section model and the second coordinates of the previous race track section model;

[0123] After setting the current track segment model to be adjacent to the previous track segment model, the adjacent track segment models may not be well connected due to different track parameters. Figure 2 The schematic diagram of the track section model shown is that adjacent track section models may not be connected due to different track widths and different inclination angles.

[0124] In this case, in order to better connect the tracks, the first coordinates of the current track segment model and the second coordinates of the previous track segment model may be obtained so as to further fuse the track segment models.

[0125] Step 505 : Based on the first coordinates and the second coordinates, the current race track section model and the previous race track section model are integrated to obtain a continuous track model.

[0126] After obtaining the first coordinate and the second coordinate, the current race section model and the previous race section model can be fused based on the first coordinate and the second coordinate, so that the current race section model and the previous race section model can be well connected to obtain a continuous track model, thereby achieving efficient generation of the track model. Moreover, after the generated track model is fused, all parts of the track can have a relatively smooth transition, and the generation effect is better.

[0127] In one embodiment of the present invention, the step of fusing the current race track segment model with the previous race track segment model based on the first coordinate and the second coordinate to obtain a continuous track model includes:

[0128] S31, when the current race track segment model and the previous race track segment model are in the same plane, determining the coordinate difference between the first coordinate of the end point of the previous race track segment model and the second coordinate of the starting point of the current race track segment model;

[0129] Specifically, if the current track segment model and the previous track segment model are on the same plane, the current track segment model may differ from the previous track segment model in track parameters such as turning angle and curve radius, resulting in a poor fusion between the previous track segment model and the current track segment model. Therefore, the coordinate difference between the first coordinate of the end point of the previous track segment model and the second coordinate of the starting point of the current track segment model can be determined to determine how to subsequently adjust the second coordinate of the current track segment model.

[0130] S32, determining a fusion weight corresponding to a vertex in the current race track segment model according to a position of the vertex in the current race track segment model;

[0131] Specifically, depending on the vertex's position in the current track segment model, each vertex can be influenced differently by the previous track segment model. For example, the starting point of the current track segment model is most influenced by the previous track segment model and should completely overlap with the end point of the previous track segment model. The end point of the current track segment model is least influenced by the previous track segment model and does not require adjustment based on the first coordinate of the previous track segment model. For other vertices, the closer they are to the end point of the previous track segment model, the greater the influence they receive from the previous track segment model. This allows the fusion weights corresponding to the vertices in the current track segment model to be determined.

[0132] S33: Using the fusion weight and the coordinate difference, adjust the coordinates of the vertices in the current race track segment model to fuse the current race track segment model with the previous race track segment model to obtain a continuous race track model.

[0133] After determining the fusion weight and the coordinate difference, the fusion weight and the coordinate difference can be used to determine the adjustment range of each vertex in the current track segment model, and the coordinates of the vertices in the current track segment model can be adjusted. This allows the second coordinates of the current track segment model to be updated based on the first coordinates of the previous track segment model, thereby achieving the fusion of the current track segment model and the previous track segment model to obtain a continuous track model.

[0134] In one embodiment of the present invention, the step of fusing the current race track segment model with the previous race track segment model based on the first coordinate and the second coordinate to obtain a continuous track model includes:

[0135] S41: When the current race track segment model and the previous race track segment model are not in the same plane, while maintaining the first coordinate of the starting point of the previous race track segment model and the second coordinate of the end point of the current race track segment model unchanged, adjust the first coordinate and the second coordinate so that the differences between adjacent vertex coordinates are close.

[0136] Specifically, if the current track segment model and the previous track segment model are not coplanar, the first coordinate of the current track segment model may differ significantly from the second coordinate of the previous track segment model. In this case, to ensure a smooth transition between the current and previous track segment models, it is necessary to adjust not only the second coordinate of the current track segment model but also the first coordinate of the previous track segment model. Furthermore, to prevent the previous track segment model from being integrated with other track segment models due to adjustments to the previous track segment model, the first coordinate of the starting point of the previous track segment model can be maintained unchanged, ensuring that the previous track segment model remains integrated with the other track segment models. Subsequently, since the end point of the current track segment model significantly influences the overall shape of the current track segment model, the second coordinate of the end point of the current track segment model can generally be maintained unchanged.

[0137] Afterwards, the current track segment model and the previous track segment model can be treated as a whole, and the first coordinate of the previous track segment model and the second coordinate of the current track segment model can be adjusted at the same time, so that the previous track segment model and the current track segment model have a smooth transition as a whole, thereby completing the fusion between the current track segment model and the previous track segment model.

[0138] In a specific implementation, the first coordinate of the previous race track section model and the second coordinate of the current race track section model may be adjusted by using an algorithm such as a Laplace smoothing algorithm or a difference smoothing algorithm to make the line transition smooth, and the present invention does not impose any limitation on this.

[0139] The method further comprises:

[0140] S51 , generating air wall models on the left and right sides of the track model based on the coordinates of the left and right vertices in the track model.

[0141] For racing, parkour and other games, in order to avoid possible abnormal situations caused by players' controlled objects such as controlled cars and virtual characters leaving the track model during the game, air wall models can be generated on both sides of the track to keep the player's controlled objects always in the track model.

[0142] Specifically, since the orientation of the air wall model can be identical to that of the track model, the coordinates of the bottom curve of the air wall model can be directly determined based on the coordinates of the left and right vertices in the track model. Subsequently, the height of the air wall model can be further determined, and the plane coordinates of the left and right vertices in the track model can be used as the plane coordinates of the air wall. The coordinates of the top curve of the air wall can be determined based on the coordinates of the left and right vertices in the track model and the height of the air wall model, thus quickly generating the air wall model.

[0143] The track model generation method of the embodiment of the present invention generates a track segment model adjacent to a previous track segment model based on preset track parameters, enabling a custom track shape to be formed by splicing multiple track segment models, and the generation is fast. The method also obtains the first coordinates of the current track segment model and the second coordinates of the previous track segment model. Based on the first and second coordinates, the current track segment model and the previous track segment model are fused to obtain a continuous track model. This allows for relatively smooth transitions throughout the track model, resulting in a better generation effect.

[0144] It should be noted that for the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0145] Reference Figure 8 , shows a structural block diagram of a device for generating a track model provided in an embodiment of the present invention, which may specifically include the following modules:

[0146] The model generation module 801 is used to generate a track segment model adjacent to the previous track segment model based on preset track parameters;

[0147] A coordinate acquisition module 802 is configured to acquire a first coordinate of the current race track segment model and a second coordinate of the previous race track segment model;

[0148] The fusion module 803 is configured to fuse the current race track section model with the previous race track section model based on the first coordinate and the second coordinate to obtain a continuous track model.

[0149] Optionally, the model generation module includes:

[0150] A starting point setting submodule, configured to set the end point of the previous track section model as the starting point of the current track section model;

[0151] A second coordinate determination submodule, configured to determine the second coordinate of each vertex in the current track section model from the starting point to the end point based on preset track parameters;

[0152] The model generation submodule is configured to generate the current race track segment model based on the coordinates of each vertex in the current race track segment model.

[0153] Optionally, the track parameters include a turning angle and a turning radius;

[0154] The second coordinate determination submodule includes:

[0155] a direction angle determination unit, configured to determine, for a current vertex, a direction angle of the current vertex relative to a circle center model generation module of the current race track section model based on the turning angle and the curve radius;

[0156] The second coordinate determining unit is configured to determine the second coordinate of the current vertex based on the coordinates of the center of the current race track section model, the direction angle of the current vertex, and the curve radius.

[0157] Optionally, the fusion module includes:

[0158] a difference calculation submodule, configured to determine, when the current race track segment model and the previous race track segment model are in the same plane, a coordinate difference between a first coordinate of an end point of the previous race track segment model and a second coordinate of a starting point of the current race track segment model;

[0159] a weight determination submodule, configured to determine, based on positions of the vertices in the current race track segment model, fusion weights corresponding to the vertices in the current race track segment model;

[0160] The fusion submodule is configured to adjust the coordinates of vertices in the current track segment model by using the fusion weights and the coordinate differences, so as to fuse the current track segment model with the previous track segment model to obtain a continuous track model.

[0161] Optionally, the fusion module includes:

[0162] a smoothing submodule configured to adjust the first coordinate and the second coordinate of the starting point of the previous track segment model and the ending point of the current track segment model so as to approximate the differences between the coordinates of adjacent vertices when the current track segment model and the previous track segment model are not in the same plane, while maintaining the first coordinate of the starting point of the previous track segment model and the second coordinate of the ending point of the current track segment model unchanged.

[0163] Optionally, the device further comprises:

[0164] A scaling parameter acquisition module is used to obtain scaling parameters;

[0165] A width adjustment module is configured to adjust the race track section model using the scaling parameter to adjust the width of the race track section.

[0166] Optionally, the device further comprises:

[0167] The air wall generation module is used to generate air wall models on the left and right sides of the track model based on the coordinates of the left and right vertices in the track model.

[0168] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0169] In addition, an embodiment of the present invention further provides an electronic device, such as Figure 9 As shown, it includes a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904.

[0170] Memory 903, used for storing computer programs;

[0171] The processor 901 is configured to execute the program stored in the memory 903, and implement the following steps:

[0172] Based on the preset track parameters, a track section model adjacent to the previous track section model is generated;

[0173] Obtaining a first coordinate of the current race track section model and a second coordinate of the previous race track section model;

[0174] Based on the first coordinate and the second coordinate, the current race track section model and the previous race track section model are fused to obtain a continuous track model.

[0175] Optionally, the step of generating a race track section model adjacent to the previous race track section model based on preset race track parameters includes:

[0176] Taking the end point of the previous track section model as the starting point of the current track section model;

[0177] Based on the preset track parameters, determining the second coordinates of each vertex in the current track section model from the starting point to the end point in sequence;

[0178] The current race track segment model is generated based on the coordinates of each vertex in the current race track segment model.

[0179] Optionally, the track parameters include a turning angle and a turning radius;

[0180] The step of determining the second coordinate of each vertex in the current track section model from the starting point to the end point based on the preset track parameters includes:

[0181] For a current vertex, determining a direction angle of the current vertex relative to the center of the current race track segment model based on the turning angle and the curve radius;

[0182] The second coordinate of the current vertex is determined based on the coordinates of the center of the current race track section model, the direction angle of the current vertex, and the curve radius.

[0183] Optionally, the step of fusing the current race track section model with the previous race track section model based on the first coordinate and the second coordinate to obtain a continuous track model includes:

[0184] When the current race track segment model and the previous race track segment model are in the same plane, determining a coordinate difference between a first coordinate of an end point of the previous race track segment model and a second coordinate of a starting point of the current race track segment model;

[0185] Determining, according to the position of the vertex in the current race track segment model, a fusion weight corresponding to the vertex in the current race track segment model;

[0186] The fusion weights and the coordinate differences are used to adjust the coordinates of the vertices in the current race track segment model to fuse the current race track segment model with the previous race track segment model to obtain a continuous race track model.

[0187] Optionally, the step of fusing the current race track section model with the previous race track section model based on the first coordinate and the second coordinate to obtain a continuous track model includes:

[0188] If the current track segment model and the previous track segment model are not in the same plane, the first coordinates and the second coordinates of the starting point of the previous track segment model and the ending point of the current track segment model are adjusted to approximate the differences between the coordinates of adjacent vertices while maintaining the first coordinates of the starting point of the previous track segment model and the second coordinates of the ending point of the current track segment model unchanged.

[0189] Optionally, the method further includes:

[0190] Get the scaling parameters;

[0191] The scaling parameter is used to adjust the race track segment model to adjust the width of the race track segment.

[0192] Optionally, the method further includes:

[0193] Based on the coordinates of the left and right vertices in the track model, air wall models are generated on the left and right sides of the track model.

[0194] The communication bus mentioned in the terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0195] The communication interface is used for communication between the above terminal and other devices.

[0196] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0197] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0198] like Figure 10 As shown, in another embodiment provided by the present invention, a computer-readable storage medium 1001 is also provided, in which instructions are stored. When the computer-readable storage medium 1001 is run on a computer, the computer executes the method for generating a track model described in the above embodiment.

[0199] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the method for generating a track model described in the above embodiment.

[0200] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0201] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0202] Each embodiment in this specification is described in a related manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so the description is relatively simple. For related parts, refer to the description of the method embodiment.

[0203] The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.

Claims

1. A method for generating a track model, characterized in that: include: Based on the preset track parameters, a track section model adjacent to the previous track section model is generated; Obtaining the first coordinate of the current race track segment model and the second coordinate of the previous race track segment model; Based on the first coordinates and the second coordinates, fusing the current race track section model with the previous race track section model to obtain a continuous track model; The step of fusing the current race track section model with the previous race track section model based on the first coordinate and the second coordinate to obtain a continuous track model includes: When the current race track segment model and the previous race track segment model are in the same plane, determining a coordinate difference between a first coordinate of an end point of the previous race track segment model and a second coordinate of a starting point of the current race track segment model; Determining, according to the position of the vertex in the current race track segment model, a fusion weight corresponding to the vertex in the current race track segment model; The fusion weight and the coordinate difference are used to adjust the coordinates of the vertices in the current race track segment model to fuse the current race track segment model with the previous race track segment model to obtain a continuous race track model.

2. The method according to claim 1, characterized in that The step of generating a track section model adjacent to the previous track section model based on preset track parameters includes: Taking the end point of the previous track section model as the starting point of the current track section model; Based on the preset track parameters, determining the second coordinates of each vertex in the current track section model from the starting point to the end point in sequence; The current race track segment model is generated based on the coordinates of each vertex in the current race track segment model.

3. The method according to claim 2, characterized in that The track parameters include turning angle and turning radius; The step of determining the second coordinate of each vertex in the current track section model from the starting point to the end point based on the preset track parameters includes: For a current vertex, determining a direction angle of the current vertex relative to the center of the current race track segment model based on the turning angle and the curve radius; The second coordinate of the current vertex is determined based on the coordinates of the center of the current race track section model, the direction angle of the current vertex, and the curve radius.

4. The method according to claim 1, wherein The step of fusing the current race track section model with the previous race track section model based on the first coordinate and the second coordinate to obtain a continuous track model includes: If the current track segment model and the previous track segment model are not in the same plane, the first coordinates and the second coordinates of the starting point of the previous track segment model and the ending point of the current track segment model are adjusted to approximate the differences between the coordinates of adjacent vertices while maintaining the first coordinates of the starting point of the previous track segment model and the second coordinates of the ending point of the current track segment model unchanged.

5. The method according to claim 1, wherein The method further comprises: Get the scaling parameters; The scaling parameter is used to adjust the race track segment model to adjust the width of the race track segment.

6. The method according to claim 1, characterized in that The method further comprises: Based on the coordinates of the left and right vertices in the track model, air wall models are generated on the left and right sides of the track model.

7. A device for generating a track model, characterized in that: include: A model generation module, configured to generate a track section model adjacent to a previous track section model based on preset track parameters; A coordinate acquisition module, configured to acquire a first coordinate of a current race track section model and a second coordinate of a previous race track section model; a fusion module, configured to fuse the current race track section model with the previous race track section model based on the first coordinate and the second coordinate to obtain a continuous track model; The fusion module includes: a difference calculation submodule, configured to determine, when the current race track segment model and the previous race track segment model are in the same plane, a coordinate difference between a first coordinate of an end point of the previous race track segment model and a second coordinate of a starting point of the current race track segment model; a weight determination submodule, configured to determine a fusion weight corresponding to a vertex in the current race track segment model according to a position of the vertex in the current race track segment model; The fusion submodule is configured to adjust the coordinates of vertices in the current track segment model by using the fusion weights and the coordinate differences, so as to fuse the current track segment model with the previous track segment model to obtain a continuous track model.

8. An electronic device, characterized in that: comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is configured to implement the method according to any one of claims 1 to 6 when executing a program stored in the memory.

9. One or more computer-readable media having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Automatic generation method of game track, terminal and storage medium

    CN112884883A