Interaction method, system, computer equipment and readable storage medium

文档序号:1079917 发布日期:2020-10-20 浏览:30次 中文

阅读说明:本技术 互动方法、系统、计算机设备及可读存储介质 (Interaction method, system, computer equipment and readable storage medium ) 是由 黎平 于 2020-07-07 设计创作,主要内容包括:本发明公开一种互动方法,用户所持移动终端显示第一游戏场景,显示终端显示第二游戏场景,第二游戏场景包含若干供用户选择的角色位置及相应的选择控件和奖品,包括以下步骤:响应于移动终端触发第一游戏场景的进入动作,获取用户在第二游戏场景中选择的角色位置;响应于用户摇动移动终端的动作,获取用户摇动移动终端的角度数据;基于获取的角度数据,生成控制第二游戏场景中选择控件做抛物线运动的速度和方向的控制信号;将控制信号发送至显示终端,以便于显示终端中选择控件基于所述控制信号做抛物线运动选择相应的奖品。通过用户所持移动终端获取用户摇晃移动终端的角度数据来调节用户玩游戏做抛物线运动的角度,能够以友好的交互动画来体现。(The invention discloses an interaction method, wherein a mobile terminal held by a user displays a first game scene, a display terminal displays a second game scene, and the second game scene comprises a plurality of role positions selected by the user, corresponding selection controls and prizes, and the method comprises the following steps: responding to the action of triggering the first game scene by the mobile terminal, and acquiring the role position selected by the user in the second game scene; responding to the action of shaking the mobile terminal by the user, and acquiring angle data of shaking the mobile terminal by the user; generating a control signal for controlling the speed and the direction of the parabolic motion of the selection control in the second game scene based on the acquired angle data; and sending the control signal to a display terminal so that a selection control in the display terminal can conveniently perform parabolic motion based on the control signal to select a corresponding prize. The angle data of shaking the mobile terminal by the user is acquired by the mobile terminal held by the user to adjust the angle of the parabolic motion of the game played by the user, and the method can be embodied by friendly interactive animation.)

1. An interaction method is characterized in that a mobile terminal held by a user displays a first game scene, a display terminal displays a second game scene, and the second game scene comprises a plurality of role positions selected by the user, corresponding selection controls and prizes, and the method comprises the following steps:

responding to the action of triggering the first game scene by the mobile terminal, and acquiring the role position selected by the user in the second game scene;

responding to the action of shaking the mobile terminal by the user, and acquiring angle data of shaking the mobile terminal by the user;

generating a control signal for controlling the speed and the direction of the parabolic motion of the selection control in the second game scene based on the acquired angle data;

and sending the control signal to a display terminal so that a selection control in the display terminal can conveniently perform parabolic motion based on the control signal to select a corresponding prize.

2. The interaction method according to claim 1, wherein a timing control and a direction control are provided in the first game scene, the timing control is used for time-limiting the motion of shaking the mobile terminal by the user, and the direction control is used for deflecting according to the amplitude of shaking the mobile terminal by the user;

and setting a time limit of the timing control in advance, acquiring angle data in the time limit, and taking the angle data close to the time limit end point as effective data.

3. The interactive method as claimed in claim 1, wherein after the control component in the display terminal performs the parabolic motion based on the control signal to select the corresponding prize, the method further comprises the following steps:

acquiring result information for selecting the corresponding prize, and generating corresponding winning information based on the result information;

and sending the winning information to a display terminal and controlling the display terminal to display the winning animation.

4. The interactive method as claimed in claim 3, further comprising the following steps after generating the corresponding winning information based on the result information:

and sending the winning information to a mobile terminal held by a user.

5. The interaction method according to claim 1, wherein the angle data includes a first angle, a second angle and a third angle, the first angle is an angle of rotation around the Z-axis when the mobile terminal is horizontally placed, and the value range is 0 degree to 360 degrees; the second angle is an angle of rotation around the X axis when the mobile terminal is horizontally placed, and the numerical range is-180 degrees to 180 degrees; the third angle is an angle of rotation around the Y axis when the mobile terminal is horizontally placed, the numerical range is-180 degrees to 180 degrees, wherein the X axis, the Y axis and the Z axis are the X axis, the Y axis and the Z axis in a world coordinate system, and the plane where the X axis and the Y axis are located is the plane where the screen of the mobile terminal is located.

