Aircraft attitude simulation method based on mouse input control

Through the aircraft attitude simulation method based on mouse input control, the calculation complex and limitation problems in the prior art are solved, and the realistic simulation of the aircraft attitude and the continuous changing rotation effect are realized.

CN119838231APending Publication Date: 2025-04-18SNAIL GAMES
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411926020.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The prior art is complex in aircraft attitude simulation and involves many fields. The calculation model is limited to flight simulation in the atmosphere, making it difficult to achieve realistic flight attitude.

Method used

The aircraft posture simulation method based on mouse input control is adopted. By obtaining the mouse pointer position coordinates, the mouse offset ratio value is calculated, the input values ​​of the pitch axis and deflection axis of the aircraft are set, each axial angle is calculated, and added to each axial angle of the aircraft.

Benefits of technology

Realistic simulation of the aircraft posture is realized, and the continuously changing aircraft rotation is dragged by the mouse, which conforms to the rotation law of the aircraft posture and avoids complex physical calculations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119838231A_ABST
    Figure CN119838231A_ABST
Patent Text Reader

Abstract

An aircraft attitude simulation method based on mouse input control comprises the following steps: acquiring position coordinates of a mouse pointer in a screen at present, and calculating mouse offset proportion values in X and Y directions according to the position coordinates; setting input values of a pitch axis and a deflection axis of the aircraft according to the mouse offset proportion values in the X direction and the Y direction; respectively calculating a deviation angle in the pitch axis direction, a deviation angle in the deflection axis direction and a deviation angle in the rolling axis direction; and adding the deviation angle in the pitch axis direction, the deviation angle in the deflection axis direction and the deviation angle in the rolling axis direction to each axial angle of the aircraft. According to the method, the deviation proportion of the mouse position serves as input, the X direction and the Y direction dragged by the mouse serve as the movement orientation target of the aircraft, all axial angle values of the aircraft are calculated in a uniform acceleration movement mode, and therefore the aircraft can obtain the vivid flight attitude in the aspect of performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic games, and in particular to an aircraft attitude simulation method based on mouse input control. Background Art

[0002] In order to perform flight simulation in the game, some games will calculate the aircraft's attitude based on physical rules. This method requires calculating flight parameters such as gravity, thrust, lift and drag, and finally calculating the axial angle value of the aircraft. The disadvantages of this method are: the calculation is relatively complicated, involving multiple fields such as fluid dynamics and numerical analysis; real physical data is required as the basis for calculation, and failure of the calculation model will lead to strange flight attitudes; many calculation models are limited to flight simulation within the atmosphere. Summary of the invention

[0003] In order to solve the defects of the prior art, the purpose of the present invention is to provide an aircraft attitude simulation method based on mouse input control. Through the calculation method of mouse input control, the axial offset angle of the aircraft in the game is set to obtain a more realistic flight attitude.

[0004] In order to achieve the above object, the present invention provides, on one hand, a method for simulating an aircraft attitude based on mouse input control, comprising the following steps:

[0005] Get the current position coordinates of the mouse pointer on the screen, and calculate the mouse offset ratio values ​​in the X and Y directions based on the position coordinates;

[0006] According to the mouse offset ratio values ​​in the X and Y directions, the input values ​​of the pitch axis and the yaw axis of the aircraft are set;

[0007] Calculate the offset angle in the pitch axis direction, the offset angle in the yaw axis direction and the offset angle in the roll axis direction respectively;

[0008] The offset angle in the pitch axis direction, the offset angle in the yaw axis direction, and the offset angle in the roll axis direction are added to each axial angle of the aircraft.

[0009] Furthermore, the step of obtaining the current position coordinates of the mouse on the screen and calculating the mouse offset ratio values ​​in the X and Y directions based on the position coordinates further includes: subtracting the obtained position coordinates from the screen center coordinate value to obtain the mouse offset ratio values ​​in the X and Y directions.

[0010] Furthermore, the step of setting the input values ​​of the pitch axis and the yaw axis of the aircraft according to the mouse offset ratio value further includes:

[0011] The mouse offset ratio value in the X direction is set to the input value of the deflection axis, and the range is limited to between -1 and +1;

