Element display method and device for virtual scene, equipment, medium and product
By displaying virtual ammunition track line elements at a slower initial speed in the shooting game and gradually catching up with the speed of virtual ammunition, combined with curve simulation, the problem of poor display of virtual ammunition tracks is solved, and the display effect of virtual ammunition tracks is improved and game experience.
Patent Information
- Application Number
- CN202411291047.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2024-12-10
AI Technical Summary
In virtual scenes in shooting games, the trajectory line elements of virtual ammunition are displayed in a relatively single way, resulting in poor performance of virtual ammunition.
By displaying the trackline element at a slower initial movement speed after the virtual ammunition is launched and gradually increasing the speed to the same as the virtual ammunition until it catches up and maintaining the same speed when the head position of the trackline element coincides with the virtual ammunition position. , combined with the use of Bezier curves and designated curves to simulate the flight trajectory of virtual ammunition.
It improves the display effect of the virtual ammunition flight trajectory, enables users to more conveniently observe the virtual ammunition flight trajectory, expands the performance of the virtual ammunition flight trajectory, and enhances the gaming experience.
Smart Images

Figure CN119097914A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of virtual scenes, and in particular to a method, device, equipment, medium and product for displaying elements of a virtual scene. Background Art
[0002] In virtual scenes of shooting games, virtual shooting props are usually provided, and players can control virtual objects to use the virtual shooting props to fire virtual ammunition.
[0003] In the related art, in order to facilitate users to observe the virtual ammunition after firing, during the flight of the virtual ammunition, a highlighted linear element is synchronously displayed corresponding to the virtual ammunition to simulate the moving trajectory of the virtual ammunition in the virtual scene.
[0004] However, the display method of the linear elements of the virtual ammunition in the above solution is relatively simple, and the expression effect of the trajectory of the virtual ammunition is relatively poor. Summary of the invention
[0005] The present application provides a method, device, equipment, medium and product for displaying elements of a virtual scene. The technical solution is as follows:
[0006] According to one aspect of the present application, a method for displaying elements of a virtual scene is provided, the method comprising:
[0007] Displaying a virtual object in a virtual scene, wherein the virtual object is equipped with a virtual shooting prop;
[0008] Controlling the virtual object to use the virtual shooting prop to fire virtual ammunition;
[0009] A trajectory line element of the virtual ammunition is displayed, where the trajectory line element is a line element used to indicate a flight trajectory of the virtual ammunition, and an initial moving speed of the trajectory line element is less than a moving speed of the virtual ammunition.
[0010] According to another aspect of the present application, there is provided an element display device for a virtual scene, the device comprising:
[0011] An object display module, used for displaying a virtual object in a virtual scene, wherein the virtual object is equipped with a virtual shooting prop;
[0012] An object control module, used to control the virtual object to use the virtual shooting prop to fire virtual ammunition;
[0013] The element display module is used to display the trajectory element of the virtual ammunition, wherein the trajectory element is a linear element used to indicate the flight trajectory of the virtual ammunition, and the initial moving speed of the trajectory element is less than the moving speed of the virtual ammunition.
[0014] In a possible implementation manner, before the head position of the trajectory element coincides with the position of the virtual ammunition, the moving speed of the trajectory element is positively correlated with the flight time of the virtual ammunition.
[0015] In a possible implementation manner, after the head position of the trajectory element coincides with the position of the virtual ammunition, the moving speed of the trajectory element is the same as the moving speed of the virtual ammunition.
[0016] In a possible implementation, the first length of the trajectory element is greater than the second length of the trajectory element;
[0017] Wherein, the first length is the length of the trajectory element before the head position of the trajectory element coincides with the position of the virtual ammunition;
[0018] The second length is the length of the trajectory element after the head position of the trajectory element coincides with the position of the virtual ammunition.
[0019] In a possible implementation, the element display module is used to:
[0020] Acquire a first duration, where the first duration is the flight duration of the virtual ammunition at a first moment;
[0021] In querying the duration relationship, a second duration corresponding to the first duration, the second duration being less than or equal to the first duration; the duration relationship is used to indicate the relationship between two durations;
[0022] The position of the virtual ammunition at the moment when the flight time is the second time length is acquired as the head position of the trajectory element at the first moment;
[0023] The trajectory line element at the first moment is displayed based on the head position.
[0024] In a possible implementation, the element display module is used to:
[0025] Obtaining the tail position of the trajectory line element at the first moment;
[0026] Determine at least one intermediate position on the trajectory line element at the first moment based on the head position and the tail position;
[0027] The trajectory line element at the first moment is displayed based on the head position, the tail position, and the at least one intermediate position.
[0028] In a possible implementation manner, the trajectory element is a Bezier curve starting from the head position and sequentially passing through the at least one intermediate position to reach the tail position.
[0029] In a possible implementation, the element display module is used to:
[0030] Acquire a specified curve passing through the head position and the tail position;
[0031] At least one position between the head position and the tail position in the specified curve is acquired as the at least one intermediate position.
[0032] In a possible implementation, the element display module is used to obtain at least one position in the specified curve, in which a line segment between the head position and the tail position is divided according to a specified ratio, and obtain the at least one intermediate position.
[0033] In a possible implementation, the element display module is configured to obtain the position of the launching port of the virtual shooting prop as the tail position when the distance between the head position and the launching port of the virtual shooting prop is less than a specified distance.
[0034] In a possible implementation, the element display module is used to:
[0035] When the distance between the head position and the launching port of the virtual shooting prop is less than a specified distance, obtaining the position of the launching port of the virtual shooting prop at the first moment as the tail position;
[0036] Alternatively, when the distance between the head position and the launching port of the virtual shooting prop is less than a specified distance, the position of the launching port of the virtual shooting prop at a second moment is obtained as the tail position; the second moment is the middle moment between the moment when the virtual shooting prop launches the virtual ammunition and the first moment.
[0037] In a possible implementation, the element display module is used to determine the tail position in the trajectory line element at a third moment when the distance between the head position and the launching port of the virtual shooting prop is not less than a specified distance; the third moment is the moment when the trajectory line element is displayed before the first moment.
[0038] In a possible implementation, the element display module is used to:
[0039] When the distance between the head position and the launch port of the virtual shooting prop is not less than a specified distance, querying the head-to-tail distance corresponding to the first duration in the first distance relationship; the first distance relationship is used to indicate the relationship between duration and distance;
[0040] A position in the trajectory line element at the third moment, the position of which the distance from the head position is the head-to-tail distance, is determined as the tail position.
[0041] In a possible implementation manner, the specified distance is a distance corresponding to the first duration in a second distance relationship; the second distance relationship is used to indicate a relationship between duration and distance.
[0042] In a possible implementation manner, the device further includes:
[0043] The position acquisition module is used for acquiring the hitting point position of the virtual ammunition as the head position of the trajectory element at the fourth moment in response to the virtual ammunition hitting any scene element in the virtual scene at the fourth moment.
[0044] In a possible implementation, the starting point of the head of the trajectory element is located at the position of the launching port of the virtual shooting prop when the virtual shooting prop launches virtual ammunition.
[0045] In a possible implementation, the element display module is used to:
[0046] Acquire an observation distance, where the observation distance is the distance between a camera position and the trajectory element; the camera position is the position of a camera that renders the virtual scene;
[0047] Acquiring display properties of the trajectory line element based on the observation distance;
[0048] The trajectory line element is displayed based on the display attribute.
[0049] In a possible implementation, the display attribute includes one or more of the following attributes:
[0050] Brightness, display size, transparency.
[0051] According to another aspect of the present application, a computer device is provided, the computer device comprising: a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the element display method for a virtual scene as described above.
[0052] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the element display method for a virtual scene as described above.
[0053] According to another aspect of the present application, a computer program product is provided, which includes computer instructions, the computer instructions are stored in a computer-readable storage medium, and a processor obtains the computer instructions from the computer-readable storage medium, so that the processor loads and executes to implement the element display method for a virtual scene as described above.
[0054] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0055] A scheme for displaying trajectory line elements of virtual ammunition is provided. The scheme separates the real-time position of the trajectory line elements of the virtual ammunition from the real-time position of the virtual ammunition. Specifically, after the virtual ammunition is fired, the trajectory line elements of the virtual ammunition are displayed at an initial moving speed that is slower than the moving speed of the virtual ammunition. In this way, in the early stage after the virtual ammunition is fired, the trajectory line elements can be moved away from the firing point at a slower speed, so that the trajectory line elements can be maintained at the near end of the firing point for a longer time, so that the user can more conveniently and intuitively observe the flight trajectory of the virtual ammunition at the near end of the firing point, thereby expanding a new scheme for displaying the flight trajectory of the virtual ammunition and improving the display effect of the flight trajectory of the virtual ammunition. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 is a structural block diagram of a computer system provided by an exemplary embodiment of the present application;
[0057] Figure 2 is a flow chart of a method for displaying elements of a virtual scene provided by an embodiment of the present application;
[0058] Figure 3 is a flow chart of a method for displaying elements of a virtual scene provided by an embodiment of the present application;
[0059] Figure 4 It is a schematic diagram of a time relationship curve involved in an embodiment of the present application;
[0060] Figure 5 is another schematic diagram of a time relationship curve involved in an embodiment of the present application;
[0061] Figure 6 It is another schematic diagram of a time relationship curve involved in the embodiment of the present application;
[0062] Figure 7It is another schematic diagram of a time relationship curve involved in the embodiment of the present application;
[0063] Figure 8 is a control logic diagram of a virtual bullet provided by an exemplary embodiment of the present application;
[0064] Fig. 9 It is a schematic diagram showing the deflection of a bullet (elastic line) involved in the present application;
[0065] Fig.10 It is a schematic diagram of an elastic line involved in an embodiment of the present application;
[0066] Fig.11 is another elastic line schematic diagram involved in the embodiment of the present application;
[0067] Fig.12 It is a shooting schematic diagram involved in this application;
[0068] Fig.13 is a schematic diagram of a character capsule involved in this application;
[0069] Fig.14 is a structural block diagram of an element display device for a virtual scene provided by an embodiment of the present application;
[0070] Fig.15 It is a structural block diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0071] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0072] First, the nouns involved in the embodiments of the present application are introduced:
[0073] 1) Virtual scene: A virtual scene is a virtual scene displayed (or provided) when an application is running on a terminal. The virtual scene can be a simulated environment scene of the real world, a semi-simulated and semi-fictitious three-dimensional environment scene, or a purely fictitious three-dimensional environment scene. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, and a three-dimensional virtual scene. The following embodiments are illustrated by taking the virtual scene as a three-dimensional virtual scene, but are not limited to this. Optionally, the virtual scene can also be used for virtual scene battles / competitions between at least two virtual characters. Optionally, the virtual scene can also be used for battles between at least two virtual characters using virtual props within the target area.
[0074] The virtual scene is usually generated by an application in a computer device such as a terminal and displayed based on the hardware in the terminal (such as a screen). The terminal can be a mobile terminal such as a smart phone, tablet computer or e-book reader; or, the terminal can also be a personal computer device such as a laptop or a fixed computer.
[0075] 2) Virtual object: A virtual object refers to an object that can be moved in a virtual scene. The movable object can be at least one of a virtual person, a virtual character, a virtual pet, a virtual animal, and a virtual vehicle. Optionally, when the virtual scene is a three-dimensional virtual scene, the virtual object is a three-dimensional model created based on animation skeleton technology. Each virtual object has its own shape, volume, and orientation in the three-dimensional virtual scene, and occupies a part of the space in the three-dimensional virtual scene.
[0076] Figure 1 The following is a block diagram of a computer system according to an exemplary embodiment of the present application. The computer system 100 includes: a first terminal 110 , a server 120 , and a second terminal 130 .
[0077] The first terminal 110 is installed and runs a client 111 that supports virtual scenes. The client 111 may be a shooting game program or a role-playing game (RPG) program, etc. When the first terminal runs the client 111, the user interface of the client 111 is displayed on the screen of the first terminal 110. The client may be a shooting game program or an RPG client. The first terminal 110 is a terminal used by a first user 112.
[0078] The second terminal 130 is installed and runs a client 131 that supports a virtual scene. The client 131 can be a shooting game program or an RPG program. When the second terminal 130 runs the client 131, the user interface of the client 131 is displayed on the screen of the second terminal 130. The client can be a shooting game program or an RPG client. The second terminal 130 is a terminal used by a second user 132.
[0079] Optionally, the clients installed on the first terminal 110 and the second terminal 130 are the same, or the clients installed on the two terminals are the same type of clients on different operating system platforms. The first terminal 110 may refer to one of a plurality of terminals, and the second terminal 130 may refer to another of a plurality of terminals. This embodiment is only illustrated by taking the first terminal 110 and the second terminal 130 as an example. The device types of the first terminal 110 and the second terminal 130 are the same or different, and the device type includes at least one of a smart phone, a tablet computer, an e-book reader, an MP3 player, an MP4 player, a laptop computer, and a desktop computer. The following embodiments are illustrated by taking the terminal including a smart phone as an example.
[0080] Those skilled in the art will appreciate that the number of the above terminals may be more or less. For example, the above terminal may be only one, or the above terminals may be 6, 8, or more. The embodiment of the present application does not limit the number of terminals and device types.
[0081] Figure 1 Only two terminals are shown, but in different embodiments, there are multiple other terminals 140 that can access the server 120. Optionally, there are one or more terminals 140 corresponding to the developer, and a development and editing platform for the client supporting the virtual scene is installed on the terminal 140. The developer can edit and update the client on the terminal 140, and transmit the updated client installation package to the server 120 via a wired or wireless network. The first terminal 110 and the second terminal 130 can download the client installation package from the server 120 to update the client.
[0082] The first terminal 110 , the second terminal 130 , and other terminals 140 are connected to the server 120 via a wireless network or a wired network.
[0083] The server 120 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. The server 120 is used to provide background services for clients that support three-dimensional virtual scenes (such as shooting game programs or RPG clients). Optionally, the server 120 undertakes the main computing work and the terminal undertakes the secondary computing work; or, the server 120 undertakes the secondary computing work and the terminal undertakes the main computing work; or, the server 120 and the terminal adopt a distributed computing architecture for collaborative computing.
[0084] In an illustrative example, the server 120 includes a processor 122, a user account database 123, a scene service module 124, and a user-oriented input / output interface (I / O interface) 125. The processor 122 is used to load instructions stored in the server 120 and process data in the user account database 123 and the scene service module 124; the user account database 123 is used to store data of user accounts used by the first terminal 110, the second terminal 130, and other terminals 140, such as the user account's avatar, the user account's nickname, the user account's combat power index, and the service area where the user account is located; the scene service module 124 is used to provide background services for virtual scenes; and the user-oriented I / O interface 125 is used to establish communication and exchange data with the first terminal 110 and / or the second terminal 130 through a wireless network or a wired network.
[0085] Please refer to Figure 2 , which shows a flowchart of a method for displaying elements of a virtual scene provided by an exemplary embodiment of the present application, the method is executed by a computer device, and the method is applied to Figure 1 Taking the first terminal 110 or a shooting game program or RPG application installed on the first terminal 110 or the second terminal 130 or a shooting game program or RPG application installed on the second terminal 130 as an example, the method may include the following steps.
[0086] Step 210: Display a virtual object in the virtual scene, where the virtual object is equipped with a virtual shooting prop.
[0087] The virtual object may be any virtual object in a virtual scene that can be equipped with virtual shooting props. For example, the virtual object may be a main virtual object of the current user, or the virtual object may be a virtual object controlled by other users, or the virtual object may be a virtual object controlled by artificial intelligence (AI).
[0088] The virtual object may have the ability to collect and equip the shooting virtual props in the virtual scene; or, the shooting virtual props may be virtual props that come with the virtual object when it is generated in the virtual scene.
[0089] Step 220: Control the virtual object to use the virtual shooting prop to fire virtual ammunition.
[0090] In an embodiment of the present application, upon receiving a shooting operation triggered by a user or AI as the controller of a virtual object, the computer device may control the virtual object to use the virtual shooting prop to fire virtual ammunition.
[0091] Step 230: displaying a trajectory element of the virtual ammunition, where the trajectory element is a line element used to indicate the flight trajectory of the virtual ammunition, and an initial moving speed of the trajectory element is less than the moving speed of the virtual ammunition.
[0092] In an embodiment of the present application, after the virtual shooting prop launches the virtual ammunition, the computer device can display a corresponding trajectory line element corresponding to the virtual ammunition. The trajectory line element is a linear visual scene element so that the user can observe the flight trajectory of the virtual ammunition in the virtual scene.
[0093] The above-mentioned trajectory line element is a scene element used to indicate the flight trajectory of the virtual ammunition, rather than the virtual ammunition itself, and the position of the trajectory line element and the virtual ammunition is not synchronized in real time. In the period of time when the virtual ammunition has just been launched, the position of the trajectory line element lags behind the position of the virtual ammunition.
[0094] In a possible implementation, when the virtual object is a master virtual object corresponding to a terminal that displays a virtual scene, the trajectory element having an initial moving speed less than the moving speed of the virtual ammunition can be displayed on the terminal side. The master virtual object corresponding to the terminal can be a virtual object controlled by a user account logged in to the terminal. That is to say, after the virtual object launches virtual ammunition through a virtual shooting prop, when the trajectory element is realized on the terminal side corresponding to the virtual object, its initial moving speed is less than the moving speed of the virtual ammunition; in other words, for the user who controls the virtual object to launch virtual ammunition, the initial moving speed of the trajectory element observed by the user is less than the moving speed of the virtual ammunition.
[0095] In another possible implementation, for virtual ammunition fired by any virtual object in the virtual scene, the computer device can display the above-mentioned trajectory line element whose initial moving speed is less than the moving speed of the virtual ammunition. That is to say, after a virtual object in the virtual scene fires virtual ammunition, on the terminal side corresponding to any virtual object in the virtual scene, the initial moving speed of the trajectory line element corresponding to the virtual ammunition is less than the moving speed of the virtual ammunition, that is to say, from the perspective of any user in the virtual scene, the initial moving speed of the trajectory line element corresponding to the virtual ammunition is less than the moving speed of the virtual ammunition.
[0096] In a possible implementation, the computer device can determine the display position of the trajectory line element at the current moment according to the position of the virtual ammunition at the current moment (or the current frame), and by setting the relationship between the position of the virtual ammunition and the display position of the trajectory line element at different moments / different frames, it can simulate the effect that the position of the trajectory line element lags behind the position of the virtual ammunition at the end of the time when the virtual ammunition is just fired.
[0097] In another possible implementation, the relationship between the movement speed of the trajectory line element and the time can be pre-set in the computer device. The relationship between the movement speed of the trajectory line element and the time can be represented by a curve or a formula, which is used to indicate the corresponding relationship between the flight time of the virtual ammunition and the movement speed of the trajectory line element. After the virtual object uses the virtual shooting prop to launch the virtual ammunition, the computer device can calculate the position of the trajectory line element at the current moment according to the flight time of the virtual ammunition and the relationship between the movement speed of the above-mentioned trajectory line element and the time, and display the above-mentioned trajectory line element based on the calculated position.
[0098] In shooting games, the game is usually played from a first-person or third-person perspective. The player's perspective of observing the game world is the same as the real world, with obvious characteristics of larger objects at close range and smaller objects at far distances (the same object is larger visually when it is close, and smaller visually when it is far away). Accordingly, when virtual ammunition is fired from the player's perspective to a distance, due to the excessive speed of the virtual ammunition, with the characteristic of larger objects at close range and smaller objects at far distances, the virtual ammunition can often only stay in a relatively short range for a very short time, and then, as the distance increases, the relative displacement on the screen gradually slows down. This processing method often makes the virtual ammunition appear unclear at close ranges and seem to fly slowly at long distances.
[0099] In this regard, in an embodiment of the present application, a slower initial moving speed (less than the moving speed of the virtual ammunition) can be set for the trajectory line element used to represent the flight trajectory of the virtual ammunition, so that the trajectory line element of the virtual ammunition can stay near the launch point longer than the virtual ammunition.
[0100] In summary, the embodiments of the present application provide a solution for displaying trajectory line elements of virtual ammunition, which splits the real-time position of the trajectory line elements of the virtual ammunition from the real-time position of the virtual ammunition. Specifically, after the virtual ammunition is launched, the trajectory line elements of the virtual ammunition are displayed at an initial moving speed that is slower than the moving speed of the virtual ammunition. In this way, in the early stage after the virtual ammunition is launched, the trajectory line elements can move away from the launch point at a slower speed, so that the trajectory line elements are maintained at the near end of the launch point for a longer time, so that the user can more conveniently and intuitively observe the flight trajectory of the virtual ammunition at the near end of the launch point, thereby expanding a new solution for displaying the flight trajectory of the virtual ammunition and improving the display effect of the flight trajectory of the virtual ammunition.
[0101] Based on the solution shown in the above embodiment, in a possible implementation manner, before the head position of the trajectory element coincides with the position of the virtual ammunition, the moving speed of the trajectory element is positively correlated with the flight time of the virtual ammunition.
[0102] In the embodiment of the present application, when the trajectory element moves in the virtual scene at a relatively low initial moving speed, the moving speed can be gradually increased or decreased until the trajectory element catches up with the virtual ammunition in the virtual scene (that is, the head position of the trajectory element coincides with the position of the virtual ammunition). Specifically, from the time the virtual ammunition is fired, the trajectory element starts from a relatively low initial moving speed and gradually increases the moving speed, and in order to catch up with the virtual ammunition, the moving speed of the trajectory element will exceed the moving speed of the virtual ammunition after a period of time until it catches up with the virtual ammunition.
[0103] In a possible implementation, the computer device sets the relationship between the position of the virtual ammunition and the display position of the trajectory element at different times / frames to simulate the effect that the position of the trajectory element lags behind the position of the virtual ammunition and gradually catches up with the virtual ammunition during the period of time when the virtual ammunition is just fired. For example, when the virtual ammunition is just fired, the computer device sets the display position of the trajectory element to lag behind the position of the virtual ammunition by a long distance. Subsequently, as time goes by, the distance of the display position of the trajectory element behind the position of the virtual ammunition gradually shortens until it reaches 0.
[0104] In another possible implementation, when the relationship of the movement speed of the trajectory line element changing with time is pre-set in the computer device, when the virtual ammunition is just fired, the movement speed of the trajectory line element is lower than the movement speed of the virtual ammunition, and then as time goes by, the movement speed of the trajectory line element gradually increases and exceeds the movement speed of the virtual ammunition until the displayed position of the trajectory line element catches up with the position of the virtual ammunition.
[0105] The above scheme can make the moving speed of the trajectory element of the virtual ammunition gradually approach the moving speed of the virtual ammunition, that is, make the real-time position of the trajectory element in the virtual scene gradually return to normal, ensuring the authenticity of the performance of the trajectory element.
[0106] Based on the solution shown in the above embodiment, in a possible implementation manner, after the head position of the trajectory element coincides with the position of the virtual ammunition, the moving speed of the trajectory element is the same as the moving speed of the virtual ammunition.
[0107] In a possible implementation, the computer device can simulate that after the trajectory element catches up with the virtual ammunition, it keeps the same moving speed as the virtual ammunition by setting the relationship between the position of the virtual ammunition and the display position of the trajectory element. Specifically, for example, at each time point / frame after the trajectory element catches up with the virtual ammunition, the computer device sets the display position of the trajectory element to be the same as the position of the virtual ammunition.
[0108] In another possible implementation, when a relationship in which a moving speed of a trajectory element changes with time is pre-set in a computer device, after the trajectory element catches up with the virtual ammunition, the moving speed of the trajectory element is the same as the moving speed of the virtual ammunition.
[0109] In an embodiment of the present application, in order to normally display the moving trajectory of the virtual ammunition at the far end of the launching point of the virtual ammunition, after the head position of the trajectory line element coincides with the position of the virtual ammunition, the computer device can control the moving speed of the trajectory line element to be the same as the moving speed of the virtual ammunition, that is, at the far end of the launching point of the virtual ammunition, the real-time position of the virtual ammunition is consistent with the real-time position of the trajectory line element, thereby ensuring the authenticity of the performance of the trajectory line element at the far end of the launching point.
[0110] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, the first length of the trajectory element is greater than the second length of the trajectory element;
[0111] The first length is the length of the trajectory element before the head position of the trajectory element coincides with the position of the virtual ammunition;
[0112] The second length is the length of the trajectory element after the head position of the trajectory element coincides with the position of the virtual ammunition.
[0113] In an embodiment of the present application, the computer device can control the size of the trajectory of the virtual ammunition at the near end of the launch point to be larger than the size of the trajectory of the virtual ammunition at the far end of the launch point. Specifically, the computer device controls the length of the above-mentioned trajectory line element before catching up with the virtual ammunition to be larger than the length of the trajectory line element after catching up with the virtual ammunition.
[0114] The scheme in which the computer device controls the length of the trajectory element before catching up with the virtual ammunition to be greater than the length of the trajectory element after catching up with the virtual ammunition can be realized through a pre-set length-duration relationship. For example, the computer device can obtain a first duration, which is the flight duration of the virtual ammunition at the first moment, and query the length corresponding to the first duration in the length-duration relationship as the length of the trajectory element at the first moment; wherein the length-duration relationship is used to indicate the relationship between the flight duration of the virtual ammunition and the length of the trajectory element, and, in the length-duration relationship, the length corresponding to before the specified duration is greater than the length corresponding to after the specified duration. wherein the specified duration is the flight duration of the virtual ammunition when the trajectory element catches up with the virtual ammunition.
[0115] Optionally, the above-mentioned length-duration relationship can be represented by a length-duration relationship curve, or the above-mentioned length-duration relationship can also be determined by a length-duration relationship calculation formula.
[0116] Through the above scheme, the trajectory of the virtual ammunition can be made to appear longer visually near the launch point, making it easier for users to distinguish the trajectory of the virtual ammunition near the launch point, thereby further reflecting the display effect of the trajectory of the virtual ammunition near the launch point.
[0117] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation method, please refer to Figure 3 , which shows a flowchart of an element display method for a virtual scene provided by an exemplary embodiment of the present application; Figure 3 As shown, the above step 230 can be implemented as the following steps 230a to 230d.
[0118] Step 230a: Obtain a first duration, where the first duration is the flight duration of the virtual ammunition at the first moment.
[0119] The first moment may be the current moment; for example, when a computer device displays a trajectory element in a virtual scene, it calculates the current head position of the trajectory element in real time in each frame. At this time, the first duration obtained by the computer device is the flight duration of the virtual ammunition at the current moment.
[0120] Alternatively, the first moment may also be a moment after the current moment; for example, when a computer device displays a trajectory line element in a virtual scene, it may pre-calculate the head position of the trajectory line element at one or more subsequent moments. At this time, the first duration obtained by the computer device is the flight duration of the virtual ammunition at a certain moment after the current moment.
[0121] Alternatively, the first moment may also be a moment before the current moment; for example, when a computer device displays a trajectory element in a virtual scene, the displayed trajectory element may have a certain delay (such as a delay of one or several frames). At this time, the first duration obtained by the computer device is the flight duration of the virtual ammunition at a moment before the current moment.
[0122] Step 230b: In querying the duration relationship, a second duration corresponding to the first duration is found, and the second duration is less than or equal to the first duration; the duration relationship is used to indicate the relationship between two durations.
[0123] Optionally, the above-mentioned duration relationship may be represented by a duration relationship curve, or the above-mentioned duration relationship may also be determined by a duration relationship calculation formula.
[0124] Step 230c: The position of the virtual ammunition at the moment when the flight time is the second time length is obtained as the head position of the trajectory element at the first moment.
[0125] For example, taking the above duration relationship represented by a duration relationship curve as an example, please refer to Figure 4 , which shows a schematic diagram of a time relationship curve involved in an embodiment of the present application. Figure 4 As shown, the horizontal axis is the flight time of the virtual ammunition corresponding to the position of the virtual ammunition; the vertical axis is the flight time of the virtual ammunition corresponding to the position of the head of the trajectory element; Figure 4 In the example, before the duration D1, the value of the abscissa of the point on the duration relationship curve 401 is greater than the value of the ordinate; after the duration D1, the value of the abscissa of the point on the duration relationship curve 401 is equal to the value of the ordinate. Specifically, if the first duration is less than D1, the second duration queried from the duration relationship curve 401 will be less than the first duration, and accordingly, at the first moment, the head position of the trajectory element (the position of the virtual ammunition at the moment when the flight duration is the second duration) lags behind the position of the virtual ammunition; conversely, if the first duration is greater than or equal to D1, the second duration queried from the duration relationship curve 401 will be equal to the first duration, and accordingly, at the first moment, the head position of the trajectory element is consistent with the position of the virtual ammunition. Specifically in terms of interface performance, after the virtual ammunition is launched and the flight time reaches D2, the trajectory line element begins to be displayed along the flight trajectory of the virtual ammunition, and the initial movement speed of the trajectory line element is slow. The trajectory line element starts from the initial movement speed and accelerates at a fixed acceleration until the trajectory line element catches up with the virtual ammunition. After that, the positions of the trajectory line element and the virtual ammunition remain synchronized.
[0126] Among them, the above Figure 4 In the example of the trajectory element chasing the virtual ammunition at a fixed acceleration, in some other embodiments, the trajectory element may also chase the virtual ammunition at a non-fixed acceleration. Figure 5 and Figure 6 ,in, Figure 5 Another time relationship curve diagram related to an embodiment of the present application is shown. Figure 6 A schematic diagram of another time relationship curve involved in an embodiment of the present application is shown.
[0127] according to Figure 5As shown in the time relationship curve 501, specifically in terms of interface performance, after the virtual ammunition is launched and the flight time reaches D2, the trajectory line element begins to be displayed along the flight trajectory of the virtual ammunition, and the initial moving speed of the trajectory line element is slow. The trajectory line element starts from the initial moving speed and accelerates at a gradually increasing acceleration to catch up with the virtual ammunition until the trajectory line element catches up with the virtual ammunition. After that, the positions of the trajectory line element and the virtual ammunition remain synchronized.
[0128] according to Figure 6 As shown in the time relationship curve 601, specifically in terms of interface performance, after the virtual ammunition is launched and the flight time reaches D2, the trajectory line element begins to be displayed along the flight trajectory of the virtual ammunition, and the initial moving speed of the trajectory line element is slow. The trajectory line element starts from the initial moving speed and accelerates at a gradually decreasing acceleration to catch up with the virtual ammunition until the trajectory line element catches up with the virtual ammunition. After that, the positions of the trajectory line element and the virtual ammunition remain synchronized.
[0129] Among them, the embodiments of this application are only based on the above Figures 4 to 6 The time relationship curve shown is used as an example for explanation. Optionally, the above time relationship curve may also have other forms. For example, please refer to Figure 7 , which shows another schematic diagram of a time relationship curve involved in an embodiment of the present application, such as Figure 7 As shown, the portion of the duration relationship curve 701 before D1 is composed of multiple line segments ( Figure 7 Specifically, in terms of interface performance, after the virtual ammunition is launched and the flight time reaches D2, the trajectory element begins to be displayed along the flight trajectory of the virtual ammunition, and the initial moving speed of the trajectory element is slow. Starting from the initial moving speed, the trajectory element accelerates for a period of time according to different accelerations until the trajectory element catches up with the virtual ammunition. After that, the positions of the trajectory element and the virtual ammunition remain synchronized.
[0130] In another possible implementation, when the duration relationship is determined by a duration relationship calculation formula, the duration relationship calculation formula may be an expression formula of the duration relationship curve. For example, the duration relationship calculation formula may be Figures 4 to 7 When obtaining the second duration, the computer device may substitute the first duration into the duration relationship calculation formula to calculate the corresponding second duration.
[0131] In an embodiment of the present application, a time relationship may be pre-set in the computer device, in which, within a period of time from the time when the virtual ammunition is fired, the head position of the trajectory element lags behind the real-time position of the virtual ammunition for a period of time, and the lag period gradually decreases with the passage of time until it is 0; through the above-mentioned time relationship, from the time when the virtual ammunition is fired, the computer device may control the head position of the trajectory element from lagging behind the virtual ammunition to catching up with the virtual ammunition, thereby providing an effect of controlling the trajectory element to move at a slower initial moving speed and gradually accelerating to catch up with the virtual ammunition.
[0132] Step 230d: Display the trajectory line element at the first moment based on the head position.
[0133] In an embodiment of the present application, after determining the head position, the computer device can also determine a position on the previously displayed trajectory line element as the tail position, and display the trajectory line element from the head position to the tail position, so that the head and tail of the linear trajectory line element can match the actual movement trajectory of the virtual ammunition.
[0134] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, the above step 230d can be implemented as the following steps:
[0135] Get the tail position of the trajectory element at the first moment;
[0136] Determine at least one intermediate position on the trajectory line element at a first moment based on the head position and the tail position;
[0137] Based on the head position, the tail position, and at least one intermediate position, a trajectory line element at a first moment is displayed.
[0138] In an embodiment of the present application, after determining the head position and tail position of the trajectory line element at the first moment, the computer device can also determine one or more intermediate positions between the head position and the tail position, and display the trajectory line element starting from the head position, passing through one or more intermediate positions in sequence to reach the tail position. The above is a straight line segment, which can also avoid irregular or unreasonable changes in the shape of the trajectory line element, ensure the rationality of the shape of the trajectory line element, and then ensure that the display effect scheme of the trajectory line element can avoid the trajectory line element always.
[0139] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, the trajectory element is a Bezier curve starting from the head position and sequentially passing through at least one intermediate position to reach the tail position.
[0140] In an embodiment of the present application, the computer device may control the trajectory line element passing through the head position, the tail position, and at least one intermediate position to be a Bezier curve, thereby ensuring the smoothness of the trajectory line element.
[0141] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, determining at least one intermediate position on the trajectory element at the first moment based on the head position and the tail position includes:
[0142] Get the specified curve passing through the head position and the tail position;
[0143] At least one position between the head position and the tail position in the specified curve is obtained as at least one intermediate position.
[0144] The specified curve may be a smooth curve such as a parabola or a conic curve.
[0145] Since the virtual ammunition may be affected by external forces such as gravity when flying in the virtual scene, the flight trajectory of the virtual ammunition may be curved; accordingly, in the embodiment of the present application, after determining the head position and the tail position, the computer device can determine at least one position between the head position and the tail position as an intermediate position from a specified curve passing through the head position and the tail position, thereby more realistically simulating the trajectory of the virtual ammunition flying in the virtual scene, so that the subsequently determined trajectory line elements can truly show the trajectory of the virtual ammunition.
[0146] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, obtaining at least one position between the head position and the tail position in the specified curve as at least one intermediate position includes:
[0147] In the specified curve, at least one position is obtained by dividing a line segment between the head position and the tail position according to a specified ratio, and the position is obtained as at least one intermediate position.
[0148] For example, the computer device can divide the curve segment between the head position and the tail position according to the ratio of 0.7 and 0.4 to obtain two division points, that is, one of the two division points divides the curve segment between the head position and the tail position into two segments of 7:3, and the other division point divides the curve segment between the head position and the tail position into two segments of 4:6; then, the computer device can use the positions of the two division points as the middle position.
[0149] The scheme shown in the above embodiment can ensure the controllability of determining the middle position between the head position and the tail position from the specified curve, and ensure that the middle position determined each time can maintain a fixed ratio with the position between the head position and the tail position, thereby ensuring that the shapes of the trajectory line elements displayed at different times match, avoiding large changes in the shapes of the trajectory line elements displayed at different times, thereby ensuring the display effect of the trajectory line elements.
[0150] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, obtaining the tail position of the trajectory line element at the first moment includes:
[0151] When the distance between the head position and the launching port of the virtual shooting prop is less than the specified distance, the position of the launching port of the virtual shooting prop is acquired as the tail position.
[0152] In the embodiment of the present application, since the movement speed of the trajectory line element is relatively slow in the initial stage, after the virtual shooting prop launches the virtual ammunition, the position of the launching port of the virtual shooting prop will be offset due to factors such as recoil and active movement of the user. Accordingly, if the trajectory line element is displayed strictly according to the flight trajectory of the virtual ammunition in the initial stage of displaying the trajectory line element, a more obvious offset will be caused between the launching port of the virtual shooting prop and the tail position of the trajectory line element, so that when the trajectory line element is displayed near the launching port of the virtual shooting prop, the trajectory line element and the launching port of the virtual shooting prop will not match.
[0153] In this regard, through the scheme shown in the above embodiment, when the distance between the head position and the launching port of the virtual shooting prop is less than the specified distance, it is considered that the trajectory line element has not deviated from the launching port of the virtual shooting prop. At this time, the launching port of the virtual shooting prop can be used as the tail position, so that the tail of the trajectory line element can be offset following the launching port of the virtual shooting prop, ensuring that when the trajectory line element is displayed at the near end of the launching port of the virtual shooting prop, the trajectory line element and the launching port of the virtual shooting prop can maintain a match, thereby ensuring the effect of displaying the trajectory line element at the near end of the launching port of the virtual shooting prop.
[0154] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation, when the distance between the head position and the launch port of the virtual shooting prop is less than a specified distance, the position of the launch port of the virtual shooting prop is obtained as the tail position, including but not limited to any of the following:
[0155] 1) When the distance between the head position and the launch port of the virtual shooting prop is less than a specified distance, the position of the launch port of the virtual shooting prop at the first moment is obtained as the tail position.
[0156] Through the above scheme, when the distance between the head position and the launching port of the virtual shooting prop is less than the specified distance, the computer device can use the current position of the launching port of the virtual shooting prop as the tail position of the trajectory line element. The calculation method is simple and can ensure the display efficiency of the trajectory line element.
[0157] 2) When the distance between the head position and the launching port of the virtual shooting prop is less than the specified distance, the position of the launching port of the virtual shooting prop at the second moment is obtained as the tail position; the second moment is the middle moment between the moment when the virtual shooting prop launches the virtual ammunition and the first moment.
[0158] Through the above scheme, when the distance between the head position and the launch port of the virtual shooting prop is less than the specified distance, the computer device can determine a position between the current position of the launch port of the virtual shooting prop and the launch point position as the tail position of the trajectory line element, thereby avoiding a harsh visual effect when the tail position of the trajectory line element follows the offset of the launch port of the virtual shooting prop, ensuring the smoothness of the tail position of the trajectory line element when following the offset of the launch port of the virtual shooting prop, thereby ensuring the display effect of the trajectory line element.
[0159] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, obtaining the tail position of the trajectory line element includes:
[0160] When the distance between the head position and the launch port of the virtual shooting prop is not less than the specified distance, the tail position is determined in the trajectory line element at a third moment; the third moment is a moment when the trajectory line element is displayed before the first moment.
[0161] In an embodiment of the present application, when the distance between the head position and the launching port of the virtual shooting prop is not less than the specified distance, it can be considered that the trajectory line element has left the launching port of the virtual shooting prop. At this time, the computer device can determine a position from the trajectory line element displayed at the previous moment as the tail position of the trajectory line element at the current moment, so that the tail position of the trajectory line element always remains on the historical movement trajectory of the trajectory line element, avoiding positional offset of the trajectory line element during the movement process, and ensuring the display effect of the trajectory line element.
[0162] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, when the distance between the head position and the launch port of the virtual shooting prop is not less than a specified distance, determining the tail position in the trajectory line element at the third moment includes:
[0163] When the distance between the head position and the launch port of the virtual shooting prop is not less than the specified distance, query the head-tail distance corresponding to the first duration in the first distance relationship; the first distance relationship is used to indicate the relationship between duration and distance;
[0164] The position of the trajectory line element at the third moment, whose distance from the head position is the head-to-tail distance, is determined as the tail position.
[0165] Among them, the distance between the position in the above-mentioned trajectory line element and the head position can refer to the straight-line distance between the position in the trajectory line element and the head position, or it can also be the distance between the position in the trajectory line element and the projection of the head position on a specified plane (such as a horizontal plane).
[0166] In an embodiment of the present application, when the head position has been determined and the trajectory line element has left the launch port of the virtual shooting prop, the length of the trajectory line element can be associated with the flight time of the virtual ammunition, that is, the length of the trajectory line element can change with the change of the flight time of the virtual ammunition. Accordingly, the computer device can determine the length of the trajectory line element displayed at the first moment according to the flight time of the virtual ammunition at the first moment, and determine the tail position of the trajectory line element at the first moment from the trajectory line element at the previous moment according to the length and the head position; through the above scheme, the length of the trajectory line element displayed at various time points during the flight process can be flexibly configured, thereby ensuring the flexibility and controllability of the display effect of the trajectory line element.
[0167] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, the above-mentioned specified distance is the distance corresponding to the first duration in the second distance relationship; the second distance relationship is used to indicate the relationship between the duration and the distance.
[0168] After the virtual shooting prop launches the virtual ammunition, the launch port position may be offset, and the longer the time after launching the virtual ammunition, the greater the offset may be, and the tail position of the trajectory line element will also change with the offset of the launch port position. If a fixed distance threshold is used to determine whether the trajectory line element leaves the launch port of the virtual shooting prop, the offset of the launch port position may lead to a premature determination that the trajectory line element leaves the launch port of the virtual shooting prop, thereby causing a disconnection between the tail of the trajectory line element and the launch port of the virtual shooting prop.
[0169] In this regard, in an embodiment of the present application, the distance threshold used for judging whether the trajectory line element has left the launching port of the virtual shooting prop may also be associated with the flight time of the virtual ammunition. That is to say, the distance threshold used for judging whether the trajectory line element has left the launching port of the virtual shooting prop may change with the change of the flight time of the virtual ammunition, thereby reducing the probability of judging that the trajectory line element has left the launching port of the virtual shooting prop too early and ensuring the display effect of the trajectory line element.
[0170] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, the above method further includes:
[0171] In response to the virtual ammunition hitting any scene element in the virtual scene at the fourth moment, the hitting point position of the virtual ammunition is acquired as the head position of the trajectory line element at the fourth moment.
[0172] Among them, after obtaining the impact point position of the virtual ammunition as the head position of the trajectory line element at the fourth moment, the computer device can also re-determine the tail position of the trajectory line element at the fourth moment. For example, the computer device can determine the tail position of the trajectory line element at the fourth moment according to the method of determining the tail position involved in the above-mentioned embodiments, and then determine one or more intermediate points between the head position and the tail position at the fourth moment, and calculate a curve starting from the head position through one or more intermediate points to the tail position as the trajectory line element at the fourth moment.
[0173] In an embodiment of the present application, when the virtual ammunition hits any scene element, the position of the hit point needs to be immediately displayed to the user. Since the head position of the trajectory line element lags behind the virtual ammunition in the early stage after the virtual ammunition is fired, if the virtual ammunition hits any scene element in the virtual scene at this time, the trajectory line element will appear to be still flying. In this regard, in an embodiment of the present application, when the virtual ammunition hits any scene element, the computer device can immediately adjust the head position of the trajectory line element to the hit point position of the virtual ammunition, so that the display position of the trajectory line element matches the position of the hit point of the virtual ammunition, thereby ensuring the display accuracy of the trajectory line element when hitting.
[0174] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, the starting point position of the head of the trajectory element is located at the position of the launching port of the virtual shooting prop when the virtual shooting prop launches virtual ammunition.
[0175] Since the actual movement trajectory of the virtual ammunition will be calculated when it is fired, and by the time the trajectory line element needs to be rendered, a rendering frame has passed, this results in the trajectory line element observed by the user being away from the launch port of the virtual shooting prop when the virtual ammunition is fired, resulting in a one-frame separation between the launch port of the virtual shooting prop and the trajectory line element.
[0176] Through the scheme shown in the embodiment of the present application, the starting point of the trajectory line element can be directly set to the position of the launching port of the virtual shooting prop, thereby ensuring that there is no disconnection between the launching port of the virtual shooting prop and the trajectory line element, thereby ensuring the display effect of the trajectory line element.
[0177] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, displaying the trajectory line element of the virtual ammunition includes:
[0178] Get the observation distance, which is the distance between the camera position and the trajectory element; the camera position is the position of the camera that renders the virtual scene;
[0179] Get the display properties of the trajectory line element based on the observation distance;
[0180] Displays track line elements based on display properties.
[0181] Among them, the correspondence between the observation distance and the display attributes can be pre-set in the computer device (for example, the correspondence can be expressed in the form of a table, a curve or a calculation formula). When displaying the trajectory line element, the computer device can obtain the current display attributes of the trajectory line element based on the observation distance and the correspondence between the observation distance and the display attributes, and display the trajectory line element through the current display attributes.
[0182] In an embodiment of the present application, when displaying a trajectory line element, the computer device can determine the display properties of the trajectory line element according to the distance between the current camera position and the trajectory line element, thereby simulating different visual effects of observing the trajectory line element at different distances, thereby ensuring the authenticity of the display of the trajectory line element.
[0183] Based on the solutions shown in any one or more of the above embodiments, in a possible implementation manner, the display attribute includes one or more of the following attributes: brightness, display size, and transparency.
[0184] The display size may include at least one of length and width.
[0185] The scheme shown in the above-mentioned embodiment of the present application can be applied to shooting virtual scenes or other types of virtual scenes with shooting gameplay; taking the virtual ammunition in the virtual scene as a virtual bullet as an example, through the above-mentioned scheme, the virtual bullet fired in the virtual scene can be split into logical bullets (that is, the above-mentioned virtual ammunition) and performance bullets (or called bullet lines, that is, the above-mentioned trajectory line elements), and the flight process of the performance bullets is redistributed. Under the premise of not affecting the logical bullets, the speed of the bullet line at the near end of the launch point (that is, within the close distance of the launch point) is slowed down, the display time becomes longer, and the flight speed of the bullet line at medium and long distances becomes faster, so that players can feel a stronger dynamic impact of the bullet flight when experiencing shooting, thereby improving the performance effect of the virtual bullet.
[0186] Please refer to Figure 8 , which shows a control logic diagram of a virtual bullet provided by an exemplary embodiment of the present application. Figure 8 As shown, taking the application scenario of the solution shown in the above embodiment of the present application in a shooting game as an example, the control logic of the virtual bullet may include the following steps:
[0187] Step S801, detecting that the virtual shooting prop has fired.
[0188] Step S802, control logic bullet to shoot out.
[0189] Step S803, determine whether the logical bullet hits the target; if so, proceed to step S807, otherwise end and proceed to step S804.
[0190] Step S804, controlling the bullet to be fired.
[0191] In an embodiment of the present application, after the logical bullet has been shot out for a period of time, the computer device may control the shooting out of the performance bullet (bullet line), thereby simulating the effect that the initial speed of the performance bullet is slower than that of the logical bullet.
[0192] Step S805, determine whether the logical bullet hits the target; if so, proceed to step S807, otherwise proceed to step S806.
[0193] Step S806, according to the configured relationship curve, control the performance bullet to gradually accelerate and catch up with the logical bullet.
[0194] Step S807, returning hit information.
[0195] When the computer device determines that the logic bullet hits the target, it can obtain the hit position of the logic bullet.
[0196] Step S808, setting the current head position of the bullet.
[0197] When the computer device determines that the logical bullet hits the target, the head position of the bullet can be immediately set to the hit position of the logical bullet.
[0198] Among them, before the display bullet is fired, if the logical bullet has hit the target, at this time, the computer device can also immediately set the head position of the display bullet to the hit position of the logical bullet, that is, directly display the bullet line when hitting the target.
[0199] Step S809, showing that the position of the tail of the bullet is transitioned according to the configuration fitting.
[0200] Specifically, the above scheme can split the position and time relationship of the logical bullet and the performance bullet. Under the premise of not affecting the actual flight, logical calculation and functional judgment of the logical bullet, the visual dynamics and impact of the performance bullet can be greatly enhanced by adjusting and allocating the position and time relationship of the performance bullet relative to the logical bullet.
[0201] Among them, through the above scheme, after the virtual bullet is fired, it has the following characteristics in terms of performance:
[0202] 1) The relationship between logical bullets and the position and time of performance bullets.
[0203] In this solution, a certain amount of position information of the logical bullet is passed to the control logic of the performance bullet every second, so that the control logic of the performance bullet can know the relationship between the time and position information of the logical bullet, and then determine the position of the performance bullet at each time through a configurable curve TailingTimeCurve.
[0204] For example, the horizontal axis of the above curve represents the flight time of the bullet; the vertical axis represents the position of the logical bullet at the corresponding time. For example, the curve can be the above Figures 4 to 7 Any of the curves shown. For example, taking the coordinates (0.25, 0.2) on the curve as an example, it means that the bullet flies to the position of the logical bullet 0.2s after it is fired at 0.25s after the logical bullet is fired.
[0205] Through the above curve, the position relationship between the performance bullet and the logical bullet can be freely allocated. Through pre-configuration, the display effect of the performance bullet being slow at first and then fast can be achieved, and even the latter part can be accelerated to exceed the flight speed of the logical bullet until it catches up with the logical bullet.
[0206] The bullet in the above solution is specifically displayed as an elastic line, and the display position of the elastic line can be determined in the following way:
[0207] Each elastic line contains four points for determining the position of the elastic line. These points can be set to corresponding world coordinates (X, Y, Z) in the particle system. Through the continuous parameter transmission of the logical bullet, the presentation bullet can continuously obtain the position of the logical bullet in the world coordinates. By setting the world coordinates of the head position of the elastic line, the position relationship between the logical bullet and the presentation bullet can be configured.
[0208] 2) Set the starting point of the bullet to the muzzle to solve the problem of missing the first frame of the bullet when shooting.
[0209] The solution provided by the present application can directly solve the problem of not displaying the position of the logical bullet in the first frame, because the logical bullet and the presentation bullet are unbound. Specifically, the present solution sets the starting point of the presentation bullet directly to the muzzle position, that is, the presentation bullet uses the muzzle position as the starting point to chase the position of the logical bullet, thereby solving the problem of not rendering the presentation bullet in the first frame after the logical bullet is fired.
[0210] 3) Elastic line deflection mechanism.
[0211] Since the starting point of the bullet is the muzzle, during the game, if the position of the muzzle changes immediately after the logical bullet is fired, the bullet needs to be deflected to a certain extent to fit the actual logical bullet position and the muzzle position.
[0212] For details, please refer to Fig. 9 , which shows a schematic diagram of the deflection of a bullet (elastic line) involved in the present application. Fig. 9 As shown, at the beginning of the logical bullet launch, when the bullet just starts to be displayed, the head of the bullet is close to the muzzle position 901. At this time, the muzzle position shifts, and the tail of the bullet 902 also shifts with the muzzle position. For details, please refer to Fig.10 , which shows a schematic diagram of an elastic line involved in an embodiment of the present application. Fig.10 As shown, the entire elastic line will be set to four points. Point 1001 at the head continuously fits the real logical bullet position through the curve, point 1002 at the tail fits the shooting point, and the positions of middle points 1003 and 1004 are calculated from the positional relationship between the head and the tail, and are used to change the curvature of the entire elastic line to smooth the flight process of the entire elastic line.
[0213] Specifically, in a virtual scene, the elastic line is usually not a straight line, but a deflected curve. The deflection of the elastic line can be achieved in the following ways:
[0214] Please refer to Fig.11 , which shows another elastic line schematic diagram involved in the embodiment of the present application. Fig.11As shown, the entire performance line is composed of four points. After the positions 1101 and 1102 of the head and tail are determined, the middle points 1103 and 1104 will be pre-set with a point ratio relationship; for example, point 1103 divides the entire line into two parts of 3:7, and point 1104 divides the entire line into two parts of 7:3; the computer device can adjust the horizontal ratio relationship according to the above ratio to confirm the final coordinates of the four points. Afterwards, the computer device draws a Bezier curve through the above four points, thereby generating a smooth curve during rendering, so that when there is a horizontal position difference between the head and tail of the bullet, the entire curve looks smooth.
[0215] 4) The simulation end and the main control end of the bullet are separated.
[0216] In shooting games, players may also need to know the real-time positions of bullets fired by other virtual objects, which requires consistency between logical bullets and presentational bullets. On this basis, the solution shown in this application splits the configuration of the main control end and the simulation end. The presentational bullets of the simulation end will match the positions of the logical bullets to ensure uniformity of the gameplay.
[0217] 5) Various parameters of the bullet (bullet line) change with the distance of the camera position.
[0218] In the solution provided in the present application, the brightness, transparency, size, length and other relevant performance parameters of the bullet (elastic line) can change with the distance between the bullet line and the rendering camera.
[0219] That is to say, different players standing in different positions may see the same elastic line with different appearances.
[0220] The above parameters include but are not limited to the following:
[0221] Brightness parameters: including minimum display distance, maximum display distance, minimum distance brightness, maximum distance brightness, etc.; the relationship between distance and brightness can be represented by a proportional relationship matching curve, where the horizontal axis of the proportional relationship matching curve can be the distance ratio and the vertical axis can be the brightness ratio.
[0222] Parameters of elastic line size: including minimum display distance, maximum display distance, minimum distance size, maximum distance size, etc.; the relationship between distance and elastic line size can be represented by a proportional relationship matching curve, wherein the horizontal axis of the proportional relationship matching curve can be a distance ratio and the vertical axis can be a size ratio. The elastic line size here can refer to the width of the elastic line.
[0223] Elastic line transparency parameters: including minimum display distance, maximum display distance, minimum distance transparency, maximum distance transparency, etc.; the relationship between distance and transparency can be represented by a proportional relationship matching curve, wherein the horizontal axis of the proportional relationship matching curve can be a distance ratio, and the vertical axis can be a transparency ratio.
[0224] Length parameters: including minimum display distance, maximum display distance, minimum distance length, maximum distance length, etc.; the relationship between distance and length can be represented by a proportional relationship matching curve, wherein the horizontal axis of the proportional relationship matching curve can be the distance ratio and the vertical axis can be the length ratio.
[0225] Through the above scheme, based on the coordinate information sent back by the bullet in the world, the computer device can calculate the distance relationship with the rendering camera, and hand over the result to the respective particle system for processing, and finally adjust the changes in the field of view of different players of the same bullet in real time.
[0226] 6) Special processing of hit information.
[0227] Because in the scheme shown in the above embodiment of the present application, the position of the presentation bullet does not fit the position of the logical bullet most of the time, when the logical bullet hits, but the presentation bullet has not caught up with the logical bullet, it will visually appear as if the virtual bullet has not reached the target, while the target has been damaged by the virtual bullet.
[0228] In order to circumvent the above problems, in an embodiment of the present application, when the logical bullet hits, it will return a hit position information, and the position information will be sent to the control logic of the performance bullet. Subsequently, the control logic of the performance bullet will directly synchronize the head position of the performance bullet to the hit position of the logical bullet, while the tail position will still be fitted according to the existing trajectory. In this way, the unity of performance and logic is achieved. Through the above scheme, the hit logic of the logical bullet itself is not destroyed, and the performance effect of the performance bullet is guaranteed.
[0229] Among them, the judgment principle of logical bullet hit can be as follows:
[0230] Please refer to Fig.12 , which shows a shooting schematic diagram involved in this application. Fig.12 As shown, taking a shooting game as an example, when the player presses the fire button, an invisible sphere 1202 with a certain collision size will be launched from the muzzle 1201, and the sphere 1202 will fly along the extension line 1203 of the muzzle position according to the set physical rules and flight speed.
[0231] Please refer to Fig.13 , which shows a schematic diagram of the role capsule involved in this application. Fig.13 The sphere in Fig.13 When the capsule 1301 collides with a certain part of the character in the sphere (overlaps), it is determined that the virtual bullet hits the part of the character corresponding to the capsule 1301. At this time, according to the overlapping position of the sphere and the capsule 1301, the position of the hit position in the character coordinate system (relative to the position of the character) can be calculated, and the position in the character coordinate system is converted into the world coordinate position, so that the hit position of the virtual bullet can be obtained.
[0232] There are a lot of high-speed bullets or projectiles in many shooting games. How to express such projectiles has always been a pain point in shooting games. If the performance is completely based on logical bullets, the performance of such bullets is very weak for players. The solution shown in the above embodiment of the present application can well solve the problem that the bullet line in such games is difficult to have strong dynamic performance.
[0233] Please refer to Fig.14 , which shows a structural block diagram of an element display device for a virtual scene provided by an exemplary embodiment of the present application, the control device includes:
[0234] The object display module 1401 is used to display a virtual object in a virtual scene, wherein the virtual object is equipped with a virtual shooting prop;
[0235] The object control module 1402 is used to control the virtual object to use the virtual shooting prop to fire virtual ammunition;
[0236] The element display module 1403 is used to display the trajectory element of the virtual ammunition, where the trajectory element is a linear element used to indicate the flight trajectory of the virtual ammunition, and the initial moving speed of the trajectory element is less than the moving speed of the virtual ammunition.
[0237] In a possible implementation manner, before the head position of the trajectory element coincides with the position of the virtual ammunition, the moving speed of the trajectory element is positively correlated with the flight time of the virtual ammunition.
[0238] In a possible implementation manner, after the head position of the trajectory element coincides with the position of the virtual ammunition, the moving speed of the trajectory element is the same as the moving speed of the virtual ammunition.
[0239] In a possible implementation, the first length of the trajectory element is greater than the second length of the trajectory element;
[0240] Wherein, the first length is the length of the trajectory element before the head position of the trajectory element coincides with the position of the virtual ammunition;
[0241] The second length is the length of the trajectory element after the head position of the trajectory element coincides with the position of the virtual ammunition.
[0242] In a possible implementation, the element display module 1403 is used to:
[0243] Acquire a first duration, where the first duration is the flight duration of the virtual ammunition at a first moment;
[0244] In querying the duration relationship, a second duration corresponding to the first duration, the second duration being less than or equal to the first duration; the duration relationship is used to indicate the relationship between two durations;
[0245] The position of the virtual ammunition at the moment when the flight time is the second time length is acquired as the head position of the trajectory element at the first moment;
[0246] The trajectory line element at the first moment is displayed based on the head position.
[0247] In a possible implementation, the element display module 1403 is used to:
[0248] Obtaining the tail position of the trajectory line element at the first moment;
[0249] Determine at least one intermediate position on the trajectory line element at the first moment based on the head position and the tail position;
[0250] The trajectory line element at the first moment is displayed based on the head position, the tail position, and the at least one intermediate position.
[0251] In a possible implementation manner, the trajectory element is a Bezier curve starting from the head position and sequentially passing through the at least one intermediate position to reach the tail position.
[0252] In a possible implementation, the element display module 1403 is used to:
[0253] Acquire a specified curve passing through the head position and the tail position;
[0254] At least one position between the head position and the tail position in the specified curve is acquired as the at least one intermediate position.
[0255] In a possible implementation, the element display module 1403 is used to obtain at least one position in the specified curve, where a line segment between the head position and the tail position is divided according to a specified ratio, and obtain the at least one intermediate position.
[0256] In a possible implementation, the element display module 1403 is used to obtain the position of the launching port of the virtual shooting prop as the tail position when the distance between the head position and the launching port of the virtual shooting prop is less than a specified distance.
[0257] In a possible implementation, the element display module 1403 is used to:
[0258] When the distance between the head position and the launching port of the virtual shooting prop is less than a specified distance, obtaining the position of the launching port of the virtual shooting prop at the first moment as the tail position;
[0259] Alternatively, when the distance between the head position and the launching port of the virtual shooting prop is less than a specified distance, the position of the launching port of the virtual shooting prop at a second moment is obtained as the tail position; the second moment is the middle moment between the moment when the virtual shooting prop launches the virtual ammunition and the first moment.
[0260] In one possible implementation, the element display module 1403 is used to determine the tail position in the trajectory line element at a third moment when the distance between the head position and the launching port of the virtual shooting prop is not less than a specified distance; the third moment is the moment when the trajectory line element is displayed before the first moment.
[0261] In a possible implementation, the element display module 1403 is used to:
[0262] When the distance between the head position and the launch port of the virtual shooting prop is not less than a specified distance, querying the head-to-tail distance corresponding to the first duration in the first distance relationship; the first distance relationship is used to indicate the relationship between duration and distance;
[0263] A position in the trajectory line element at the third moment, the position of which the distance from the head position is the head-to-tail distance, is determined as the tail position.
[0264] In a possible implementation manner, the specified distance is a distance corresponding to the first duration in a second distance relationship; the second distance relationship is used to indicate a relationship between duration and distance.
[0265] In a possible implementation manner, the device further includes:
[0266] The position acquisition module is used for acquiring the hitting point position of the virtual ammunition as the head position of the trajectory element at the fourth moment in response to the virtual ammunition hitting any scene element in the virtual scene at the fourth moment.
[0267] In a possible implementation, the starting point of the head of the trajectory element is located at the position of the launching port of the virtual shooting prop when the virtual shooting prop launches virtual ammunition.
[0268] In a possible implementation, the element display module 1403 is used to:
[0269] Acquire an observation distance, where the observation distance is the distance between a camera position and the trajectory element; the camera position is the position of a camera that renders the virtual scene;
[0270] Acquiring display properties of the trajectory line element based on the observation distance;
[0271] The trajectory line element is displayed based on the display attribute.
[0272] In a possible implementation, the display attribute includes one or more of the following attributes:
[0273] Brightness, display size, transparency.
[0274] One point that needs to be explained is that the device provided in the above embodiment only uses the division of the above-mentioned functional modules as an example to implement its functions. In actual applications, the above-mentioned functions can be assigned to different functional modules according to actual needs, that is, the content structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0275] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method; the technical effects achieved by each module performing operations are the same as those in the embodiment of the method, and will not be elaborated here.
[0276] Please refer to Fig.15 , which shows a structural block diagram of a computer device provided by an exemplary embodiment of the present application.
[0277] The computer device 1500 may be a portable mobile terminal, such as a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), or an MP4 player (Moving Picture Experts Group Audio Layer IV). The computer device 1500 may also be called a user device, a portable terminal, or other names.
[0278] Typically, the computer device 1500 includes a processor 1501 and a memory 1502 .
[0279] The processor 1501 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc.
[0280] The memory 1502 may include one or more computer-readable storage media, which may be tangible and non-transitory. The memory 1502 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1502 is used to store at least one instruction, which is used to be executed by the processor 1501 to implement the element display method for a virtual scene provided in the embodiments of the present application.
[0281] In some embodiments, the computer device 1500 may further include: a peripheral device interface 1503 and at least one peripheral device. Specifically, the peripheral device includes: at least one of a radio frequency circuit 1504 , a touch display screen 1505 , a camera 1506 , an audio circuit 1507 and a power supply 1508 .
[0282] In some embodiments, the computer device 1500 further includes one or more sensors 1509 , including but not limited to: an acceleration sensor 1510 , a gyroscope sensor 1511 , a pressure sensor 1512 , an optical sensor 1513 , and a proximity sensor 1514 .
[0283] Those skilled in the art will understand that Fig.15 The structure shown in the figure does not constitute a limitation on the computer device 1500, and the computer device 1500 may include more or less components than shown in the figure, or combine some components, or adopt a different arrangement of components.
[0284] In an exemplary embodiment, an embodiment of the present application provides a chip, which includes a programmable logic circuit and / or program instructions. When the chip runs on a computer device, it is used to implement the element display method for a virtual scene provided in the above method embodiment.
[0285] An embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program is loaded and executed by a processor to implement the element display method for a virtual scene provided in the above method embodiment.
[0286] The embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, so that the processor loads and executes to implement the element display method for a virtual scene provided in the above method embodiment.
[0287] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0288] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned computer-readable storage medium may be a read-only memory, a disk or an optical disk, etc.
[0289] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0290] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for displaying elements of a virtual scene, characterized in that: The method comprises: Displaying a virtual object in a virtual scene, wherein the virtual object is equipped with a virtual shooting prop; Controlling the virtual object to use the virtual shooting prop to fire virtual ammunition; A trajectory line element of the virtual ammunition is displayed, where the trajectory line element is a line element for indicating a flight trajectory of the virtual ammunition, and an initial moving speed of the trajectory line element is less than a moving speed of the virtual ammunition.
2. The method according to claim 1, characterized in that Before the head position of the trajectory element coincides with the position of the virtual ammunition, the moving speed of the trajectory element is positively correlated with the flight duration of the virtual ammunition.
3. The method according to claim 2, characterized in that After the head position of the trajectory element coincides with the position of the virtual ammunition, the moving speed of the trajectory element is the same as the moving speed of the virtual ammunition.
4. The method according to claim 2, characterized in that The first length of the trajectory element is greater than the second length of the trajectory element; The first length is the length of the trajectory element before the head position of the trajectory element coincides with the position of the virtual ammunition; The second length is the length of the trajectory element after the head position of the trajectory element coincides with the position of the virtual ammunition.
5. The method according to claim 2, characterized in that The trajectory line element of the virtual ammunition is displayed, including: Acquire a first duration, where the first duration is a flight duration of the virtual ammunition at a first moment; In querying the duration relationship, a second duration corresponding to the first duration, the second duration being less than or equal to the first duration; the duration relationship is used to indicate the relationship between two durations; Obtaining the position of the virtual ammunition at the moment when the flight time is the second time length as the head position of the trajectory element at the first moment; The trajectory line element at the first moment is displayed based on the head position.
6. The method according to claim 5, characterized in that The displaying of the trajectory line element at the first moment based on the head position includes: Obtaining the tail position of the trajectory line element at the first moment; determining at least one intermediate position on the trajectory element at the first moment based on the head position and the tail position; The trajectory line element at the first moment is displayed based on the head position, the tail position, and the at least one intermediate position.
7. The method according to claim 6, characterized in that The trajectory element is a Bezier curve that starts from the head position, passes through the at least one intermediate position in sequence, and reaches the tail position.
8. The method according to claim 6, characterized in that The determining, based on the head position and the tail position, at least one intermediate position on the trajectory line element at the first moment includes: Acquire a specified curve passing through the head position and the tail position; At least one position between the head position and the tail position in the specified curve is obtained as the at least one intermediate position.
9. The method according to claim 8, characterized in that The acquiring at least one position between the head position and the tail position in the specified curve as the at least one intermediate position includes: In the specified curve, at least one position obtained by dividing a line segment between the head position and the tail position according to a specified ratio is obtained as the at least one intermediate position.
10. The method according to claim 6, characterized in that The obtaining the tail position of the trajectory line element at the first moment includes: When the distance between the head position and the launching port of the virtual shooting prop is less than a specified distance, the position of the launching port of the virtual shooting prop is obtained as the tail position.
11. The method according to claim 10, characterized in that When the distance between the head position and the launch port of the virtual shooting prop is less than a specified distance, obtaining the position of the launch port of the virtual shooting prop as the tail position includes: When the distance between the head position and the launching port of the virtual shooting prop is less than a specified distance, obtaining the position of the launching port of the virtual shooting prop at the first moment as the tail position; or, When the distance between the head position and the launching port of the virtual shooting prop is less than a specified distance, the position of the launching port of the virtual shooting prop at a second moment is obtained as the tail position; the second moment is a moment midway between the moment when the virtual shooting prop launches virtual ammunition and the first moment.
12. The method according to claim 6, characterized in that The obtaining of the tail position of the trajectory line element includes: When the distance between the head position and the launch port of the virtual shooting prop is not less than a specified distance, the tail position is determined in the trajectory line element at a third moment; the third moment is a moment when the trajectory line element is displayed before the first moment.
13. The method according to claim 12, characterized in that The step of determining the tail position in the trajectory line element at the third moment when the distance between the head position and the launch port of the virtual shooting prop is not less than a specified distance comprises: When the distance between the head position and the launch port of the virtual shooting prop is not less than a specified distance, querying the head-to-tail distance corresponding to the first duration in a first distance relationship; the first distance relationship is used to indicate the relationship between duration and distance; A position in the trajectory line element at the third moment, the position of which the distance from the head position is the head-to-tail distance, is determined as the tail position.
14. The method according to any one of claims 10 to 13, characterized in that: The specified distance is a distance corresponding to the first duration in a second distance relationship; the second distance relationship is used to indicate a relationship between duration and distance.
15. The method according to any one of claims 5 to 13, characterized in that: The method further comprises: In response to the virtual ammunition hitting any scene element in the virtual scene at a fourth moment, the hitting point position of the virtual ammunition is obtained as the head position of the trajectory element at the fourth moment.
16. The method according to any one of claims 1 to 13, characterized in that The starting point of the head of the trajectory element is located at the position of the launching port of the virtual shooting prop when the virtual shooting prop launches virtual ammunition.
17. The method according to any one of claims 1 to 13, characterized in that The trajectory line element of the virtual ammunition is displayed, including: Acquire an observation distance, where the observation distance is the distance between a camera position and the trajectory element; the camera position is the position of a camera that renders the virtual scene; Acquiring display attributes of the trajectory line element based on the observation distance; The trajectory line element is displayed based on the display attribute.
18. The method according to claim 17, characterized in that The display attributes include one or more of the following attributes: Brightness, display size, transparency.
19. An element display device for a virtual scene, characterized in that: The device comprises: An object display module, configured to display a virtual object in a virtual scene, wherein the virtual object is equipped with a virtual shooting prop; An object control module, configured to control the virtual object to use the virtual shooting prop to fire virtual ammunition; The element display module is used to display the trajectory element of the virtual ammunition, where the trajectory element is a linear element used to indicate the flight trajectory of the virtual ammunition, and the initial moving speed of the trajectory element is less than the moving speed of the virtual ammunition.
20. A computer device, characterized in that: The computer device includes: a processor and a memory, the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the element display method for a virtual scene according to any one of claims 1 to 18.
21. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the element display method for a virtual scene according to any one of claims 1 to 18.
22. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. The processor obtains the computer instructions from the computer-readable storage medium, so that the processor loads and executes them to implement the element display method for a virtual scene as described in any one of claims 1 to 18.