6. The interaction method of claim 5, wherein the step of generating a control signal for controlling the speed and direction of the parabolic motion of the selection control in the second game scene based on the obtained angle data comprises the steps of:

converting the angle data to a first quaternion using a quaternion algorithm;

carrying out deformation processing on the first quaternion to obtain a second quaternion matched with a world coordinate system in a first game scene;

obtaining a third quaternion matched with the plane direction of the mobile terminal screen based on the second quaternion, wherein the third quaternion represents the angle of the current screen direction starting from 0 degree and rotating around the Z axis, and obtaining a quaternion matrix according to the third quaternion;

taking the numerical value in the direction of the Z axis of the world coordinate system in the quaternion matrix as the direction of a parabola, presetting a speed sample and placing the speed sample in a plane coordinate system, mapping the numerical values in the directions of the X axis and the Y axis in the quaternion matrix as the plane coordinate in the plane coordinate system to obtain first data, taking the first data as the numerical value in the direction of the X axis, taking the numerical value in the direction of the Z axis of the world coordinate system in the quaternion matrix as the numerical value in the direction of the Y axis, mapping the numerical value in the direction of the Z axis of the world coordinate system in the quaternion matrix as the plane coordinate data in the plane coordinate system again, and obtaining the closest preset speed sample according to a cosine vector;

and taking the speed sample and the direction as the speed and the direction of the control for simulating and selecting the parabolic motion, and further generating a control signal.

7. The interaction method of claim 6, wherein the velocity samples are preset based on a velocity approximation method and placed in a plane coordinate system, specifically: and setting a corresponding animation change rate for each speed sample in advance, finding the speed sample, and taking the speed sample as the change rate of the parabolic motion.

8. An interactive system is characterized by comprising a mobile terminal, a control device and a display terminal, wherein the mobile terminal held by a user displays a first game scene, the display terminal displays a second game scene, the second game scene comprises a plurality of role positions selected by the user, corresponding selection controls and prizes, and the control device comprises a first processing module, a data acquisition module, a signal generation module and a transmission selection module;

the first processing module is used for responding to the action of the mobile terminal for triggering the first game scene to enter, and acquiring the role position selected by the user in the second game scene;

the data acquisition module is used for responding to the action of shaking the mobile terminal by the user and acquiring angle data and strength data of shaking the mobile terminal by the user;

the signal generation module is used for generating a control signal for controlling the speed and the direction of the parabolic motion of the selection control in the second game scene based on the acquired angle data and the acquired force data;

and the sending selection module is used for sending the control signal to the display terminal so as to facilitate the selection control in the display terminal to do parabolic motion based on the control signal to select the corresponding prize.

9. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method steps of any one of claims 1 to 7.

10. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method steps of any of claims 1 to 7 when executing the computer program.

Technical Field

The invention belongs to the technical field of interactive games, and particularly relates to an interactive method, an interactive system, computer equipment and a readable storage medium, which are applied to a double-screen interactive game.

Background

The dual-screen interaction technology refers to a technology for realizing machine-to-machine conversation in an efficient manner through an input-output device. The existing interactive mode of dual-screen interaction generally interacts with a machine system through external devices such as a mouse, a keyboard, a touch screen or a handle, and the machine system then makes a corresponding response.

Currently, gravity sensors are widely applied to portable consumer electronics products, such as mobile terminals, MP3, etc., so as to implement a gravity sensing function. Therefore, how to effectively utilize the upward shaking direction and shaking force of the user intelligent terminal to control the speed and direction of the object doing the parabolic motion on the large screen is a very key index for improving the user experience in the double-screen interactive game. In the prior art, there are several problems: when the intelligent terminal is shaken, the path is not accurate, and the shaken path does not correspond to the corresponding scene set by the game or the position of the layout of the object or the prize page; or the controlled object in the game application should be executed according to the path specified by the user, but the design in the double-screen interaction technology is not fine enough, so that the controlled object deviates from the path specified by the user and does not accord with the interaction of the game application.