[0012] Sets the mouse offset proportional value in the Y direction to the pitch axis input value, limited to the range between -1 and +1.

[0013] Furthermore, the step of calculating the offset angle in the pitch axis direction further comprises:

[0014] Multiply the input value of the pitch axis by the maximum pitch angular velocity to obtain the target pitch angular velocity value;

[0015] Calculate the pitch angular velocity step value of the current game frame according to the running time period and pitch angular acceleration of the current game frame;

[0016] The pitch angular velocity is added to the pitch angular velocity step value of the current game frame to obtain the pitch angular velocity of the current game frame; the pitch angular velocity is less than or equal to the target pitch angular velocity value;

[0017] The pitch angular velocity is multiplied by the running time period of the current game frame to obtain the offset angle in the pitch axis direction.

[0018] Furthermore, the step of calculating the offset angle in the deflection axis direction further comprises:

[0019] The input value of the deflection axis is multiplied by the maximum deflection angular velocity to obtain the target deflection angular velocity value;

[0020] Calculate the deflection angular velocity step value of the current game frame according to the running time period and deflection angular acceleration of the current game frame;

[0021] The deflection angular velocity is added to the deflection angular velocity step value of the current game frame to obtain the deflection angular velocity of the current game frame, and the deflection angular velocity is less than or equal to the target deflection angular velocity value;

[0022] The deflection angular velocity is multiplied by the running time period of the current game frame to obtain the offset angle in the deflection axis direction.

[0023] Furthermore, the step of calculating the offset angle in the roll axis direction further comprises:

[0024] Multiplying the input value of the yaw axis by the maximum roll angle to obtain a target angle value of the roll axis;

[0025] The roll axis roll damping process is performed according to the target angle value to obtain an offset angle in the roll axis direction.

[0026] Furthermore, the step of performing roll damping processing on the roll axis according to the target angle value to obtain an offset angle in the roll axis direction further comprises:

[0027] Use the one-dimensional uniform acceleration motion formula to calculate the intermediate target angular velocity value;

[0028] Calculate the current angular velocity value according to the game frame time, rolling angular acceleration value, and target angular velocity value;

[0029] The offset angle of the roll axis is calculated based on the roll offset angular velocity value (i.e. the current angular velocity) and the game frame time.

[0030] To achieve the above-mentioned purpose, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor is used to execute the computer program stored in the memory to implement the aircraft attitude simulation method based on mouse input control as described above.

[0031] To achieve the above objectives, the present invention also provides a computer-readable storage medium, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned aircraft attitude simulation method based on mouse input control.

[0032] The aircraft attitude simulation method based on mouse input control provided by the present invention has the following beneficial effects compared with the prior art:

[0033] By obtaining the current position coordinates of the mouse pointer on the screen, and calculating the mouse offset ratio values ​​in the X and Y directions according to the position coordinates, and setting the input values ​​of the aircraft's pitch axis and yaw axis according to the mouse offset ratio values ​​in the X and Y directions, the aircraft's various axial angle values ​​are calculated and added to the aircraft's various axial angles. From a visual perspective, the aircraft's rotation will change continuously according to the mouse drag and conform to the rotation law of the aircraft's attitude, and a more realistic flight attitude can be obtained.

[0034] Other features and advantages of the present invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0036] Figure 1 A flow chart of an aircraft attitude simulation method based on mouse input control according to an embodiment of the present invention;

[0037] Figure 2 FIG. 1 is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0038] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0039] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.

[0040] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0041] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more". "Plurality" should be understood as two or more.

[0042] In an embodiment of the present invention, a method for simulating an aircraft attitude based on mouse input control is provided, comprising: obtaining the current position coordinates of the mouse pointer on the screen, and calculating the mouse offset ratio values ​​in the X and Y directions according to the position coordinates; setting the input values ​​of the pitch axis and the yaw axis of the aircraft according to the mouse offset ratio values ​​in the X and Y directions; respectively calculating the offset angle in the pitch axis direction, the offset angle in the yaw axis direction, and the offset angle in the roll axis direction; and adding the offset angle in the pitch axis direction, the offset angle in the yaw axis direction, and the offset angle in the roll axis direction to each axial angle of the aircraft.

