Data processing method and apparatus, and device and storage medium
By exponentially processing the rotation angular velocity of the rotating object between frames, the data overflow problem caused by the calculation of the direction parameters of the rotating object in the game is solved, and the smoothness and accuracy of the game are improved.
Patent Information
- Application Number
- PCT/CN2023/129574
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-21
- Filing Date
- 2023-11-03
- Publication Date
- 2024-08-29
AI Technical Summary
The calculation of the direction parameters of rotating objects in the game scene can easily lead to data overflow and game interruption.
By obtaining the inter-frame interval between two game frames of the rotating object, the rotation angular velocity is exponentially processed to obtain the target rotation angle, and the direction parameters of the rotating object are updated according to the initial direction parameters to ensure that they are within the controllable value of the physics engine. within the interval.
It avoids data overflow and game interruption, and improves the smoothness of the game and the accuracy of the direction parameters.
Smart Images

Figure CN2023129574_29082024_PF_FP_ABST
Abstract
Description
Data processing method, device, equipment and storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on February 21, 2023, with application number 2023101865760 and application name “Data processing method, device, equipment and storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to fields such as Internet technology, and in particular to a data processing method, apparatus, device and storage medium. Background Art
[0003] Game scenes often contain rotating objects. When rendering a game frame that includes a rotating object, the object's orientation parameters must be calculated in real time. This orientation parameter is then used to render the game frame. In practice, the current method for calculating the orientation parameters of rotating objects is prone to data overflow, which can cause game interruptions.
[0004] Summary of the Invention
[0005] Embodiments of the present application provide a data processing method, apparatus, device, and storage medium to avoid data overflow and game interruption caused by data overflow.
[0006] An embodiment of the present application provides a data processing method, including:
[0007] Obtaining a first direction parameter and a rotational angular velocity of the target object in a first game frame, and an inter-frame interval duration between the first game frame and a second game frame; the rendering order of the second game frame is after the rendering order of the first game frame;
[0008] Exponentially processing the rotational angular velocity according to the inter-frame interval duration to obtain a target rotation angle of the target object;
[0009] A second direction parameter of the target object in the second game frame is determined according to the target rotation angle of the target object and the first direction parameter.
[0010] An embodiment of the present application provides a data processing device, including:
[0011] an acquisition module, configured to acquire a first direction parameter and a rotational angular velocity of a target object in a game engine in a first game frame, and an inter-frame interval duration between the first game frame and a second game frame; the rendering order of the second game frame is after the rendering order of the first game frame;
[0012] a processing module, configured to perform exponential processing on the rotational angular velocity according to the inter-frame interval duration to obtain a target rotation angle of the target object;
[0013] A determination module is configured to determine a second direction parameter of the target object in the second game frame according to the target rotation angle of the target object and the first direction parameter.
[0014] On one hand, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0015] On one hand, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0016] On one hand, an embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0017] In the present application, in order for the physics engine to be able to represent the initial direction parameter (i.e., the first direction parameter of the rotating object in the first game frame), the inter-frame interval duration, and the rotational angular velocity of the rotating object (i.e., the target object), the initial direction parameter, the inter-frame interval duration, and the rotational angular velocity are all within a numerical range controllable by the physics engine. When it is necessary to update the initial direction parameter of the rotating object, the computer device can perform exponential processing on the rotational angular velocity of the rotating object by the inter-frame interval duration between each two game frames (the first game frame and the second game frame) to obtain the target rotation angle of the target object. Based on the exponential processing principle, it can be seen that the exponential processing is equivalent to performing cosine, sine, etc. processing on the product of the rotational angular velocity and the inter-frame interval duration. It can be seen that by exponentially processing the rotational angular velocity through the inter-frame interval duration, the target rotation angle obtained by the exponential processing can be limited to a numerical range controllable by the physical engine. Furthermore, based on the target rotation angle and the initial direction parameter of the rotating object, the updated direction parameter (i.e., the second direction parameter) of the rotating object is determined to also belong to the numerical range controllable by the physical engine, that is, the updated direction parameter can be represented by the physical engine in the computer device, which can avoid data overflow and game interruption caused by data overflow, thereby improving the smoothness of the game. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0019] FIG1 is a schematic diagram of a direction parameter determination system provided by the present application;
[0020] FIG2 is a schematic diagram of an interactive scenario of a data processing method provided by the present application;
[0021] FIG3 is a flow chart of a data processing method provided by the present application;
[0022] FIG4 is a flow chart of a data processing method provided by the present application;
[0023] FIG5 is a schematic structural diagram of a data processing device provided in an embodiment of the present application;
[0024] FIG6 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0026] To facilitate a clearer understanding of the present application, we first introduce a directional parameter determination system for implementing the present application. As shown in FIG1 , the directional parameter determination system includes a server 10 and a terminal cluster. The terminal cluster may include one or more terminals, and the number of terminals is not limited here. As shown in FIG1 , the terminal cluster may specifically include terminal 1, terminal 2, ..., terminal n; it is understood that terminal 1, terminal 2, terminal 3, ..., terminal n can all be connected to the server 10 via a network connection, so that each terminal can exchange data with the server 10 via the network connection.
[0027] One or more target applications are installed in the terminal. The target application here may refer to a game application. For example, the target application may include an independent application program, a web application, a mini-program in a host application, etc.
[0028] The server 10 refers to a device that provides backend services for a target application in a terminal. In one embodiment, the server can be used to obtain direction parameters of a rotating object, render a game frame according to the direction parameters, and return the game frame to the terminal.
[0029] It should be noted that the rotating object in this application can refer to a rigid body in a physics engine. A rigid body refers to an object that does not deform, can rotate, and can move. In other words, a rotating object can refer to a game object in a game scene that does not deform, can rotate, and can move. For example, game objects can include game characters (such as virtual characters, virtual animals, virtual robots, etc.), game props (such as virtual Ferris wheels, virtual flying discs), and so on. A physics engine can refer to a computer software development kit that calculates motion, rotation, and collision by assigning realistic physical properties to rotating objects. This physics engine can be deployed in a terminal or a server and is a functional module in a game engine.
[0030] It's important to note that the physics engine can use either fixed-point or floating-point representations to represent values such as the orientation parameters and rotation angles of rotating objects. Fixed-point representations: The position of the decimal point is fixed and agreed upon in the computer's storage. The integer and decimal parts of a decimal are converted to binary representations, and the sum of the number of bits representing the decimal and the integer cannot exceed the number of bits in the computer. For example, in an 8-bit computer, the first five digits represent the integer part of a decimal, and the last three digits represent the decimal part. The decimal point is placed after the fifth digit by default. Therefore, in an 8-bit computer, the integer part 11111 can only represent a maximum of 31 in decimal; the decimal part 0.111 can only represent a maximum of 0.875. In other words, the range of representable values in an 8-bit computer is [0, 31.875].
[0031] Floating-point number representation refers to numbers with an unfixed decimal point position; they contain both a fractional and integer components. In computing, floating-point numbers are typically divided into an exponent (also called an exponent) and a mantissa. The exponent is represented by a binary fixed-point integer, while the mantissa is represented by a binary fixed-point decimal. The length of the exponent determines the range of the value, while the length of the mantissa determines the precision of the value. For example, in a 16-bit computer, the decimal value 178.125 can be converted to binary as 10110010 001, where 10110010 represents the integer portion of 178.125 and 001 represents the fractional portion. Alternatively, the decimal value 178.125 can be represented as 10110010001 multiplied by 2 to the power of 111 (111 is the binary representation of 7). 10110010001 is the mantissa of 178.125, and 111 is the exponent of 178.125.
[0032] As can be seen, floating-point representations offer diverse representations and a wider range of representable values; fixed-point representations offer a fixed representation and can be applied to cross-platform data synchronization scenarios. Cross-platform data synchronization scenarios involve data synchronization between game applications running on different operating systems. For example, terminal A runs game application A on Android, corresponding to game character A, while terminal B runs game application A on iOS. Terminal A can display game frame 1, which includes game character A, obtain player-generated operation data for game character A, and synchronize this operation data to terminal B. Terminals A and B can each determine the rotational angular velocity of game character A based on this operation data, obtain the interframe interval duration between game frame 1 and game frame 2, and the first directional parameter of game character A in game frame 1. Based on this rotational angular velocity and interframe interval duration, the first directional parameter is updated to obtain the second directional parameter of game character A in game frame 2. Both Terminal A and Terminal B represent the second directional parameters of the game character in game frame 2 using a fixed-point representation. Since the fixed-point representation method has a fixed form, the second directional parameters obtained by Terminal A and Terminal B are identical. This ensures that the movement of the game character displayed by Terminal A and Terminal B remains consistent. This also avoids synchronizing a large number of object states (such as directional parameters, rotational angular velocity, etc.) between different terminals, saving data traffic. In other words, the fixed-point representation method ensures data consistency in cross-platform data synchronization scenarios.
[0033] In other words, the computer device can select the numerical representation method in the physics engine based on whether the game scene requires cross-platform data synchronization. For example, in multiplayer online game applications, corresponding terminal synchronization data between different game players is usually required. Therefore, it can be determined that cross-platform data synchronization is required in multiplayer online game applications. In this case, the computer device can determine a fixed-point number-based representation method as the numerical representation method for the physics engine. In stand-alone game applications, corresponding terminal synchronization data between game players is usually not required. Therefore, it can be determined that cross-platform data synchronization is not required in stand-alone game applications. In this case, the computer device can determine a fixed-point number-based representation method or a floating-point number-based representation method as the numerical representation method for the physics engine.
[0034] The present application mainly relates to a game scene, which may refer to a cloud game scene or an ordinary game scene. A cloud game scene refers to a game scene based on cloud gaming. Cloud gaming (Cloud gaming) can also be called gaming on demand, which is an online gaming technology based on cloud computing technology. Cloud gaming technology enables thin clients with relatively limited graphics processing and data computing capabilities to run high-quality games. In a cloud gaming scenario, the game is not played on the player's game terminal, but on a cloud server (i.e., a game server), and the cloud server renders the game scene into a video and audio stream, which is transmitted to the player's game terminal (i.e., a terminal) over the network. The player's game terminal does not need to have powerful graphics computing and data processing capabilities, but only needs to have basic streaming media playback capabilities and the ability to obtain player input instructions and send them to the cloud server. An ordinary game scene may refer to a game scene in which the game is run in a terminal.
[0035] It is understandable that the server can be an independent physical server, or a server cluster or distributed system composed of at least two physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal can specifically refer to a vehicle-mounted terminal, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a screen speaker, a smart watch, etc., but is not limited to this. Each terminal and server can be directly or indirectly connected through wired or wireless communication. At the same time, the number of terminals and servers can be one or at least two, and this application does not limit this.
[0036] The direction parameter determination system of FIG1 can be applied to determine the direction parameters of rotating objects in a game scene. Specifically, as shown in FIG2, the terminal 20a in FIG2 can be any terminal in the terminal cluster in FIG1, and the server 21a in FIG2 can be the server 10 in FIG1. A game frame 22a is displayed in the terminal 20a, and the game frame 22a includes an object 23a and an object 24a. The shapes of the objects 23a and 24a are both rectangular parallelepipeds. The objects 23a and 24a are both rotating objects, and the rotation direction of the objects 23a and 24a is from left to right. The terminal 22a can respectively obtain the rotational angular velocity, the first direction parameter, and the inter-frame interval duration of the objects 23a and 24a, and can send the rotational angular velocity, the first direction parameter, and the inter-frame interval duration corresponding to the objects 23a and 24a to the server 21a. The inter-frame interval duration is the duration between game frame 22a and its next game frame 25a. The first direction parameter of object 23a reflects the orientation of object 23a in game frame 22a, that is, the first direction parameter of object 23a reflects the angles corresponding to object 23a with the X-axis, Y-axis, and Z-axis at the first moment. The first direction parameter of object 24a reflects the orientation of object 24a in game frame 22a, that is, the first direction parameter of object 24a reflects the angles corresponding to object 24a with the X-axis, Y-axis, and Z-axis at the first moment. The first moment is the display time of game frame 22a.
[0037] Furthermore, server 21a can perform exponential processing on the rotational angular velocity of object 23a based on the inter-frame interval duration through the physics engine to obtain the target rotation angle of object 23a. The physics engine can also perform exponential processing on the rotational angular velocity of object 24a based on the inter-frame interval duration to obtain the target rotation angle of object 24a. It should be noted that, in order for the physics engine to represent the rotational angular velocity, first direction parameter, and inter-frame interval duration corresponding to objects 23a and 24a, respectively, the rotational angular velocity, first direction parameter, and inter-frame interval duration corresponding to objects 23a and 24a, respectively, should all fall within a controllable numerical range of the physics engine. Exponential processing on the rotational angular velocity of object 23a based on the inter-frame interval duration is equivalent to performing cosine or sine processing on the product of the inter-frame interval duration and the rotational angular velocity of object 23a. That is, the target rotation angle of object 23a obtained by this exponential processing falls within a controllable numerical range of the physics engine. Similarly, exponentially processing the rotational angular velocity of object 24a based on the interframe interval duration is equivalent to performing cosine and sine operations on the product of the interframe interval duration and the rotational angular velocity of object 24a. This exponential processing results in a target rotation angle for object 24a that falls within the controllable range of values within the physics engine. In other words, the intermediate values (i.e., the target rotation angles of objects 23a and 24a) obtained during the process of obtaining the updated directional parameters for objects 23a and 24a do not exceed the controllable range of values within the physics engine, thus preventing overflow of intermediate values.
[0038] Then, server 21a can determine the second direction parameter of object 23a in game frame 25a based on the target rotation angle and first direction parameter of object 23a through the physics engine, and determine the second direction parameter of object 24a in game frame 25a based on the target rotation angle and first direction parameter of object 24a through the physics engine. Here, the second direction parameter of object 23a reflects the orientation of object 23a at the second moment, that is, the second direction parameter of object 23a reflects the angles corresponding to the X-axis, Y-axis, and Z-axis of object 23a at the second moment; the second direction parameter of object 24a reflects the orientation of object 24a at the second moment, that is, the second direction parameter of object 24a reflects the angles corresponding to the X-axis, Y-axis, and Z-axis of object 24a at the second moment, and the second moment is the display time of game frame 25a. After server 21a obtains the second direction parameters corresponding to objects 23a and 24a, respectively, it can perform collision detection on objects 23a and 24a based on the position information of objects 23a and 24a at the second moment. That is, if objects 23a and 24a are at the same position at the second moment, it is determined that objects 23a and 24a will collide. Then, the second direction parameters corresponding to objects 23a and 24a can be adjusted to obtain the third direction parameters corresponding to objects 23a and 24a, respectively. Object 23a is rendered based on the third direction parameters corresponding to object 23a, and object 24a is rendered based on the third direction parameters corresponding to object 24a, to obtain game frame 25a. If objects 23a and 24a are at different positions at the second moment, it is determined that objects 23a and 24a will not collide. Then, object 23a is rendered based on the second direction parameters corresponding to object 23a, and object 24a is rendered based on the second direction parameters corresponding to object 24a, to obtain game frame 25a. After acquiring the game frame 25a, the server 21a may send the game frame 25a to the terminal 20a, and the terminal 20a may update the game frame 22a displayed to the game frame 25a.
[0039] In summary, the target rotation angle and the first direction parameter of object 23a are both within the controllable numerical range of the physics engine, and the second direction parameter of object 23a is also within the controllable numerical range of the physics engine. Since the target rotation angle and the first direction parameter of object 24a are both within the controllable numerical range of the physics engine, the second direction parameter of object 24a is also within the controllable numerical range of the physics engine. In other words, the intermediate values in the process of obtaining the updated direction parameters (i.e., the second direction parameters) of objects 23a and 24a, as well as the final updated direction parameters, do not exceed the controllable numerical range of the physics engine, which can avoid data overflow and game interruptions caused by data overflow, improve the smoothness of the game, and also ensure the extremely high accuracy of the updated direction parameters.
[0040] Further, please refer to Figure 3, which is a flow chart of a data processing method provided in an embodiment of the present application. As shown in Figure 3, the method can be executed by any terminal in the terminal cluster in Figure 1, or by the server in Figure 1. The devices used to execute the data processing method in this application can be collectively referred to as computer devices. The method may include the following steps:
[0041] S101. Obtain a first direction parameter and a rotational angular velocity of a target object in a first game frame, and an inter-frame interval duration between the first game frame and a second game frame; the rendering order of the second game frame is after the rendering order of the first game frame.
[0042] In this application, the target object may refer to a rotating object in the game scene, and the computer device may obtain the first direction parameter and rotational angular velocity of the target object in the first game frame, as well as the inter-frame interval duration between the first game frame and the second game frame; the first direction parameter is used to reflect the orientation of the target object in the first game frame, that is, the first direction parameter of the target object reflects the angle between the target object and the X-axis, Y-axis, and Z-axis at the first moment, the first moment is the display moment of the first game frame, and the X-axis, Y-axis, and Z-axis belong to the Cartesian coordinate system of the space where the target object is located. The rotational angular velocity may refer to the speed at which the target object rotates along a certain point in space, and the inter-frame interval duration may reflect how long after the computer device displays the first game frame, the second game frame may refer to the next frame of the first game frame.
[0043] It should be noted that if the first game frame is the first game frame that includes the target object, the first direction parameter of the target object in the first game frame may refer to the initial direction parameter of the target object, and the initial direction parameter of the target object may be determined by the game rules of the game application to which the first game frame belongs, or the initial direction parameter of the target object may refer to the direction parameter of the target object when the computer device last closed the game application. The angular velocity of rotation of the target object may be determined based on the operation data of the game player corresponding to the computer device in the game application (such as the force applied to the target object), and the operation data may also be synchronized to the computer device by other devices; or, the angular velocity of rotation of the target object may be determined based on the game rules of the game application to which the first game frame belongs. The above-mentioned inter-frame interval duration may be determined based on the game rules of the game application to which the first game frame belongs.
[0044] It should be noted that in order for the physics engine corresponding to the first game frame to be able to represent the first direction parameter, rotational angular velocity, and inter-frame interval duration, the first direction parameter, rotational angular velocity, and time interval duration should all belong to a controllable numerical range, and the controllable numerical range can be determined based on the number of bits of the computer device and the numerical representation method of the physics engine. For example, assuming that the numerical representation method of the physics engine is a fixed-point number-based representation method, the number of bits of the computer device is 8 bits, and the physics engine stipulates that the first 5 digits represent the integer part of a decimal, and the last 3 digits represent the decimal part, and the decimal point defaults to the position after the fifth digit, then the numerical range that can be represented in the 8-bit computer device is [0, 31.875], that is, the controllable numerical range here is [0, 31.875]. Of course, the physics engine can also agree that the first digit represents the integer portion of a decimal, and the last seven digits represent the fractional portion of a decimal. In this case, the representable range of values on an 8-bit computer is [0, 1.9921875], meaning the controllable range of values is [0, 1.9921875]. For another example, assuming the physics engine's numerical representation is based on floating-point numbers and the computer has 8 bits, the representable range of values on an 8-bit computer is [-126, 127], meaning the controllable range of values is [-126, 127].
[0045] S102 : performing exponential processing on the rotational angular velocity according to the inter-frame interval duration to obtain a target rotation angle of the target object.
[0046] In the present application, a computer device may perform exponential processing on the rotational angular velocity according to the inter-frame interval duration to obtain a target rotation angle of the target object. The exponential processing herein may refer to performing a power operation on the inter-frame interval duration and the rotational angular velocity. According to the Euler formula corresponding to the power operation processing (i.e., based on the exponential processing principle), the exponential processing is equivalent to performing cosine or sine processing on the product of the rotational angular velocity and the inter-frame interval duration. Since the results obtained by the cosine and spherical sine processing are both within [-1, -1], the target rotation angle of the target object obtained by performing exponential processing on the rotational angular velocity according to the inter-frame interval duration also falls within a controllable numerical range.
[0047] Optionally, the above-mentioned exponential processing of the rotational angular velocity according to the inter-frame interval duration is performed to obtain the target rotation angle of the target object, including: the rotational angular velocity of the target object includes the rotational angular velocities w1, w2, and w3 of the target object corresponding to the X-axis, Y-axis, and Z-axis, respectively; the X-axis, Y-axis, and Z-axis can belong to the Cartesian coordinate system of the space where the target object is located. The computer device can convert the rotational angular velocity of the target object into a three-dimensional angular velocity vector of the target object, that is, the three-dimensional angular velocity vector of the target object can be expressed as: The computer device can determine the three-dimensional rotation angle vector of the target object based on the product between the three-dimensional angular velocity vector and the time interval between frames. For example, the computer device can determine half of the product between the three-dimensional angular velocity vector and the time interval as the three-dimensional rotation angle vector of the target object; or, determine the product between the three-dimensional angular velocity vector and the time interval as the three-dimensional rotation angle vector of the target object. Further, the computer device can perform exponential processing on the three-dimensional rotation angle vector of the target object to obtain the quaternion rotation angle vector of the target object. This quaternion rotation angle vector is a vector that represents the rotation angle of the target object based on the quaternion method. The quaternion rotation angle vector of the target object is determined as the target rotation angle of the target object. By representing the rotation angle of the target object (i.e., the target rotation angle) based on the quaternion method, the efficiency of determining the rotation angle of the target object can be improved, storage space can be saved, and the gimbal lock phenomenon can be avoided.
[0048] It should be noted that a quaternion consists of a real number plus three imaginary units, i, j, and k, and they have the following relationship: i² = j² = k² = -1, i₀ = j₀ = k₀ = 1. Each quaternion is a linear combination of 1, i, j, and k. That is, a quaternion can be expressed as a+bi+cj+dk, where a, b, c, and d are real numbers. The geometric meaning of i, j, and k themselves can be understood as a rotation. An i rotation represents the rotation angle of the target object from the positive Z axis to the positive Y axis in the plane where the Z and Y axes intersect. A j rotation represents the rotation angle of the target object from the positive X axis to the positive Z axis in the plane where the X and Z axes intersect. A k rotation represents the rotation angle of the target object from the positive Y axis to the positive X axis in the plane where the Y and X axes intersect.
[0049] It should be noted that the target object's rotation angle can be represented by quaternion-based methods, matrix rotation methods, and Euler rotation methods. If the quaternion-based method is used to represent the target object's rotation angle, only four elements (i.e., a, b, c, d) are required to represent the target object's rotation angle, and there is no need to limit the target object to rotating according to a fixed coordinate axis rotation order. For example, the fixed coordinate axis rotation order can be first the X axis, then the Y axis, and finally the Y axis. In the process of calculating the target object's rotation angle, the matrix rotation method requires a 4*4 matrix to represent the transformation matrix for rotation around any axis (i.e., the transformation matrix has 16 elements), and the target object's rotation angle is calculated based on the product between the transformation matrix and the rotational angular velocity. The Euler rotation method requires that the target object must rotate according to a fixed coordinate axis rotation order. As can be seen, since the quaternion-based method requires fewer elements, representing the target object's rotation angle by using the quaternion-based method can improve the efficiency of determining the target object's rotation angle and save storage space. Because the quaternion-based method does not restrict the target object to rotating according to a fixed coordinate axis rotation order, that is, by expressing the target object's rotation angle based on the quaternion method, the gimbal lock phenomenon can be avoided. The gimbal lock phenomenon here can refer to the process of rotating the target object according to a fixed coordinate axis rotation order. If some coordinate axes are mistakenly overlapped, the target object will lose the ability to rotate in one direction. In other words, in this state, no matter how the target object is rotated (of course, the original coordinate axis rotation order must be followed), it is impossible to achieve the desired rotation effect unless the original coordinate axis rotation order is broken or all three coordinate axes are rotated simultaneously.
[0050] Optionally, the above-mentioned exponential processing of the three-dimensional rotation angle vector of the target object to obtain the quaternion rotation angle vector of the target object includes: the computer device can pad the three-dimensional rotation angle vector of the target object to obtain a four-dimensional rotation angle vector, such as adding zeros to the three-dimensional rotation angle vector of the target object to obtain the four-dimensional rotation angle vector. Further, the four-dimensional rotation angle vector is used as an exponent and a natural constant is used as a base to perform calculation processing to obtain the quaternion rotation angle vector of the target object, where the natural constant here can refer to e.
[0051] For example, the computer device may use the following formula (1) to express the three-dimensional rotation angle vector of the target object:
[0052] In formula (1), represents the three-dimensional rotational angular velocity of the target object, Δt represents the inter-frame interval between the first game frame and the second game frame, Represents the three-dimensional rotation angle vector of the target object. Add 0 to the three-dimensional rotation angle vector of the target object to obtain the four-dimensional rotation angle vector of the target object, which can be expressed as Furthermore, the four-dimensional rotation angle vector is used as an exponent and the natural constant is used as a base to perform calculations to obtain the quaternion rotation angle vector of the target object. That is, the quaternion rotation angle vector of the target object can be expressed as exp represents the natural constant e.
[0053] Optionally, based on the Euler formula of the exponent, the above-mentioned four-dimensional rotation angle vector is used as the exponent and the natural constant is used as the base for the operation to obtain the quaternion rotation angle vector of the target object, including: the computer device can perform modulo processing on the four-dimensional rotation angle vector to obtain the real angle of the target object, such as the computer device can calculate the sum of the squares of each element in the four-dimensional rotation angle vector, and then perform square root operation on the sum of the squares of each element to obtain the real angle of the target object, that is, the real angle can be expressed as Since 0 does not affect the size of the real angle, Can be equivalent to
[0054] Furthermore, the computer device may perform unitization processing on the four-dimensional rotation angle vector to obtain a unit four-dimensional rotation angle vector. For example, the ratio between the four-dimensional rotation angle vector and the real angle is determined as the unit four-dimensional rotation angle vector, that is, the unit four-dimensional rotation angle vector can be expressed as: The computer device may determine the product of the unit four-dimensional rotation angle vector and the sine value of the real angle as the candidate rotation angle of the target object. That is, the candidate rotation angle of the target object may be expressed as: Then, the sum of the candidate rotation angle of the target object and the cosine value of the real angle may be determined as the quaternion rotation angle vector of the target object.
[0055] For example, the quaternion rotation angle vector of the target object can be expressed using the following formula (2):
[0056] in, The specific expression is a+bi+cj+dk mentioned above.
[0057] S103: Determine a second direction parameter of the target object in the second game frame according to the target rotation angle of the target object and the first direction parameter.
[0058] In the present application, after obtaining the target rotation angle and the first direction parameter of the target object, the computer device can determine the second direction parameter of the target object in the second game frame based on the target rotation angle and the first direction parameter of the target object. The second direction parameter can refer to the orientation of the target object in the second game frame, that is, the second direction parameter of the target object reflects the angle between the target object and the X-axis, Y-axis, and Z-axis at the second moment, and the second moment is the display moment of the second game frame. Since the target rotation angle and the first direction parameter both belong to a controllable numerical range, the second direction parameter obtained based on the target rotation angle and the first direction parameter also belongs to a controllable numerical range, which can avoid problems such as data overflow and game interruption, and improve the smoothness of the game.
[0059] It should be noted that after the computer device calculates the second direction parameter, it renders the target object according to the second direction parameter to obtain a second game frame including the target object; further, when the game application to which the first game frame belongs is a multiplayer online game application, the computer device can synchronize the second direction parameter to other devices, and the other devices may include devices corresponding to game players belonging to the same game team as the target game player, and devices corresponding to game players belonging to the enemy team corresponding to the target game player. The target game player is the game player corresponding to the computer device.
[0060] Optionally, the above-mentioned determination of the second direction parameter of the target object in the second game frame based on the target rotation angle and the first direction parameter of the target object includes: generating a first quaternion direction vector reflecting the first direction parameter of the target object, that is, the first quaternion direction vector is a vector representing the first direction parameter of the target object based on the quaternion method. If the first direction parameter of the target object is a three-dimensional direction vector, a 0 is added to the three-dimensional direction vector for padding to obtain the first quaternion direction vector. Further, the product of the first quaternion direction vector and the quaternion rotation angle vector corresponding to the target rotation angle is determined as the second quaternion direction vector of the target object in the second game frame. The second quaternion direction vector may refer to a vector representing the direction parameter of the target object in the second game frame based on the quaternion method. The second quaternion direction vector is determined as the second direction parameter of the target object in the second game frame.
[0061] For example, the computer device may use the following formula (3) to express the second direction parameter of the target object in the second game frame:
[0062] In formula (3), q0 represents the first quaternion direction vector, and q represents the second quaternion direction vector, that is, the second direction parameter of the target object in the second game frame. Represents the product between two vectors. Based on the above formula (2), formula (3) can be equivalent to the following formula (4):
[0063] It should be noted that according to formula (4), when the quaternion-based method is used in the physical engine to represent the direction parameters of the target object, the quaternion-based direction parameters are all within the controllable value range of the physical engine, that is, each value in q0 is within the controllable value range of the physical engine. The size is determined by and Δt, The size limit is designed, such as It is within the controllable value range of the physics engine.
[0064] Assuming the calculated It is the maximum value within the controllable value range of the physics engine. The results of these three calculations are all less than That is to say, The results of these three calculations will not exceed the controllable value range of the physics engine, that is, the physics engine can also These three calculations. Then The results obtained from these three calculations are all within [-2, 2); It is a complex number addition calculation, and the result is also in [-2, 2). Since each value in q0 is within the controllable numerical range of the physics engine, It is within the controllable value range, that is, the second direction parameter of the target object will not exceed the controllable value range of the physics engine, and the intermediate value of the second direction parameter of the target object in the calculation process (i.e. ) will not exceed the controllable value range of the physics engine.
[0065] In other words, this method of determining the second direction parameter of the target object can avoid data overflow, game interruption and other problems, while ensuring the great accuracy of the direction parameter.
[0066] For example, the controllable value range of the physics engine is [-2, 2) as an example for explanation. Therefore, the first direction parameter, the second direction parameter and the intermediate value (i.e. ) are all located in [-2, 2).
[0067] In other words, since the integer parts of the first direction parameter, the second direction parameter and the intermediate value are relatively small, when the physical engine uses fixed-point numbers to represent numerical values (such as direction parameters), fewer bits can be used to represent the integer part, and more bits can be used to represent the decimal part, thereby improving the accuracy of obtaining the direction parameters of the target object. For example, if the computer device is 32 bits, 1 bit can be used to represent the positive and negative of the value, 30 bits can be used to represent the decimal part of the value, and 1 bit can be used to represent the integer part of the value. In this way, more bits can be used to represent the decimal part of the value, thereby improving the accuracy of the value (first direction parameter, second direction parameter).
[0068] In one embodiment, after obtaining the second direction parameter, the orientation of the rigid body (target object) in the game can be set to q, and the newly obtained orientation can be used for collision detection, and then the collision and constraint resolution can be performed. The application layer uses the orientation after resolution to perform some application-specific functions, and may directly modify the rigid body orientation.
[0069] In the present application, in order for the physics engine to be able to represent the initial direction parameter (i.e., the first direction parameter of the rotating object in the first game frame), the inter-frame interval duration, and the rotational angular velocity of the rotating object (i.e., the target object), the initial direction parameter, the inter-frame interval duration, and the rotational angular velocity are all within a numerical range controllable by the physics engine. When it is necessary to update the initial direction parameter of the rotating object, the computer device can perform exponential processing on the rotational angular velocity of the rotating object by the inter-frame interval duration between each two game frames (the first game frame and the second game frame) to obtain the target rotation angle of the target object. Based on the exponential processing principle, it can be seen that the exponential processing is equivalent to performing cosine, sine, etc. processing on the product of the rotational angular velocity and the inter-frame interval duration. It can be seen that by exponentially processing the rotational angular velocity through the inter-frame interval duration, the target rotation angle obtained by the exponential processing can be limited to a numerical range controllable by the physical engine. Furthermore, based on the target rotation angle and the initial direction parameter of the rotating object, the updated direction parameter (i.e., the second direction parameter) of the rotating object is determined to also belong to the numerical range controllable by the physical engine, that is, the updated direction parameter can be represented by the physical engine in the computer device, which can avoid data overflow and game interruption caused by data overflow, thereby improving the smoothness of the game.
[0070] Further, please refer to Figure 4, which is a flow chart of a data processing method provided in an embodiment of the present application. As shown in Figure 4, the method can be executed by any terminal in the terminal cluster in Figure 1, or by the server in Figure 1. The devices used to execute the data processing method in this application can be collectively referred to as computer devices. The method may include the following steps:
[0071] S201. Obtain a first direction parameter and a rotational angular velocity of a target object in a first game frame, and an inter-frame interval duration between the first game frame and a second game frame; the rendering order of the second game frame is after the rendering order of the first game frame.
[0072] S202 : performing exponential processing on the rotation angular velocity according to the inter-frame interval duration to obtain a target rotation angle of the target object.
[0073] S203: Determine a second direction parameter of the target object in the second game frame according to the target rotation angle of the target object and the first direction parameter.
[0074] It should be noted that the explanation of step S201 in this application can refer to the above explanation of step S101, the explanation of step S202 can refer to the above explanation of step S102, and the explanation of step S203 can refer to the above explanation of step S103. The repeated parts will not be repeated here.
[0075] S204: Obtain movement parameters of the target object and a first position of the target object in the first game frame.
[0076] S205: Determine a second position of the target object in the second game frame according to the movement parameter of the target object, the inter-frame interval duration, and the first position.
[0077] Optionally, the above-mentioned determination of the second position of the target object in the second game frame based on the movement parameters of the target object, the inter-frame interval duration, and the first position includes: the computer device can determine the product between the movement speed in the movement parameters and the inter-frame interval duration as the movement distance of the target object, and determine the second position of the target object in the second game frame based on the movement direction in the movement parameters, the movement distance, and the first position. For example, the first position is (x, y, z) cm, where x, y, and z represent the coordinate values of the target object in the X-axis, Y-axis, and Z-axis, respectively. If the movement direction of the target object is the positive direction of the X-axis and the movement distance is 3 cm, then the second position of the target object in the game frame is (x+3, y, z) cm.
[0078] S206: Render the target object according to the second position and the second direction parameter to obtain a second game frame including the target object.
[0079] In steps S204-206, the computer device may obtain the movement parameters of the target object based on the game rules of the game application to which the first game frame belongs, or obtain the movement parameters of the target object based on the operation data of the game player corresponding to the computer device on the target object in the first game frame. The movement parameters may include movement direction and movement speed, etc. The computer device may obtain the display position of the target object in the first game frame as the first position of the target object. Further, based on the movement parameters of the target object, the inter-frame interval length, and the first position, the display position of the target object in the second game frame is determined, and the display position of the target object in the second game frame is determined as the second position of the target object in the second game frame. The target object is rendered according to the second position and the second direction parameters to obtain a second game frame including the target object. In particular, the movement speed of the target object may be 0, and the target object has not moved, that is, the first position of the target object in the first game frame is the same as the second position of the target object in the second game frame.
[0080] Optionally, the above-mentioned rendering of the target object according to the second position and the second direction parameter to obtain a second game frame including the target object includes: if the number of the target object is one, the computer device can directly render the target object according to the second position and the second direction parameter to obtain a second game frame including the target object. If the number of the target objects is at least two, the computer device can perform collision detection on the at least two target objects according to the second positions corresponding to the at least two target objects to obtain a detection result; for example, the at least two target objects include a first target object and a second target object. If the second positions corresponding to the first target object and the second target object are the same, a detection result is generated indicating that the first target object and the second target object will collide; if the second positions corresponding to the first target object and the second target object are different, a detection result is generated indicating that the first target object and the second target object will not collide. Further, according to the detection result, the second direction parameters corresponding to the at least two target objects are adjusted to obtain third direction parameters corresponding to the at least two target objects, and the at least two target objects are rendered according to the third direction parameters corresponding to the at least two target objects and the second position to obtain a second game frame including the at least two target objects.
[0081] It is understandable that the above-mentioned adjustment of the second direction parameters corresponding to the at least two target objects respectively according to the detection result to obtain the third direction parameters corresponding to the at least two target objects respectively includes: if the detection result indicates that there will be no collision between the first target object and the second target object of the at least two target objects, then the second direction parameter of the first target object is determined as the third direction parameter of the first target object, and the second direction parameter of the second target object is determined as the third direction parameter of the second target object. If the detection result indicates that there will be a collision between the first target object and the second target object of the at least two target objects, then the object category of the first target object and the object category of the second target object are obtained, and the object categories include virtual people, virtual props, etc. According to the object category of the first target object and the object category of the second target object, the second direction parameter of the first target object is adjusted to obtain the third direction parameter of the first target object. For example, if the game rules specify rules for adjusting the directional parameters of the corresponding objects after a collision between objects of different categories, the computer device can query the game rules for the adjustment rules for the directional parameters of the first target object based on the object category of the first target object and the object category of the second target object, and adjust the second directional parameter of the first target object based on the adjustment rules for the directional parameters of the first target object to obtain the third directional parameter of the first target object. Similarly, the computer device can query the game rules for the adjustment rules for the directional parameters of the second target object based on the object category of the first target object and the object category of the second target object, and adjust the second directional parameter of the second target object based on the adjustment rules for the directional parameters of the second target object to obtain the third directional parameter of the second target object.
[0082] It should be noted that when the first target object and the second target object collide, whether the second positions of the first target object and the second target object change is determined according to the game rules. If the game rules stipulate that the second positions of the first target object and the second target object will change, the computer device can adjust the second positions corresponding to the first target object and the second target object according to the game rules, obtain the third positions corresponding to the first target object and the second target object respectively, and render the first target object and the second target object according to the third direction parameters and the third positions corresponding to the first target object and the second target object respectively, to obtain a second game frame including the first target object and the second target object. If the game rules stipulate that the second positions of the first target object and the second target object will not change, the computer device can render the first target object and the second target object according to the third direction parameters and the second positions corresponding to the first target object and the second target object respectively, to obtain a second game frame including the first target object and the second target object.
[0083] In the present application, after obtaining the second direction parameter of the target object, the computer device can obtain the position of the target object in the second game frame, render the target object according to the second direction parameter of the target object and the position of the target object in the second game frame, and obtain a second game frame including the target object; data overflow and game interruption caused by data overflow can be avoided, thereby improving the smoothness of the game.
[0084] Please refer to Figure 5, which is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. As shown in Figure 5, the data processing device may include:
[0085] An acquisition module 511 is configured to acquire a first direction parameter and a rotational angular velocity of a target object in a game engine in a first game frame, as well as an inter-frame interval duration between the first game frame and a second game frame; the rendering order of the second game frame is after the rendering order of the first game frame;
[0086] a processing module 512 configured to perform exponential processing on the rotational angular velocity according to the inter-frame interval duration to obtain a target rotation angle of the target object;
[0087] The determination module 513 is configured to determine a second direction parameter of the target object in the second game frame according to the target rotation angle of the target object and the first direction parameter.
[0088] Optionally, the processing module 512 includes a first generating unit 51a, a first determining unit 52a, a processing unit 53a, and a second determining unit 54a;
[0089] A first generating unit 51a is configured to generate a three-dimensional angular velocity vector of the target object according to the rotation angular velocity;
[0090] A first determining unit 52a is configured to determine a three-dimensional rotation angle vector of the target object according to a product of the three-dimensional angular velocity vector and the inter-frame interval duration;
[0091] a processing unit 53a, configured to perform exponential processing on the three-dimensional rotation angle vector of the target object to obtain a quaternion rotation angle vector of the target object;
[0092] The second determining unit 54a is configured to determine the quaternion rotation angle vector of the target object as the target rotation angle of the target object.
[0093] It is understandable that the processing unit 53a performs exponential processing on the three-dimensional rotation angle vector of the target object to obtain the quaternion rotation angle vector of the target object, including:
[0094] Converting the three-dimensional rotation angle vector of the target object into a four-dimensional rotation angle vector;
[0095] The four-dimensional rotation angle vector is used as an exponent and a natural constant is used as a base for operation processing to obtain a quaternion rotation angle vector of the target object.
[0096] It is understandable that the processing unit 53a uses the four-dimensional rotation angle vector as an exponent and the natural constant as a base for operation processing to obtain the quaternion rotation angle vector of the target object, including:
[0097] Performing a modulo process on the four-dimensional rotation angle vector to obtain a real angle of the target object;
[0098] Normalizing the four-dimensional rotation angle vector to obtain a unit four-dimensional rotation angle vector;
[0099] Determine the product of the unit four-dimensional rotation angle vector and the sine value of the real angle as the candidate rotation angle of the target object;
[0100] The sum of the candidate rotation angle of the target object and the cosine value of the real angle is determined as the quaternion rotation angle vector of the target object.
[0101] The determination module 513 includes a second generation unit 55a, a third determination unit 56a, and a fourth determination unit 57a;
[0102] A second generating unit 55a is configured to generate a first quaternion direction vector reflecting the first direction parameter of the target object;
[0103] A third determining unit 56a is configured to determine the product of the first quaternion direction vector and the quaternion rotation angle vector corresponding to the target rotation angle as the second quaternion direction vector of the target object in the second game frame;
[0104] The fourth determining unit 57a is configured to determine the second quaternion direction vector as a second direction parameter of the target object in the second game frame.
[0105] An acquisition module 511 is configured to acquire movement parameters of the target object and a first position of the target object in the first game frame;
[0106] The determination module 513 is further configured to determine a second position of the target object in the second game frame according to the movement parameter of the target object, the inter-frame interval duration, and the first position;
[0107] The above apparatus further includes a rendering module 514;
[0108] The rendering module 514 is configured to render the target object according to the second position and the second direction parameter to obtain a second game frame including the target object.
[0109] Optionally, the determining module 513 determines a second position of the target object in the second game frame according to the movement parameter of the target object, the inter-frame interval duration, and the first position of the target object in the first game frame, including:
[0110] The moving distance of the target object is determined by multiplying the moving speed in the moving parameter by the inter-frame interval duration;
[0111] A second position of the target object in the second game frame is determined according to the moving direction, the moving distance, and the first position in the moving parameters.
[0112] Optionally, the rendering module 514 renders the target object according to the second position and the second direction parameter to obtain a second game frame including the target object, including:
[0113] If the number of the target objects is at least two, performing collision detection on the at least two target objects according to the second positions respectively corresponding to the at least two target objects to obtain a detection result;
[0114] Adjusting the second direction parameters respectively corresponding to the at least two target objects according to the detection result to obtain third direction parameters respectively corresponding to the at least two target objects;
[0115] The at least two target objects are rendered according to the third direction parameters and the second positions respectively corresponding to the at least two target objects to obtain a second game frame including the at least two target objects.
[0116] Optionally, the rendering module 514 adjusts the second direction parameters corresponding to the at least two target objects according to the detection result to obtain third direction parameters corresponding to the at least two target objects, including:
[0117] If the detection result indicates that a first target object and a second target object among the at least two target objects will collide, obtaining an object category of the first target object and an object category of the second target object;
[0118] adjusting the second direction parameter of the first target object according to the object category of the first target object and the object category of the second target object to obtain a third direction parameter of the first target object;
[0119] According to the object category of the first target object and the object category of the second target object, the second direction parameter of the second target object is adjusted to obtain a third direction parameter of the second target object.
[0120] According to one embodiment of the present application, the steps involved in the data processing method described above can be performed by the various modules in the data processing device shown in Figure 5. For example, step S101 shown in Figure 3 can be performed by the acquisition module 511 in Figure 5, step S102 shown in Figure 3 can be performed by the processing module 512 in Figure 5, and step S103 shown in Figure 3 can be performed by the determination module 513 in Figure 5.
[0121] According to one embodiment of the present application, the various modules in the data processing device shown in Figure 5 can be separately or all merged into one or several units to constitute, or some (some) units therein can also be split into at least two sub-units that are smaller in function, and the same operation can be achieved without affecting the realization of the technical effects of the embodiments of the present application. The above modules are divided based on logical functions. In actual applications, the functions of one module can also be implemented by at least two units, or the functions of at least two modules can be implemented by one unit. In other embodiments of the present application, the data processing device can also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of at least two units.
[0122] According to one embodiment of the present application, a data processing device as shown in FIG5 can be constructed, and the data processing method of the embodiment of the present application can be implemented by running a computer program (including program code) capable of executing each step involved in the corresponding method as shown above on a general-purpose computer device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing components and storage components. The above-mentioned computer program can be recorded on, for example, a computer-readable recording medium, and loaded into the above-mentioned computing device through the computer-readable recording medium and run therein.
[0123] In the present application, in order for the physics engine to be able to represent the initial direction parameter (i.e., the first direction parameter of the rotating object in the first game frame), the inter-frame interval duration, and the rotational angular velocity of the rotating object (i.e., the target object), the initial direction parameter, the inter-frame interval duration, and the rotational angular velocity are all within a numerical range controllable by the physics engine. When it is necessary to update the initial direction parameter of the rotating object, the computer device can perform exponential processing on the rotational angular velocity of the rotating object by the inter-frame interval duration between each two game frames (the first game frame and the second game frame) to obtain the target rotation angle of the target object. Based on the exponential processing principle, it can be seen that the exponential processing is equivalent to performing cosine, sine, etc. processing on the product of the rotational angular velocity and the inter-frame interval duration. It can be seen that by exponentially processing the rotational angular velocity through the inter-frame interval duration, the target rotation angle obtained by the exponential processing can be limited to a numerical range controllable by the physical engine. Furthermore, based on the target rotation angle and the initial direction parameter of the rotating object, the updated direction parameter (i.e., the second direction parameter) of the rotating object is determined to also belong to the numerical range controllable by the physical engine, that is, the updated direction parameter can be represented by the physical engine in the computer device, which can avoid data overflow and game interruption caused by data overflow, thereby improving the smoothness of the game.
[0124] Please refer to Figure 6, which is a structural diagram of a computer device provided in an embodiment of the present application. As shown in Figure 6, the above-mentioned computer device 1000 can be the first device in the above-mentioned method, specifically a terminal or a server, including: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, in some embodiments, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile MeMory), such as at least one disk storage. The memory 1005 may also be at least one storage device away from the aforementioned processor 1001. As shown in FIG6 , the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a computer application program.
[0125] In the computer device 1000 shown in FIG6 , the network interface 1004 can provide network communication functions; the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call the computer application stored in the memory 1005 to achieve:
[0126] Obtaining a first direction parameter and a rotational angular velocity of the target object in a first game frame, and an inter-frame interval duration between the first game frame and a second game frame; the rendering order of the second game frame is after the rendering order of the first game frame;
[0127] Exponentially processing the rotational angular velocity according to the inter-frame interval duration to obtain a target rotation angle of the target object;
[0128] A second direction parameter of the target object in the second game frame is determined according to the target rotation angle of the target object and the first direction parameter.
[0129] Optionally, the processor 1001 may be configured to call a computer application stored in the memory 1005 to perform exponential processing on the rotational angular velocity according to the inter-frame interval duration to obtain a target rotation angle of the target object, including:
[0130] generating a three-dimensional angular velocity vector of the target object according to the rotational angular velocity;
[0131] determining a three-dimensional rotation angle vector of the target object according to a product of the three-dimensional angular velocity vector and the inter-frame interval duration;
[0132] performing exponential processing on the three-dimensional rotation angle vector of the target object to obtain the quaternion rotation angle vector of the target object;
[0133] The quaternion rotation angle vector of the target object is determined as the target rotation angle of the target object.
[0134] Optionally, the processor 1001 may be configured to call a computer application stored in the memory 1005 to perform exponential processing on the three-dimensional rotation angle vector of the target object to obtain the quaternion rotation angle vector of the target object, including:
[0135] Converting the three-dimensional rotation angle vector of the target object into a four-dimensional rotation angle vector;
[0136] The four-dimensional rotation angle vector is used as an exponent and a natural constant is used as a base for operation processing to obtain a quaternion rotation angle vector of the target object.
[0137] Optionally, the processor 1001 may be configured to call a computer application stored in the memory 1005 to implement arithmetic processing using the four-dimensional rotation angle vector as an exponent and a natural constant as a base to obtain a quaternion rotation angle vector of the target object, including:
[0138] Performing a modulo process on the four-dimensional rotation angle vector to obtain a real angle of the target object;
[0139] Normalizing the four-dimensional rotation angle vector to obtain a unit four-dimensional rotation angle vector;
[0140] Determine the product of the unit four-dimensional rotation angle vector and the sine value of the real angle as the candidate rotation angle of the target object;
[0141] The sum of the candidate rotation angle of the target object and the cosine value of the real angle is determined as the quaternion rotation angle vector of the target object.
[0142] Optionally, the processor 1001 may be configured to call a computer application stored in the memory 1005 to determine a second direction parameter of the target object in the second game frame based on the target rotation angle of the target object and the first direction parameter, including:
[0143] generating a first quaternion direction vector reflecting the first direction parameter of the target object;
[0144] Determine the product of the first quaternion direction vector and the quaternion rotation angle vector corresponding to the target rotation angle as the second quaternion direction vector of the target object in the second game frame;
[0145] The second quaternion direction vector is determined as a second direction parameter of the target object in the second game frame.
[0146] Optionally, the processor 1001 may be configured to call a computer application stored in the memory 1005 to implement:
[0147] Obtaining movement parameters of the target object and a first position of the target object in the first game frame;
[0148] Determining a second position of the target object in the second game frame according to the movement parameter of the target object, the inter-frame interval duration, and the first position;
[0149] The target object is rendered according to the second position and the second direction parameter to obtain a second game frame including the target object.
[0150] Optionally, the processor 1001 may be configured to call a computer application stored in the memory 1005 to determine a second position of the target object in the second game frame based on the movement parameters of the target object, the inter-frame interval duration, and the first position of the target object in the first game frame, including:
[0151] The moving distance of the target object is determined by multiplying the moving speed in the moving parameter by the inter-frame interval duration;
[0152] A second position of the target object in the second game frame is determined according to the moving direction, the moving distance, and the first position in the moving parameters.
[0153] Optionally, the processor 1001 may be configured to call a computer application stored in the memory 1005 to render the target object according to the second position and the second direction parameter, thereby obtaining a second game frame including the target object, including:
[0154] If the number of the target objects is at least two, performing collision detection on the at least two target objects according to the second positions respectively corresponding to the at least two target objects to obtain a detection result;
[0155] Adjusting the second direction parameters respectively corresponding to the at least two target objects according to the detection result to obtain third direction parameters respectively corresponding to the at least two target objects;
[0156] The at least two target objects are rendered according to the third direction parameters and the second positions respectively corresponding to the at least two target objects to obtain a second game frame including the at least two target objects.
[0157] Optionally, the processor 1001 may be configured to call a computer application stored in the memory 1005 to implement adjusting the second direction parameters corresponding to the at least two target objects according to the detection result to obtain third direction parameters corresponding to the at least two target objects, including:
[0158] If the detection result indicates that a first target object and a second target object among the at least two target objects will collide, obtaining an object category of the first target object and an object category of the second target object;
[0159] adjusting the second direction parameter of the first target object according to the object category of the first target object and the object category of the second target object to obtain a third direction parameter of the first target object;
[0160] According to the object category of the first target object and the object category of the second target object, the second direction parameter of the second target object is adjusted to obtain a third direction parameter of the second target object.
[0161] In the present application, in order for the physics engine to be able to represent the initial direction parameter (i.e., the first direction parameter of the rotating object in the first game frame), the inter-frame interval duration, and the rotational angular velocity of the rotating object (i.e., the target object), the initial direction parameter, the inter-frame interval duration, and the rotational angular velocity are all within a numerical range controllable by the physics engine. When it is necessary to update the initial direction parameter of the rotating object, the computer device can perform exponential processing on the rotational angular velocity of the rotating object by the inter-frame interval duration between each two game frames (the first game frame and the second game frame) to obtain the target rotation angle of the target object. Based on the exponential processing principle, it can be seen that the exponential processing is equivalent to performing cosine, sine, etc. processing on the product of the rotational angular velocity and the inter-frame interval duration. It can be seen that by exponentially processing the rotational angular velocity through the inter-frame interval duration, the target rotation angle obtained by the exponential processing can be limited to a numerical range controllable by the physical engine. Furthermore, based on the target rotation angle and the initial direction parameter of the rotating object, the updated direction parameter (i.e., the second direction parameter) of the rotating object is determined to also belong to the numerical range controllable by the physical engine, that is, the updated direction parameter can be represented by the physical engine in the computer device, which can avoid data overflow and game interruption caused by data overflow, thereby improving the smoothness of the game.
[0162] It should be understood that the computer device described in the embodiments of the present application can execute the description of the above-mentioned data processing method in the corresponding embodiments above, and can also execute the description of the above-mentioned data processing device in the corresponding embodiments above, and the description thereof will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here.
[0163] In addition, it should be noted that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the aforementioned data processing device, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the description of the data processing method in the corresponding embodiment above. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0164] As an example, the above program instructions may be deployed on a computer device for execution, or deployed on at least two computer devices at one location for execution, or executed on at least two computer devices distributed at at least two locations and interconnected via a communication network. The at least two computer devices distributed at at least two locations and interconnected via a communication network may constitute a blockchain network.
[0165] The computer-readable storage medium may be the data processing device provided in any of the aforementioned embodiments or the central storage unit of the computer device, such as a hard disk or a memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SMART Media card, SMC), a secure digital (SD) card, a flash memory card (flash card), etc. equipped on the computer device. Furthermore, the computer-readable storage medium may also include both the central storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0166] The terms "first," "second," and the like in the description, claims, and drawings of the embodiments of the present application are used to distinguish between contents in different media, rather than to describe a specific order. In addition, the terms "including" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules that are not listed, or may optionally include other steps and units inherent to these processes, methods, apparatuses, products, or devices.
[0167] It is understandable that if the above embodiments of the present application need to use user information, etc., it is necessary to obtain user permission or consent and comply with relevant laws and regulations of relevant countries and regions.
[0168] The present application also provides a computer program product including a computer program / instruction. When the computer program / instruction is executed by a processor, the data processing method and decoding method described in the corresponding embodiment are implemented. Therefore, they will not be described in detail here. In addition, the description of the beneficial effects of the same method will not be described in detail. For technical details not disclosed in the embodiments of the computer program product involved in this application, please refer to the description of the method embodiment of this application.
[0169] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0170] The methods and related devices provided in the embodiments of the present application are described with reference to the method flow charts and / or structural diagrams provided in the embodiments of the present application. Specifically, each process and / or box in the method flow charts and / or structural diagrams, as well as the combination of the processes and / or boxes in the flow charts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable network connection device to produce a machine, so that the instructions executed by the processor of the computer or other programmable network connection device generate a device for implementing the function specified in one or more processes in the flow chart and / or one or more boxes in the structural diagram. These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable network connection device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a product including an instruction device, which implements the function specified in one or more processes in the flow chart and / or one or more boxes in the structural diagram. These computer program instructions can also be loaded onto a computer or other programmable network-connected device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the structural diagram.
[0171] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method, characterized in that: include: Obtaining a first direction parameter and a rotational angular velocity of the target object in a first game frame, and an inter-frame interval duration between the first game frame and a second game frame; The rendering order of the second game frame is after the rendering order of the first game frame; Exponentially process the rotation angular velocity according to the inter-frame interval duration to obtain a target rotation angle of the target object; A second direction parameter of the target object in the second game frame is determined according to the target rotation angle of the target object and the first direction parameter.
2. The method according to claim 1, characterized in that The step of exponentially processing the rotation angular velocity according to the inter-frame interval duration to obtain a target rotation angle of the target object includes: generating a three-dimensional angular velocity vector of the target object according to the rotational angular velocity; Determining a three-dimensional rotation angle vector of the target object according to the product of the three-dimensional angular velocity vector and the inter-frame interval duration; Performing exponential processing on the three-dimensional rotation angle vector of the target object to obtain the quaternion rotation angle vector of the target object; The quaternion rotation angle vector of the target object is determined as the target rotation angle of the target object.
3. The method according to claim 2, characterized in that The step of performing index processing on the three-dimensional rotation angle vector of the target object to obtain the quaternion rotation angle vector of the target object includes: Converting the three-dimensional rotation angle vector of the target object into a four-dimensional rotation angle vector; The four-dimensional rotation angle vector is used as an exponent and a natural constant is used as a base for operation processing to obtain a quaternion rotation angle vector of the target object.
4. The method according to claim 3, characterized in that The step of performing calculations using the four-dimensional rotation angle vector as an exponent and a natural constant as a base to obtain a quaternion rotation angle vector of the target object includes: Performing modulo processing on the four-dimensional rotation angle vector to obtain a real angle of the target object; Normalizing the four-dimensional rotation angle vector to obtain a unit four-dimensional rotation angle vector; Determine the product of the unit four-dimensional rotation angle vector and the sine value of the real angle as the candidate rotation angle of the target object; The sum of the candidate rotation angle of the target object and the cosine value of the real angle is determined as the quaternion rotation angle vector of the target object.
5. The method according to any one of claims 1 to 4, characterized in that: The determining, according to the target rotation angle of the target object and the first direction parameter, a second direction parameter of the target object in the second game frame comprises: generating a first quaternion direction vector reflecting the first direction parameter of the target object; Determine the product of the first quaternion direction vector and the quaternion rotation angle vector corresponding to the target rotation angle as the second quaternion direction vector of the target object in the second game frame; The second quaternion direction vector is determined as a second direction parameter of the target object in the second game frame.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Acquire movement parameters of the target object and a first position of the target object in the first game frame; Determining a second position of the target object in the second game frame according to the movement parameter of the target object, the inter-frame interval duration, and the first position; The target object is rendered according to the second position and the second direction parameter to obtain a second game frame including the target object.
7. The method according to claim 6, characterized in that The determining, according to the movement parameter of the target object, the inter-frame interval duration, and the first position of the target object in the first game frame, the second position of the target object in the second game frame comprises: The moving distance of the target object is determined by multiplying the moving speed in the moving parameter by the inter-frame interval time length; The second position of the target object in the second game frame is determined according to the moving direction, the moving distance and the first position in the moving parameters.
8. The method according to claim 6 or 7, characterized in that The step of rendering the target object according to the second position and the second direction parameter to obtain a second game frame including the target object comprises: If the number of the target objects is at least two, performing collision detection on the at least two target objects according to the second positions respectively corresponding to the at least two target objects to obtain a detection result; Adjusting the second direction parameters respectively corresponding to the at least two target objects according to the detection result to obtain the third direction parameters respectively corresponding to the at least two target objects; The at least two target objects are rendered according to the third direction parameters and the second position respectively corresponding to the at least two target objects to obtain a second game frame including the at least two target objects.
9. The method according to claim 8, characterized in that The adjusting the second direction parameters respectively corresponding to the at least two target objects according to the detection result to obtain the third direction parameters respectively corresponding to the at least two target objects includes: If the detection result indicates that a first target object and a second target object of the at least two target objects will collide, obtaining an object category of the first target object and an object category of the second target object; According to the object category of the first target object and the object category of the second target object, adjusting the second direction parameter of the first target object to obtain a third direction parameter of the first target object; According to the object category of the first target object and the object category of the second target object, the second direction parameter of the second target object is adjusted to obtain the third direction parameter of the second target object.
10. A data processing device, characterized in that: include: An acquisition module, used to acquire a first direction parameter and a rotation angular velocity of a target object in a game engine in a first game frame, and an inter-frame interval duration between the first game frame and a second game frame; The rendering order of the second game frame is after the rendering order of the first game frame; A processing module, configured to perform exponential processing on the rotation angular velocity according to the inter-frame interval duration to obtain a target rotation angle of the target object; A determination module is used to determine a second direction parameter of the target object in the second game frame according to the target rotation angle of the target object and the first direction parameter.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Center of mass state vector for analyzing user motion in 3D images
CN105209136A
Game data processing method and device, storage medium and electronic equipment
CN111744177A
Game data rendering method and device, equipment and storage medium
CN115671726A
Relocalization method and apparatus in camera pose tracking process, device, and storage medium
US20200327695A1