Disclosure of Invention

The invention provides an interaction method, an interaction system, a computer device and a readable storage medium, aiming at the defects in the prior art.

In order to solve the technical problem, the invention is solved by the following technical scheme:

an interaction method is characterized in that a mobile terminal held by a user displays a first game scene, a display terminal displays a second game scene, and the second game scene comprises a plurality of role positions selected by the user, corresponding selection controls and prizes, and the method comprises the following steps:

responding to the action of triggering the first game scene by the mobile terminal, and acquiring the role position selected by the user in the second game scene;

responding to the action of shaking the mobile terminal by the user, and acquiring angle data of shaking the mobile terminal by the user;

generating a control signal for controlling the speed and the direction of the parabolic motion of the selection control in the second game scene based on the acquired angle data;

and sending the control signal to a display terminal so that a selection control in the display terminal can conveniently perform parabolic motion based on the control signal to select a corresponding prize.

As an implementation manner, a timing control and a direction control are arranged in the first game scene, the timing control is used for performing time limitation on the action of shaking the mobile terminal by the user, and the direction control is used for deflecting according to the amplitude of shaking the mobile terminal by the user;

and setting a time limit of the timing control in advance, acquiring angle data in the time limit, and taking the angle data close to the time limit end point as effective data.

As an implementation manner, after the control component in the display terminal performs the parabolic motion based on the control signal to select the corresponding prize, the method further includes the following steps:

acquiring result information for selecting the corresponding prize, and generating corresponding winning information based on the result information;

and sending the winning information to a display terminal and controlling the display terminal to display the winning animation.

As an implementation manner, after generating the corresponding winning information based on the result information, the method further comprises the following steps:

and sending the winning information to a mobile terminal held by a user.

As an implementation manner, the angle data includes a first angle, a second angle and a third angle, the first angle is an angle of rotation around the Z axis when the mobile terminal is horizontally placed, and the numerical range is 0 degree to 360 degrees; the second angle is an angle of rotation around the X axis when the mobile terminal is horizontally placed, and the numerical range is-180 degrees to 180 degrees; the third angle is an angle of rotation around the Y axis when the mobile terminal is horizontally placed, the numerical range is-180 degrees to 180 degrees, wherein the X axis, the Y axis and the Z axis are the X axis, the Y axis and the Z axis in a world coordinate system, and the plane where the X axis and the Y axis are located is the plane where the screen of the mobile terminal is located.

As an implementation manner, the generating a control signal for controlling the speed and the direction of the parabolic motion of the selection control in the second game scene based on the acquired angle data includes:

converting the angle data to a first quaternion using a quaternion algorithm;

carrying out deformation processing on the first quaternion to obtain a second quaternion matched with a world coordinate system in a first game scene;

obtaining a third quaternion matched with the plane direction of the mobile terminal screen based on the second quaternion, wherein the third quaternion represents the angle of the current screen direction starting from 0 degree and rotating around the Z axis, and obtaining a quaternion matrix according to the third quaternion;

mapping values in the directions of an X axis and a Y axis in the quaternion matrix into plane coordinates in a plane coordinate system to obtain first data, taking the first data as the values in the direction of the X axis, taking the values in the direction of a Z axis in the world coordinate system in the quaternion matrix as the values in the direction of the Y axis, mapping the values into plane coordinate data in the plane coordinate system again, and obtaining the closest preset speed sample according to a cosine vector method;

and taking the speed sample and the direction as the speed and the direction of the control for simulating and selecting the parabolic motion, and further generating a control signal.

As an implementation manner, the presetting of the speed sample based on the speed approximation method and the placing in the plane coordinate system specifically includes: and setting a corresponding animation change rate for each speed sample in advance, finding the speed sample, and taking the speed sample as the change rate of the parabolic motion.

The invention also discloses:

an interactive system comprises a mobile terminal, a control device and a display terminal, wherein the mobile terminal held by a user displays a first game scene, the display terminal displays a second game scene, the second game scene comprises a plurality of role positions selected by the user, corresponding selection controls and prizes, and the control device comprises a first processing module, a data acquisition module, a signal generation module and a sending selection module;