[0043] In the embodiments of the present invention, the yaw axis (or pitch axis), pitch axis (i.e., lateral axis), and roll axis (i.e., longitudinal axis) of the aircraft are terms used to describe the three degrees of freedom of the aircraft. These three axes are perpendicular to each other and correspond to the three basic directions of motion of the aircraft, where:

[0044] Yaw axis: Also called the vertical axis, it is the up and down axis for an aircraft. When the aircraft rotates around it, it causes the nose of the aircraft to move left and right.

[0045] Pitch axis: also known as the horizontal axis, when the aircraft rotates around this axis, it causes the aircraft's nose to pitch.

[0046] Roll axis: When the aircraft rotates around this axis, the wings of the aircraft will move up and down.

[0047] In actual aircraft control systems, the above three axes and their corresponding control surfaces (rudder, elevator, aileron) work together to enable the aircraft to achieve various complex flight maneuvers. In the present invention, the aircraft attitude calculation in the game is realized based on the input control of the mouse, so that the aircraft can obtain a more realistic flight attitude in performance.

[0048] Figure 1 FIG. 1 is a flow chart of a method for simulating an aircraft attitude based on mouse input control according to an embodiment of the present invention. Figure 1 As shown, the following will be combined Figure 1 The embodiments of the present invention are described in further detail.

[0049] First, in step 101, the current position coordinates of the mouse pointer on the screen are obtained.

[0050] In an embodiment of the present invention, a two-dimensional coordinate system is established based on a computer screen, and the position coordinates of a mouse pointer in the two-dimensional coordinate system, ie, X and Y coordinates, are obtained.

[0051] In step 102, a mouse offset ratio value is calculated.

[0052] In the embodiment of the present invention, according to the acquired position coordinates of the mouse pointer on the screen, the position coordinates are subtracted from the screen center coordinates to obtain the mouse offset ratio values ​​in the X and Y directions, respectively.

[0053] In step 103, input values ​​of the pitch axis and the yaw axis of the aircraft are set.

[0054] In this step, the input values ​​of the pitch axis and the yaw axis of the aircraft are set according to the mouse offset ratio value calculated in step 102, wherein the mouse offset ratio value in the X direction is set as the input value of the yaw axis, and the mouse offset ratio value in the Y direction is set as the input value of the pitch axis.

[0055] In the embodiment of the present invention, the mouse offset ratio value in the X direction is set as the input value of the yaw axis, and the range is limited to between -1 and +1, so that the input target angular velocity value can be easily calculated. For example, +1 in the X direction represents the rightmost side, which means that the current yaw angular velocity value is the maximum. Similarly, the mouse offset ratio value in the Y direction is set as the input value of the pitch axis, and the range is also limited to between -1 and +1.

[0056] In step 104, the offset angle in the pitch axis direction is calculated.

[0057] This step includes: multiplying the input value of the pitch axis by the maximum pitch angular velocity to obtain a target pitch angular velocity value; calculating the pitch angular velocity step value of the current game frame according to the running time period of the current game frame and the pitch angular acceleration; adding the pitch angular velocity step value of the current game frame to the pitch angular velocity to obtain the pitch angular velocity of the current game frame, and the pitch angular velocity cannot exceed the target pitch angular velocity value; multiplying the pitch angular velocity of the current game frame by the running time period of the current game frame to obtain the offset angle in the direction of the pitch axis. Similarly, the offset angle in the direction of the yaw axis can be calculated.

[0058] In the embodiment of the present invention, the default value (default value) of the maximum pitch angular velocity is 90, that is, the maximum pitch angular velocity is 90 degrees per second. Generally, the maximum pitch angular velocity value can be set in the range of 60 to 360. The pitch angular velocity step value is equal to the pitch angular acceleration value multiplied by the running time period of the current game frame. The pitch angular acceleration value is preset (such as 20).

[0059] In step 105, the offset angle in the yaw axis direction is calculated.