the first processing module is used for responding to the action of the mobile terminal for triggering the first game scene to enter, and acquiring the role position selected by the user in the second game scene;

the data acquisition module is used for responding to the action of shaking the mobile terminal by the user and acquiring angle data and strength data of shaking the mobile terminal by the user;

the signal generation module is used for generating a control signal for controlling the speed and the direction of the parabolic motion of the selection control in the second game scene based on the acquired angle data and the acquired force data;

and the sending selection module is used for sending the control signal to the display terminal so as to facilitate the selection control in the display terminal to do parabolic motion based on the control signal to select the corresponding prize.

The invention also discloses:

a computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method steps of:

responding to the action of triggering the first game scene by the mobile terminal, and acquiring the role position selected by the user in the second game scene;

responding to the action of shaking the mobile terminal by the user, and acquiring angle data of shaking the mobile terminal by the user;

generating a control signal for controlling the speed and the direction of the parabolic motion of the selection control in the second game scene based on the acquired angle data;

and sending the control signal to a display terminal so that a selection control in the display terminal can conveniently perform parabolic motion based on the control signal to select a corresponding prize.

The invention also discloses:

a computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the following method steps when executing the computer program:

responding to the action of triggering the first game scene by the mobile terminal, and acquiring the role position selected by the user in the second game scene;

responding to the action of shaking the mobile terminal by the user, and acquiring angle data of shaking the mobile terminal by the user;

generating a control signal for controlling the speed and the direction of the parabolic motion of the selection control in the second game scene based on the acquired angle data;

and sending the control signal to a display terminal so that a selection control in the display terminal can conveniently perform parabolic motion based on the control signal to select a corresponding prize.

Due to the adoption of the technical scheme, the invention has the remarkable technical effects that:

by the method and the system, the action of triggering the first game scene to enter can be responded to the mobile terminal, and the role position selected by the user in the second game scene can be obtained; responding to the action of shaking the mobile terminal by the user, and acquiring angle data of shaking the mobile terminal by the user; generating a control signal for controlling the speed and the direction of the parabolic motion of the selection control in the second game scene based on the acquired angle data; and sending the control signal to a display terminal so that a selection control in the display terminal can conveniently perform parabolic motion based on the control signal to select a corresponding prize. The angle data of shaking the mobile terminal by the user is acquired by the mobile terminal held by the user to adjust the angle of the parabolic motion of the game played by the user, and the method can be embodied by friendly interactive animation.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.

FIG. 1 is a schematic overall flow diagram of the present invention;

FIG. 2 is a schematic diagram of the overall architecture of the system of the present invention;

3-4 are schematic illustrations of a first game scenario and a second game scenario of the present invention;

FIG. 5 is a schematic view of the world coordinate system of the present invention.

Fig. 6 is a plan coordinate system view of the present invention.

Detailed Description

The present invention will be described in further detail with reference to examples, which are illustrative of the present invention and are not to be construed as being limited thereto.

In the embodiment of the application, in order to enable a tourist or a user to effectively utilize the swinging direction and the force (precisely, the swinging angle) of the user mobile terminal to interact with a large display screen, in the prior art, when the intelligent terminal is shaken, the path is not accurate, and the shaken path does not correspond to the position of a corresponding scene set by a game or the position of the layout of an article or a prize page; or the controlled object in the game application should be executed according to the path specified by the user, but the design in the double-screen interaction technology is not fine enough, so that the controlled object deviates from the path specified by the user and does not accord with the interaction of the game application. In order to drive enthusiasm of tourists or users, the experience of the users and the tourists is related to the accuracy of the accurate path in the interactive game, the magic ferrule ring is taken as an example in the application, the users or the tourists participate in a magic ferrule ring game in a market, a control signal is generated by obtaining the direction and the strength of swinging a mobile phone, the ferrule ring is displayed on a large screen, and whether prizes can be set or not is seen.

The present application will generally apply to the following devices: the interactive device, i.e. the display terminal, generally adopts LCD to display a large spliced screen, which means that a group of 55-inch LCD spliced screens or other sizes or other single large display screens can be realized. Large displays are typically placed in places where shopping malls, such as atrium, etc., are moving through. The display splicing large screen is used for displaying related image content of the magic ferrule ring, the display content can be called as a second game scene, and prizes and related controls which are interesting to a user are set in the second game scene; the interactive equipment is also control equipment which is used for controlling the long connection between the display and the server and synchronizing and controlling information with the display terminal through the information of the long connection; the user holds the mobile terminal, and the swing direction and the swing force (i.e., the angle data) of the mobile terminal are obtained by shaking the mobile terminal. The application can adopt a long connection technology in the prior art and a mobile phone gyroscope sensor in the mobile terminal, which are the prior art and are not described herein again.

An interaction method is characterized in that a mobile terminal held by a user displays a first game scene, a display terminal displays a second game scene, and the second game scene comprises a plurality of role positions selected by the user, corresponding selection controls and prizes, and the method comprises the following steps:

s100, responding to the action of triggering the mobile terminal to enter the first game scene, and acquiring the position of a role selected by a user in the second game scene;

s200, responding to the action of shaking the mobile terminal by the user, and acquiring angle data of shaking the mobile terminal by the user;

s300, generating a control signal for controlling the speed and the direction of the parabolic motion of the selection control in the second game scene based on the acquired angle data;

s400, sending the control signal to a display terminal so that a selection control in the display terminal can conveniently perform parabolic motion based on the control signal to select a corresponding prize.

With the development of science and technology, the development and application of various interactive games are developed in order to attract more tourists in shopping malls or other public places, the interactive games are designed based on a mobile terminal and a display terminal, the angle data of the shaken mobile terminal is obtained by shaking the mobile terminal held by a user, based on the data, a control device can generate a control signal and send the control signal to the display terminal, so that a control part in the display terminal can select corresponding prizes based on the control signal in a parabolic motion, for example, in order to attract the tourists, various prizes can be set in a second game scene of the display terminal, and thus the tourists can voluntarily participate in activities of merchants to carry out the interactive games. Referring to fig. 3 and 4, fig. 3 is an embodiment of a first game scenario of a mobile terminal, a user may shake an arrow pointer in the first game scenario by shaking the mobile terminal, and angle data of the user shaking the mobile terminal is collected within a specified time, a control device may generate control signals for controlling a speed and a direction of a parabolic motion of a selection control in a second game scenario by the angles, and send the control signals to a display terminal, so that the selection control in the display terminal performs the parabolic motion based on the control signals to select a corresponding prize, and when the corresponding prize is selected, a ring in the mobile terminal may perform a corresponding motion, and the ring may display a demonstration of the parabolic motion, so that the user may more intuitively see which direction the user performs the parabolic motion to select the corresponding prize, as shown in fig. 4, a plurality of character positions for the user to select, and corresponding selection controls in the second game scenario of the display terminal And a prize, wherein the user selects the position of the role, and based on a control signal received by the display terminal, a demonstration animation for selecting the corresponding prize based on the parabolic motion of the control signal is displayed.

Specifically, the mobile terminal comprises a mobile terminal end, a tablet terminal, a PC terminal and the like, the display terminal comprises a display screen, a liquid crystal display and the like, the angle of the user playing the game to do the parabolic motion is adjusted by acquiring the angle data of shaking the mobile terminal by the user through the mobile terminal held by the user, and the friendly interactive animation can be embodied.

In one embodiment, a timing control and a direction control are arranged in the first game scene, the timing control is used for limiting the time of the action of shaking the mobile terminal by the user, and the direction control is used for deflecting according to the amplitude of shaking the mobile terminal by the user; and setting a time limit of the timing control in advance, acquiring angle data in the time limit, and taking the angle data close to the time limit end point as effective data. Specifically, when the user shakes the mobile terminal, timing may be performed, the timing may be countdown or positive timing, for example, in order to achieve fairness of the interactive game, the control device obtains angle data of the first few seconds, which is close to "0" counted down, preferably angle data within 6 seconds before the countdown, and if the timing is positive, angle data within 6 seconds close to the end of the time are also obtained, the angle data are used as valid data, and then calculation is performed based on the valid data, so as to generate a control signal for controlling the speed and the direction of the parabolic motion of the selection control in the second game scene.