[0060] In this step, the input value of the deflection axis is multiplied by the maximum deflection angular velocity to obtain the target deflection angular velocity value; the deflection angular velocity step value of the current game frame is calculated according to the running time period of the current game frame and the deflection angular acceleration; the deflection angular velocity is added to the pitch angular velocity step value of the current frame to obtain the deflection angular velocity of the current game frame, and the deflection angular velocity cannot exceed the target deflection angular velocity value; the deflection angular velocity of the current game frame is multiplied by the running time period of the current frame to obtain the offset angle in the deflection axis direction.

[0061] In the embodiment of the present invention, the default value (default value) of the maximum deflection angular velocity is 90, that is, the maximum deflection angular velocity is 90 degrees per second. Generally, the maximum deflection angular velocity value can be set in the range of 60 to 360. The deflection angular velocity step value is equal to the deflection angular acceleration value multiplied by the running time period of the current game frame.

[0062] In step 106 , the offset angle in the roll axis direction is calculated.

[0063] In an embodiment of the present invention, the target angle value of the roll axis is calculated based on the input value of the yaw axis and the maximum roll angle; the roll axis roll damping is processed to obtain the offset angle in the roll axis direction. Among them, roll damping means that when the aircraft is tilted (rolled), according to the target angle value, the angle is first increased and then decreased. This movement mode has a damping and deceleration effect. The specific calculation process includes:

[0064] (1) Calculating the target angle value of the roll axis, that is, multiplying the input value of the yaw axis (in this embodiment, the range is -1 to +1) by the maximum roll angle value to obtain the target angle value of the roll axis;

[0065] (2) Based on the existing data, use the one-dimensional uniform acceleration motion formula to calculate the intermediate target angular velocity value. Specifically, in order to achieve the damping motion effect, we need to divide the process of moving to the target angular velocity into two stages: acceleration and deceleration. Taking the current angular velocity as the starting point and the target angular velocity as the end point, apply the one-dimensional uniform acceleration motion formula to calculate the intermediate target angular velocity value. The derived formula for the intermediate target angular velocity is as follows:

[0066]

[0067] (3) According to the game frame time, the rolling angular acceleration value, and the target angular velocity value, the current angular velocity value is calculated (after reaching the intermediate angular velocity value, the target angular velocity value needs to be zero). Specifically, the process of calculating the current angular velocity value is as follows:

[0068] Step sign = sign (current angular velocity - target angular velocity)

[0069] Angular velocity step = step sign × game frame time × roll angular acceleration

[0070] Current angular velocity = original angular velocity + angular velocity step

[0071] Note: If the calculated current angular velocity exceeds the target angular velocity, it will be limited to the target angular velocity;

[0072] (4) According to the roll offset angular velocity value (i.e., current angular velocity) and the game frame time, the offset angle of the roll axis is calculated:

[0073] Offset angle = current angular velocity × game frame time

[0074] In the embodiment of the present invention, the game frame time refers to the time difference between the current game frame and the previous frame. For example, for a game running at a frame rate of 60, its average game frame time is 16.67 milliseconds.

[0075] The reason why the target angle value of the roll axis can be calculated based on the input value of the yaw axis is that when flying, the aircraft always rolls the fuselage and then pulls up the joystick to turn. The yaw means the target direction of the fuselage turning, so it can be handled in this way.

[0076] In step 107, the offset angles in various directions are added to various axial angles of the aircraft.

[0077] The present invention uses the offset ratio of the mouse position as input, the X and Y directions of the mouse drag as the aircraft movement toward the target, and the uniform acceleration motion mode to calculate the axial angle values ​​of the aircraft. From the visual performance, the aircraft rotation will change continuously according to the mouse drag and conform to the rotation law of the aircraft attitude; at the same time, the aircraft attitude performance is very close to the effect of the calculation method based on physical rules, and a more realistic flight attitude can be obtained in terms of performance.

[0078] In an embodiment of the present invention, an electronic device is also provided. Figure 2 Schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Figure 2 As shown, the electronic device of the present invention includes a processor 201 and a memory 202, wherein:

[0079] The memory 202 stores a computer program, and when the computer program is read and executed by the processor 201, the computer program executes the steps in the embodiment of the aircraft attitude simulation method based on mouse input control as described above.