In one embodiment, after the control for selecting in the display terminal a corresponding prize is selected based on the parabolic motion of the control signal, the method further includes the following steps:

s500, acquiring result information for selecting corresponding prizes, and generating corresponding winning information based on the result information;

and S600, sending the winning information to a display terminal and controlling the display terminal to display the winning animation.

Specifically, the winning animation can be designed at will, for example, the winning animation can be obtained by summarizing and seeing what animation the user likes based on the big data, and the user can more intuitively see what the user is or whether the user wins the prize by displaying the winning animation, so that the user can be better embodied.

In one embodiment, after generating the corresponding winning information based on the result information, in order to give the best experience to the user, the following steps are further included: and sending the winning information to a mobile terminal held by a user. The user can acquire the winning information of the user through the mobile terminal, for example, the user can feedback the information to the user when the user selects the first-class prize and the second-class prize, etc. or the user does not win the prize, and after the feedback, the corresponding winning information can be displayed in the first game scene.

In one embodiment, in order to obtain angle data more comprehensively and more accurately so as to facilitate higher accuracy of a control signal for subsequently generating a speed and a direction for controlling a control to make a parabolic motion in a second game scene, the angle data includes a first angle, a second angle and a third angle, the first angle is an angle rotated around a Z axis when the mobile terminal is horizontally placed, and the numerical range is 0 degree to 360 degrees; the second angle is an angle of rotation around the X axis when the mobile terminal is horizontally placed, and the numerical range is-180 degrees to 180 degrees; the third angle is an angle of rotation around the Y axis when the mobile terminal is horizontally placed, and the numerical range is-180 degrees to 180 degrees, wherein the X axis, the Y axis and the Z axis are the X axis, the Y axis and the Z axis in a world coordinate system, the plane where the X axis and the Y axis are located is the plane where the mobile terminal screen is located, as shown in the attached drawing 5, the plane where the X axis and the Y axis are located is a plane parallel to the mobile terminal screen, and the Z axis is a plane perpendicular to the plane formed by the X axis and the Y axis.

In one embodiment, the generating a control signal for controlling the speed and the direction of the parabolic motion of the selection control in the second game scene based on the acquired angle data includes:

s310, converting the angle data into a first quaternion by using a quaternion algorithm;

s320, transforming the first quaternion to obtain a second quaternion matched with a world coordinate system in a first game scene;

s330, obtaining a third quaternion matched with the plane direction of the mobile terminal screen based on the second quaternion, wherein the third quaternion represents the angle of the current screen direction starting from 0 degree and rotating around the Z axis, and obtaining a quaternion matrix according to the third quaternion;

s340, mapping values in the directions of an X axis and a Y axis in the quaternion matrix into plane coordinates in a plane coordinate system to obtain first data, taking the first data as the values in the direction of the X axis, taking the values in the direction of a Z axis in the world coordinate system in the quaternion matrix as the values in the direction of the Y axis, mapping the values into plane coordinate data in the plane coordinate system again, and obtaining the closest preset speed sample according to a cosine vector method;

and S350, taking the speed sample and the direction as the speed and the direction of the simulation selection control for making the parabolic motion, and further generating a control signal.

The above steps can be specifically represented as follows: and acquiring basic data, wherein when the user shakes the mobile terminal, the user acquires related data by monitoring a deviceorientation event of the mobile terminal, and the data comprises alpha, beta and gamma, namely the first angle, the second angle and the third angle. The alpha represents the angle of rotation around the Z axis when the mobile terminal is horizontally placed, and the numerical value is 0-360 degrees; beta represents the angle of rotation around the X axis when the mobile terminal is horizontally placed, and the numerical value is-180 degrees to 180 degrees; gamma represents the angle of rotation around the Y axis when the mobile terminal is horizontally placed, and has a value of-180 degrees to 180 degrees, and (X, Y, Z) is a world coordinate system, as shown in fig. 5.

In the prior art, a packaged discovery event is defaulted in a first game scene of a mobile terminal, a javascript provided to an H5 terminal is used for calling, and a mobile terminal H5 program provided with the first game scene monitors the event through the interface. When the mobile terminal is shaken, the data generated by shaking the mobile terminal, such as alpha, beta, gamma, is triggered and transferred by the mobile terminal end H5 by default to have an encapsulated discovery event.

Using quaternion algorithm conversion: and the rotation angles of X, Y and Z axes of the mobile terminal moving from the point A to the point B are calculated by using a quaternion method, and compared with the traditional Euler angle algorithm, the algorithm avoids the defects of numerical value blurring and universal joint locking and is easier to calculate. The device orientation angles alpha (alpha), beta (beta), gamma (gamma) are converted into a unit quaternion q by using the equation (1), wherein alpha is called alpha for short, beta is called beta for short, and gamma is called gamma for short.

Matching the quaternion to "world" coordinates in a gaming application: and (3) performing quaternion 90-degree (theta) deformation (conversion to a radian system) on the quaternion q obtained in the last step on an X axis, namely multiplying the quaternion by qw to obtain a quaternion qw matched with world coordinates, wherein the world coordinate direction in the qw game application is shown in an equation (2).

Figure BDA0002572787510000082

Here, the world in the "world" coordinates means a real world that is perceived by a human, and is a coordinate system in which a coordinate system of a mobile terminal is converted into a coordinate system of a human.

Quaternion and screen orientation matching: as equation (3), the result qw in step 3 is multiplied by the varying quaternion (qs) on the Z-axis to obtain a quaternion qs matching the screen orientation. qs represents the current screen direction, the angle (theta) of rotation around the Z axis from 0 degree, and the value of theta is obtained according to the orientation change event of the monitoring mobile terminal.

Figure BDA0002572787510000083

And calculating a final quaternion matrix R, and obtaining a final quaternion, w, x, y and z according to the previous step.

As long as the mobile terminal shakes, a plurality of quaternion matrixes R can be obtained in real time, data are obtained once within set time, and a plurality of quaternion matrix R values are stored.

Typically, data is taken once in approximately 16.67 milliseconds and a plurality of quaternion matrix R values are saved. As described in one embodiment, in order to better acquire valid data, the invention takes the angle data of the mobile terminal within 6 seconds of shaking. And (3) direction calculation: and taking the Z value in the R value of the quaternion matrix as the direction of the parabola. And (3) calculating the speed: in the actual operation process, the numerical value on each axis in the world coordinate system influences the parabola, the speed in the R value of the quaternion matrix is simulated in real time, and the interactive animation is not good, so that a speed approximation method is adopted, namely, a plurality of speed samples are preset in advance and are placed in the plane coordinate; when a speed sample is preset, data on the X axis, the Y axis and the Z axis of a quaternion matrix are taken into consideration, values in the directions of the X axis and the Y axis in the quaternion matrix are mapped to be planar coordinates in a planar coordinate system and are taken as values, as shown in fig. 6, the values in the directions of the X axis and the Y axis X1 and Y1 are mapped to obtain a, the a is taken as data on the X axis, the value in the direction of the Z axis of a world coordinate system in the quaternion matrix is taken as data on the Y axis of the planar coordinate system, the data on the X axis and the Y axis are mapped again to be planar coordinates in the planar coordinate system and are taken as values; and obtaining the closest structure of the preset speed sample according to the cosine vector method by using the finally obtained value. In practical applications, the calculated result may be many, so that the speed closest to the preset speed sample needs to be selected as the speed of the parabola in many cases.

As shown in fig. 6, b is an X value and a Y value in the R value of the quaternion matrix, which are mapped to a plane coordinate, a is a preset velocity sample value, and the plane uses a cosine vector method to calculate the closest preset velocity sample.

In the above process, the speed sample is preset based on the speed approximation method and placed in the plane coordinate system, specifically: and setting a corresponding animation change rate for each speed sample in advance, finding the speed sample, and taking the speed sample as the change rate of the parabolic motion.

Many unqualified quaternion matrix R values are generated in the above process, so a buffer is provided and positive-distribution threshold filtering is used to reduce noise: when x, y, z in the quaternion matrix R values do not exceed the threshold, filtering out.

The angle data of shaking the mobile terminal by the user is acquired by the mobile terminal held by the user to adjust the angle of the parabolic motion of the game played by the user, and the method can be embodied by friendly interactive animation.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:麻将游戏系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类