[0080] In an embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the steps in the embodiment of the aircraft attitude simulation method based on mouse input control as described above when running.

[0081] In this embodiment, the above-mentioned computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0082] Those skilled in the art can understand that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention is described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions recorded in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for simulating aircraft attitude based on mouse input control, characterized in that: The following steps are involved: Get the current position coordinates of the mouse pointer on the screen, and calculate the mouse offset ratio values ​​in the X and Y directions based on the position coordinates; According to the mouse offset ratio values ​​in the X and Y directions, the input values ​​of the pitch axis and the yaw axis of the aircraft are set; Calculate the offset angle in the pitch axis direction, the offset angle in the yaw axis direction and the offset angle in the roll axis direction respectively; The offset angle in the pitch axis direction, the offset angle in the yaw axis direction, and the offset angle in the roll axis direction are added to each axial angle of the aircraft.

2. The method for simulating aircraft attitude based on mouse input control according to claim 1, characterized in that: The step of obtaining the current position coordinates of the mouse on the screen and calculating the mouse offset ratio values ​​in the X and Y directions based on the position coordinates further includes: subtracting the obtained position coordinates from the screen center coordinate value to obtain the mouse offset ratio values ​​in the X and Y directions.

3. The method for simulating aircraft attitude based on mouse input control according to claim 1, characterized in that: The step of setting the input values ​​of the pitch axis and the yaw axis of the aircraft according to the mouse offset ratio value further comprises: The mouse offset ratio value in the X direction is set to the input value of the deflection axis, and the range is limited to between -1 and +1; Sets the mouse offset proportional value in the Y direction to the pitch axis input value, limited to the range between -1 and +1.

4. The method for simulating aircraft attitude based on mouse input control according to claim 1, characterized in that: The step of calculating the offset angle in the pitch axis direction further comprises: Multiply the input value of the pitch axis by the maximum pitch angular velocity to obtain the target pitch angular velocity value; Calculate the pitch angular velocity step value of the current game frame according to the running time period and pitch angular acceleration of the current game frame; The pitch angular velocity is added to the pitch angular velocity step value of the current game frame to obtain the pitch angular velocity of the current game frame; the pitch angular velocity is less than or equal to the target pitch angular velocity value; The pitch angular velocity is multiplied by the running time period of the current game frame to obtain the offset angle in the pitch axis direction.

5. The method for simulating aircraft attitude based on mouse input control according to claim 1, characterized in that: The step of calculating the offset angle in the deflection axis direction further comprises: The input value of the deflection axis is multiplied by the maximum deflection angular velocity to obtain the target deflection angular velocity value; Calculate the deflection angular velocity step value of the current game frame according to the running time period and deflection angular acceleration of the current game frame; The deflection angular velocity is added to the deflection angular velocity step value of the current game frame to obtain the deflection angular velocity of the current game frame, and the deflection angular velocity is less than or equal to the target deflection angular velocity value; The deflection angular velocity is multiplied by the running time period of the current game frame to obtain the offset angle in the deflection axis direction.

6. The method for simulating aircraft attitude based on mouse input control according to claim 1, characterized in that: The step of calculating the offset angle in the roll axis direction further comprises: Multiplying the input value of the yaw axis by the maximum roll angle to obtain a target angle value of the roll axis; The roll axis roll damping process is performed according to the target angle value to obtain an offset angle in the roll axis direction.

7. The method for simulating aircraft attitude based on mouse input control according to claim 6, characterized in that: The step of performing roll damping processing on the roll axis according to the target angle value to obtain an offset angle in the roll axis direction further comprises: Use the one-dimensional uniform acceleration motion formula to calculate the intermediate target angular velocity value; Calculate the current angular velocity value according to the game frame time, rolling angular acceleration value, and target angular velocity value; The offset angle of the roll axis is calculated based on the roll offset angular velocity value (i.e. the current angular velocity) and the game frame time.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: The processor is used to execute the computer program stored in the memory to implement the aircraft attitude simulation method based on mouse input control as described in any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, which is loaded and executed by a processor to implement the aircraft attitude simulation method based on mouse input control as described in any one of claims 1 to 7.