JP5872136B2 - Posture calculation device, posture calculation program, game device, game program, posture calculation system, and posture calculation method - Google Patents

Posture calculation device, posture calculation program, game device, game program, posture calculation system, and posture calculation method Download PDF

Info

Publication number
JP5872136B2
JP5872136B2 JP2009054956A JP2009054956A JP5872136B2 JP 5872136 B2 JP5872136 B2 JP 5872136B2 JP 2009054956 A JP2009054956 A JP 2009054956A JP 2009054956 A JP2009054956 A JP 2009054956A JP 5872136 B2 JP5872136 B2 JP 5872136B2
Authority
JP
Japan
Prior art keywords
posture
input device
acceleration
attitude
correction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2009054956A
Other languages
Japanese (ja)
Other versions
JP2010207331A (en
Inventor
賢太 佐藤
賢太 佐藤
敬三 太田
敬三 太田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nintendo Co Ltd
Original Assignee
Nintendo Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nintendo Co Ltd filed Critical Nintendo Co Ltd
Priority to JP2009054956A priority Critical patent/JP5872136B2/en
Priority to EP09160277.1A priority patent/EP2140915B1/en
Priority to US12/472,628 priority patent/US8405611B2/en
Publication of JP2010207331A publication Critical patent/JP2010207331A/en
Priority to US13/768,315 priority patent/US8749490B2/en
Application granted granted Critical
Publication of JP5872136B2 publication Critical patent/JP5872136B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、姿勢算出装置または姿勢算出プログラムに関し、より特定的には、入力装置の姿勢を算出する姿勢算出装置または姿勢算出プログラムに関する。   The present invention relates to an attitude calculation device or an attitude calculation program, and more specifically to an attitude calculation device or an attitude calculation program for calculating the attitude of an input device.

従来、加速度センサおよびジャイロセンサを用いて入力装置の姿勢を算出する技術が考えられている。例えば、特許文献1には、加速度センサおよびジャイロセンサを備えた入力制御装置を使用するゲーム装置が記載されている。このゲーム装置は、ゲームキャラクタが持つ刀を入力制御装置の動きに応じて制御するものである。具体的には、加速度センサの出力に基づいて刀を振る動作のデータが作成され、ジャイロセンサの出力に基づいて刀の姿勢のデータが作成される。   Conventionally, techniques for calculating the attitude of an input device using an acceleration sensor and a gyro sensor have been considered. For example, Patent Document 1 describes a game device that uses an input control device including an acceleration sensor and a gyro sensor. This game device controls a sword possessed by a game character in accordance with the movement of an input control device. Specifically, data on the motion of swinging the sword is created based on the output of the acceleration sensor, and data on the posture of the sword is created based on the output of the gyro sensor.

特開2000−308756号公報JP 2000-308756 A

上記特許文献1のようにジャイロセンサを用いて姿勢を算出する場合、算出される姿勢と入力制御装置の実際の姿勢との間に誤差が生じる。入力制御装置の動きが遅い場合に入力制御装置の角速度がジャイロセンサによって検知されなかったり、逆に、入力制御装置の動きが激しい場合に入力制御装置の角速度がジャイロセンサの検知可能な範囲を超えてしまったりすること等が生じる場合があるからである。また、角速度データの出力の間隔よりも短い期間中に角速度が急激に変化するような場合にも、誤差が発生する可能性がある。そして、角速度から算出される姿勢には、時間とともに角速度の誤差が蓄積されていくことになるので姿勢の誤差が大きくなっていくことになる。特許文献1では、ジャイロセンサから算出される姿勢の誤差を想定していないために、姿勢を正確に算出することができないおそれがある。   When the attitude is calculated using a gyro sensor as in Patent Document 1, an error occurs between the calculated attitude and the actual attitude of the input control device. When the input control device moves slowly, the input controller's angular velocity is not detected by the gyro sensor. Conversely, when the input controller moves excessively, the input controller's angular velocity exceeds the detectable range of the gyro sensor. This is because there is a case where it may occur. An error may also occur when the angular velocity changes suddenly during a period shorter than the output interval of the angular velocity data. Then, since the angular velocity error is accumulated with time in the posture calculated from the angular velocity, the posture error becomes large. In Patent Document 1, since the posture error calculated from the gyro sensor is not assumed, the posture may not be accurately calculated.

それ故、本発明の目的は、角速度センサを用いて入力装置の姿勢を正確に算出することができる姿勢算出装置または姿勢算出プログラムを提供することである。   Therefore, an object of the present invention is to provide an attitude calculation device or an attitude calculation program that can accurately calculate the attitude of an input device using an angular velocity sensor.

本発明は、上記の課題を解決するために、以下の構成を採用した。なお、本欄における括弧内の参照符号および補足説明等は、本発明の理解を助けるために後述する実施形態との対応関係を示したものであって、本発明を何ら限定するものではない。   The present invention employs the following configuration in order to solve the above problems. Note that the reference numerals in parentheses and supplementary explanations in this section show the correspondence with the embodiments described later in order to help understanding of the present invention, and do not limit the present invention.

本発明は、角速度センサ(ジャイロセンサ55,56)と、加速度センサ(37)とを少なくとも備えた入力装置(8)からデータを取得し、3次元の空間における当該入力装置の姿勢を算出する姿勢算出装置である。姿勢算出装置は、姿勢算出手段(ステップS4を実行するCPU10。以下、単にステップ番号のみを記載する。)と、加速度ベクトル算出手段(S2)と、第1補正手段(S5)とを備える。姿勢算出手段は、角速度センサが検出する角速度を取得し、前回の姿勢を当該取得された角速度に応じて回転させることによって新たな姿勢(第1姿勢データ68)を算出する。加速度ベクトル算出手段は、加速度センサからの加速度データ(64)に基づいて入力装置の加速度を示す加速度ベクトル(Va1またはVa2)を算出する。第1補正手段は、空間における加速度ベクトルの方向と空間における鉛直下方向とを近づけるまたは一致させるように、加速度ベクトルの方向の変化に対応させて入力装置の姿勢を補正する。また、第1補正手段は、入力装置の姿勢に関して、当該入力装置に対して設定され、当該入力装置の姿勢に対応する所定軸(図19に示すZ軸ベクトルM1Z)の補正前の向きと補正後の向きとの変化が最も小さくなるように、入力装置の姿勢を補正する。 The present invention obtains data from an input device (8) having at least an angular velocity sensor (gyro sensors 55, 56) and an acceleration sensor (37), and calculates the posture of the input device in a three-dimensional space. It is a calculation device. The posture calculation device includes posture calculation means (CPU 10 that executes step S4; hereinafter, only the step number will be described), acceleration vector calculation means (S2), and first correction means (S5). The attitude calculation means acquires an angular velocity detected by the angular velocity sensor, and calculates a new attitude (first attitude data 68) by rotating the previous attitude in accordance with the acquired angular velocity . The acceleration vector calculation means calculates an acceleration vector (Va1 or Va2) indicating the acceleration of the input device based on the acceleration data (64) from the acceleration sensor. The first correction unit corrects the attitude of the input device in accordance with the change in the direction of the acceleration vector so that the direction of the acceleration vector in the space approaches or matches the vertical downward direction in the space. The first correction means, with respect to the orientation of the input device, is set for the input device, a predetermined axis you correspond to the attitude of the input device before the correction of the (Z-axis vector M1Z shown in FIG. 19) orientation And the orientation of the input device are corrected so that the change between the correction value and the corrected direction is minimized.

本発明によれば、角速度センサを用いて算出される姿勢は、加速度データに基づいて補正されるので、角速度センサから算出される姿勢の誤差を補正することができ、角速度センサを用いて入力装置の姿勢を正確に算出することができる。   According to the present invention, since the posture calculated using the angular velocity sensor is corrected based on the acceleration data, the posture error calculated from the angular velocity sensor can be corrected, and the input device using the angular velocity sensor can be corrected. Can be calculated accurately.

また、本発明によれば、姿勢の補正は、姿勢を表す所定軸に関して、補正前の向きと補正後の向きとの変化が最も小さくなるように行われる。そのため、仮想のゲーム空間内におけるオブジェクトの姿勢を入力装置の姿勢に応じて変化させるゲーム処理においては、上記所定軸に対応するオブジェクトの向きは、補正に起因する変化が最小となる。つまり、上記姿勢の補正が行われても、上記所定軸に対応するオブジェクトの向きの変化をできるだけ小さくすることができる。したがって、本発明によれば、姿勢の補正によるオブジェクトの姿勢の変化をプレイヤが気づきにくくなり、当該補正によってプレイヤが違和感を感じることを防止することができる。その結果、操作性の良いゲーム操作を提供することができる。   Further, according to the present invention, posture correction is performed so that the change between the orientation before correction and the orientation after correction is minimized with respect to a predetermined axis representing the posture. For this reason, in the game process in which the posture of the object in the virtual game space is changed according to the posture of the input device, the change in the orientation of the object corresponding to the predetermined axis is minimized. That is, even if the posture is corrected, the change in the orientation of the object corresponding to the predetermined axis can be made as small as possible. Therefore, according to the present invention, it becomes difficult for the player to notice the change in the posture of the object due to the correction of the posture, and it is possible to prevent the player from feeling uncomfortable due to the correction. As a result, a game operation with good operability can be provided.

また、第1補正手段は、所定軸に垂直な平面(図19に示す平面XY)に加速度ベクトルを投影した方向(投影加速度ベクトルVap)と、当該平面に鉛直下方向を投影した方向(投影重力ベクトルGp)とを近づけるように所定軸回りの回転を行う第1の変換(第1変換行列mtx1)と、第1の変換が行われた加速度ベクトル(図20に示す加速度ベクトルVa’)の方向と鉛直下方向とを近づける回転を行う第2の変換(第2変換行列mtx2)とからなる変換によって入力装置の姿勢を補正してもよい。   In addition, the first correction unit projects a direction (projection acceleration vector Vap) in which an acceleration vector is projected onto a plane perpendicular to a predetermined axis (plane XY shown in FIG. 19), and a direction (projection gravity) in which a vertical downward direction is projected onto the plane. Direction of the first transformation (first transformation matrix mtx1) that rotates about a predetermined axis so as to approach the vector Gp) and the acceleration vector (acceleration vector Va ′ shown in FIG. 20) on which the first transformation has been performed. And the attitude of the input device may be corrected by a conversion consisting of a second conversion (second conversion matrix mtx2) that performs rotation to bring the vertical direction downward.

上記によれば、所定軸回りの回転を行う第1の変換と、第1の変換が行われた加速度ベクトルの方向と鉛直下方向とを近づける回転を行う第2の変換とによって入力装置の姿勢を補正するので、当該補正による所定軸の向きの変化を容易かつ確実に最小とすることができる。   According to the above, the attitude of the input device is determined by the first transformation that rotates about a predetermined axis and the second transformation that rotates to bring the direction of the acceleration vector subjected to the first transformation closer to the vertical downward direction. Therefore, the change in the direction of the predetermined axis due to the correction can be easily and surely minimized.

また、第1補正手段は、加速度ベクトルの方向と鉛直下方向とが一致するように入力装置の姿勢を補正してもよい(S31−S37)。   The first correction unit may correct the attitude of the input device so that the direction of the acceleration vector coincides with the vertical downward direction (S31-S37).

上記によれば、加速度ベクトルの方向と鉛直下方向とが一致するように入力装置の姿勢を補正することによって、姿勢を迅速に補正することができる。特に、本発明では、補正による所定軸の変化を小さくしているので、姿勢を迅速に補正する場合であっても、姿勢の補正によるオブジェクトの姿勢の変化をプレイヤが気づきにくくなる。   According to the above, the posture can be quickly corrected by correcting the posture of the input device so that the direction of the acceleration vector coincides with the vertically downward direction. In particular, in the present invention, since the change in the predetermined axis due to the correction is reduced, even if the posture is corrected quickly, the player is less likely to notice the change in the posture of the object due to the correction of the posture.

また、第1補正手段は、加速度ベクトルの大きさが重力加速度の大きさに近いほど、加速度ベクトルの方向と空間における鉛直下方向とが近づくように、入力装置の姿勢の補正量を制御してもよい。   The first correction means controls the correction amount of the attitude of the input device so that the direction of the acceleration vector and the vertical downward direction in the space become closer as the acceleration vector is closer to the gravitational acceleration. Also good.

上記によれば、加速度センサによって検出された加速度の大きさが重力加速度の大きさに近いほど、入力装置の姿勢がより大きく補正されることになる。ここで、加速度センサの検出結果は、加速度の大きさが重力加速度の大きさが近いほど、重力加速度の方向をより正確に示していると推測され、重力加速度の方向が正確に得られていると推測される。上記によれば、重力加速度の方向が正確に得られている場合ほど、当該重力加速度を基準とした補正が強く反映され、重力加速度の方向があまり正確に得られていない場合には、当該重力加速度を基準とした補正があまり反映されないこととなる。これによって、補正後の姿勢をより正確に算出することができる。   According to the above, the posture of the input device is corrected more greatly as the magnitude of the acceleration detected by the acceleration sensor is closer to the magnitude of the gravitational acceleration. Here, the detection result of the acceleration sensor is estimated that the closer the magnitude of acceleration is to the magnitude of gravity acceleration, the more accurately the direction of gravity acceleration is indicated, and the direction of gravity acceleration is obtained accurately. It is guessed. According to the above, the more accurate the direction of gravity acceleration is obtained, the more strongly the correction based on the gravity acceleration is reflected, and when the direction of gravity acceleration is not obtained accurately, the gravity The correction based on the acceleration is not reflected so much. Thereby, the corrected posture can be calculated more accurately.

また、第1補正手段は、加速度ベクトルの大きさと重力加速度の大きさとの差が所定の基準より小さい場合にのみ入力装置の姿勢を補正してもよい。   The first correction unit may correct the attitude of the input device only when the difference between the magnitude of the acceleration vector and the magnitude of the gravitational acceleration is smaller than a predetermined reference.

上記によれば、加速度ベクトルの大きさと重力加速度の大きさとの差が所定の基準以上である場合には、第1補正手段は補正を行わない。つまり、加速度ベクトルが重力加速度の方向を正確に示していないと推測される場合には(不正確な)加速度ベクトルを用いた補正を行わないようにすることによって、結果的に、姿勢をより正確に算出することができる。   According to the above, when the difference between the magnitude of the acceleration vector and the magnitude of the gravitational acceleration is equal to or greater than a predetermined reference, the first correction unit does not perform correction. In other words, if it is assumed that the acceleration vector does not accurately indicate the direction of gravitational acceleration, the correction of the (inaccurate) acceleration vector is not performed, resulting in a more accurate posture. Can be calculated.

また、入力装置は、撮像手段(撮像素子40)をさらに備えていてもよい。このとき、姿勢算出装置は、撮像手段が撮像する所定の撮像対象の画像(撮像画像)に基づいて、入力装置の姿勢をさらに補正する第2補正手段(S6)をさらに備える。   The input device may further include an imaging unit (imaging element 40). At this time, the posture calculation device further includes second correction means (S6) for further correcting the posture of the input device based on a predetermined image to be captured (captured image) picked up by the image pickup means.

上記によれば、撮像手段の画像に基づいて入力装置の姿勢をさらに補正することによって、入力装置の姿勢をより正確に算出することができる。   According to the above, the attitude of the input device can be calculated more accurately by further correcting the attitude of the input device based on the image of the imaging means.

また、第2補正手段は、入力装置の姿勢に所定軸(Z軸)回りの回転を加えることによって入力装置の姿勢を補正してもよい。   The second correction unit may correct the posture of the input device by adding rotation about a predetermined axis (Z axis) to the posture of the input device.

上記によれば、撮像手段の画像に基づく補正は、所定軸回りの回転に関して行われることとなる。所定軸回りの回転であれば、補正がプレイヤに気づかれにくいので、入力装置の操作性を維持しながら、入力装置の姿勢をより正確に算出することができる。   According to the above, the correction based on the image of the imaging unit is performed with respect to the rotation around the predetermined axis. If the rotation is about a predetermined axis, the correction is not easily noticed by the player, so that the attitude of the input device can be calculated more accurately while maintaining the operability of the input device.

また、本発明は、上記の姿勢算出装置によって補正された姿勢を入力装置の姿勢として用いてゲーム処理(S7)を行うゲーム装置として提供されてもよい。   Further, the present invention may be provided as a game device that performs the game process (S7) using the posture corrected by the posture calculation device as the posture of the input device.

上記によれば、ゲームのプレイヤは、加速度データおよび撮像対象の画像に基づいて補正された正確な入力装置の姿勢をゲーム入力として用いてゲーム操作を行うことができるので、入力装置の姿勢に応じたゲーム操作の操作性を向上することができる。   According to the above, the game player can perform the game operation using the accurate attitude of the input device corrected based on the acceleration data and the image to be captured as the game input. The operability of game operations can be improved.

また、本発明は、情報処理装置のコンピュータを上記各手段として機能させる姿勢算出プログラムあるいはゲームプログラムの形態で実施されてもよい。   In addition, the present invention may be implemented in the form of an attitude calculation program or a game program that causes a computer of an information processing apparatus to function as each of the above means.

本発明によれば、角速度センサを用いて算出される姿勢は加速度データに基づいて補正される。これによって、角速度センサから算出される姿勢の誤差を補正することができるので、角速度センサを用いて入力装置の姿勢を正確に算出することができる。   According to the present invention, the posture calculated using the angular velocity sensor is corrected based on the acceleration data. As a result, an error in the posture calculated from the angular velocity sensor can be corrected, so that the posture of the input device can be accurately calculated using the angular velocity sensor.

ゲームシステムの外観図External view of game system ゲーム装置の機能ブロック図Functional block diagram of game device 入力装置の外観構成を示す斜視図The perspective view which shows the external appearance structure of an input device コントローラの外観構成を示す斜視図Perspective view showing the external configuration of the controller コントローラの内部構造を示す図Diagram showing the internal structure of the controller コントローラの内部構造を示す図Diagram showing the internal structure of the controller 入力装置の構成を示すブロック図Block diagram showing the configuration of the input device 第1の姿勢および第2の姿勢を示すベクトルを示す図The figure which shows the vector which shows a 1st attitude | position and a 2nd attitude | position 補正量を示すベクトルv3を示す図The figure which shows vector v3 which shows correction amount 第1補正処理による補正後の第1の姿勢を示すベクトルを示す図The figure which shows the vector which shows the 1st attitude | position after correction | amendment by a 1st correction process. 第1の姿勢および第3の姿勢を示すベクトルを示す図The figure which shows the vector which shows a 1st attitude | position and a 3rd attitude | position 第2補正処理による補正後の第1の姿勢を示す図The figure which shows the 1st attitude | position after correction | amendment by a 2nd correction process. ゲーム装置のメインメモリに記憶される主なデータを示す図The figure which shows the main data memorize | stored in the main memory of a game device ゲーム装置において実行される処理の流れを示すメインフローチャートMain flowchart showing the flow of processing executed in the game device 図14に示す第1補正処理(ステップS5)の第1の処理例の流れを示すフローチャートThe flowchart which shows the flow of the 1st process example of the 1st correction process (step S5) shown in FIG. 空間座標系における重力方向、加速度、および姿勢を表すベクトルを示す図A diagram showing vectors representing the direction of gravity, acceleration, and posture in a spatial coordinate system 図16に示す状態から、加速度ベクトルVaを最短距離で回転させる方法によって第1の姿勢(Z軸ベクトルM1Z)を回転させた状態を示す図The figure which shows the state which rotated the 1st attitude | position (Z-axis vector M1Z) by the method of rotating the acceleration vector Va by the shortest distance from the state shown in FIG. 図14に示す第1補正処理(ステップS5)の第2の処理例の流れを示すフローチャートFlowchart showing the flow of the second processing example of the first correction processing (step S5) shown in FIG. 投影加速度ベクトルおよび投影重力ベクトルを示す図Diagram showing projected acceleration vector and projected gravity vector 図19に示す状態から第1の変換を行った状態を示す図The figure which shows the state which performed the 1st conversion from the state shown in FIG. 図20に示す状態から第2の変換を行った状態を示す図The figure which shows the state which performed the 2nd conversion from the state shown in FIG. 図14に示す第2補正処理(ステップS6)の流れを示すフローチャートFlowchart showing the flow of the second correction process (step S6) shown in FIG. 撮像画像に対応する2次元座標を示す図The figure which shows the two-dimensional coordinate corresponding to a captured image

[ゲームシステムの全体構成]
図1を参照して、本発明の一実施形態に係る姿勢算出装置の一例であるゲーム装置を含むゲームシステム1について説明する。図1は、ゲームシステム1の外観図である。以下、据置型のゲーム装置を一例にして、本実施形態のゲーム装置およびゲームプログラムについて説明する。図1において、ゲームシステム1は、テレビジョン受像器(以下、単に「テレビ」と記載する)2、ゲーム装置3、光ディスク4、入力装置8、およびマーカ部6を含む。本システムは、入力装置8を用いたゲーム操作に基づいてゲーム装置3でゲーム処理を実行するものである。
[Overall configuration of game system]
With reference to FIG. 1, a game system 1 including a game apparatus, which is an example of an attitude calculation apparatus according to an embodiment of the present invention, will be described. FIG. 1 is an external view of the game system 1. Hereinafter, the game apparatus and the game program of the present embodiment will be described using a stationary game apparatus as an example. In FIG. 1, the game system 1 includes a television receiver (hereinafter simply referred to as “TV”) 2, a game device 3, an optical disk 4, an input device 8, and a marker unit 6. In the present system, game processing is executed by the game device 3 based on a game operation using the input device 8.

ゲーム装置3には、当該ゲーム装置3に対して交換可能に用いられる情報記憶媒体の一例である光ディスク4が脱着可能に挿入される。光ディスク4には、ゲーム装置3において実行されるためのゲームプログラムが記憶されている。ゲーム装置3の前面には光ディスク4の挿入口が設けられている。ゲーム装置3は、挿入口に挿入された光ディスク4に記憶されているゲームプログラムを読み出して実行することによってゲーム処理を実行する。   An optical disk 4 that is an example of an information storage medium that can be used interchangeably with the game apparatus 3 is detachably inserted into the game apparatus 3. The optical disc 4 stores a game program to be executed on the game apparatus 3. An insertion slot for the optical disk 4 is provided on the front surface of the game apparatus 3. The game apparatus 3 executes a game process by reading and executing a game program stored in the optical disc 4 inserted into the insertion slot.

ゲーム装置3には、表示装置の一例であるテレビ2が接続コードを介して接続される。テレビ2は、ゲーム装置3において実行されるゲーム処理の結果得られるゲーム画像を表示する。また、テレビ2の画面の周辺(図1では画面の上側)には、マーカ部6が設置される。マーカ部6は、その両端に2つのマーカ6Rおよび6Lを備えている。マーカ6R(マーカ6Lも同様)は、具体的には1以上の赤外LEDであり、テレビ2の前方に向かって赤外光を出力する。マーカ部6はゲーム装置3に接続されており、ゲーム装置3はマーカ部6が備える各赤外LEDの点灯を制御することが可能である。   A television 2 which is an example of a display device is connected to the game apparatus 3 via a connection cord. The television 2 displays a game image obtained as a result of the game process executed in the game device 3. In addition, a marker unit 6 is installed around the screen of the television 2 (upper side of the screen in FIG. 1). The marker unit 6 includes two markers 6R and 6L at both ends thereof. The marker 6R (same for the marker 6L) is specifically one or more infrared LEDs, and outputs infrared light toward the front of the television 2. The marker unit 6 is connected to the game apparatus 3, and the game apparatus 3 can control lighting of each infrared LED included in the marker unit 6.

入力装置8は、自機に対して行われた操作の内容を示す操作データをゲーム装置3に与えるものである。本実施形態では、入力装置8はコントローラ5とジャイロセンサユニット7とを含む。詳細は後述するが、入力装置8は、コントローラ5に対してジャイロセンサユニット7が着脱可能に接続されている構成である。コントローラ5とゲーム装置3とは無線通信によって接続される。本実施形態では、コントローラ5とゲーム装置3との間の無線通信には例えばBluetooth(ブルートゥース)(登録商標)の技術が用いられる。なお、他の実施形態においてはコントローラ5とゲーム装置3とは有線で接続されてもよい。   The input device 8 gives operation data indicating the content of the operation performed on the own device to the game device 3. In the present embodiment, the input device 8 includes a controller 5 and a gyro sensor unit 7. Although details will be described later, the input device 8 has a configuration in which a gyro sensor unit 7 is detachably connected to the controller 5. The controller 5 and the game apparatus 3 are connected by wireless communication. In the present embodiment, for example, Bluetooth (registered trademark) technology is used for wireless communication between the controller 5 and the game apparatus 3. In other embodiments, the controller 5 and the game apparatus 3 may be connected by wire.

[ゲーム装置3の内部構成]
次に、図2を参照して、ゲーム装置3の内部構成について説明する。図2は、ゲーム装置3の構成を示すブロック図である。ゲーム装置3は、CPU10、システムLSI11、外部メインメモリ12、ROM/RTC13、ディスクドライブ14、およびAV−IC15等を有する。
[Internal configuration of game device 3]
Next, the internal configuration of the game apparatus 3 will be described with reference to FIG. FIG. 2 is a block diagram showing a configuration of the game apparatus 3. The game apparatus 3 includes a CPU 10, a system LSI 11, an external main memory 12, a ROM / RTC 13, a disk drive 14, an AV-IC 15 and the like.

CPU10は、光ディスク4に記憶されたゲームプログラムを実行することによってゲーム処理を実行するものであり、ゲームプロセッサとして機能する。CPU10は、システムLSI11に接続される。システムLSI11には、CPU10の他、外部メインメモリ12、ROM/RTC13、ディスクドライブ14およびAV−IC15が接続される。システムLSI11は、それに接続される各構成要素間のデータ転送の制御、表示すべき画像の生成、外部装置からのデータの取得等の処理を行う。システムLSIの内部構成について後述する。揮発性の外部メインメモリ12は、光ディスク4から読み出されたゲームプログラムや、フラッシュメモリ17から読み出されたゲームプログラム等のプログラムを記憶したり、各種データを記憶したりするものであり、CPU10のワーク領域やバッファ領域として用いられる。ROM/RTC13は、ゲーム装置3の起動用のプログラムが組み込まれるROM(いわゆるブートROM)と、時間をカウントするクロック回路(RTC:Real Time Clock)とを有する。ディスクドライブ14は、光ディスク4からプログラムデータやテクスチャデータ等を読み出し、後述する内部メインメモリ11eまたは外部メインメモリ12に読み出したデータを書き込む。   The CPU 10 executes a game process by executing a game program stored on the optical disc 4, and functions as a game processor. The CPU 10 is connected to the system LSI 11. In addition to the CPU 10, an external main memory 12, a ROM / RTC 13, a disk drive 14, and an AV-IC 15 are connected to the system LSI 11. The system LSI 11 performs processing such as control of data transfer between components connected thereto, generation of an image to be displayed, and acquisition of data from an external device. The internal configuration of the system LSI will be described later. The volatile external main memory 12 stores a program such as a game program read from the optical disc 4 or a game program read from the flash memory 17, or stores various data. Used as a work area and buffer area. The ROM / RTC 13 includes a ROM (so-called boot ROM) in which a program for starting the game apparatus 3 is incorporated, and a clock circuit (RTC: Real Time Clock) that counts time. The disk drive 14 reads program data, texture data, and the like from the optical disk 4 and writes the read data to an internal main memory 11e or an external main memory 12 described later.

また、システムLSI11には、入出力プロセッサ(I/Oプロセッサ)11a、GPU(Graphics Processor Unit)11b、DSP(Digital Signal Processor)11c、VRA
1d、および内部メインメモリ11eが設けられる。図示は省略するが、これらの構成要素11a〜11eは内部バスによって互いに接続される。
The system LSI 11 includes an input / output processor (I / O processor) 11a, a GPU (Graphics Processor Unit) 11b, a DSP (Digital Signal Processor) 11c, and a VRA.
1d and an internal main memory 11e are provided. Although not shown, these components 11a to 11e are connected to each other by an internal bus.

GPU11bは、描画手段の一部を形成し、CPU10からのグラフィクスコマンド(作画命令)に従って画像を生成する。VRAM11dは、GPU11bがグラフィクスコマンドを実行するために必要なデータ(ポリゴンデータやテクスチャデータ等のデータ)を記憶する。画像が生成される際には、GPU11bは、VRAM11dに記憶されたデータを用いて画像データを作成する。   The GPU 11b forms part of a drawing unit and generates an image according to a graphics command (drawing command) from the CPU 10. The VRAM 11d stores data (data such as polygon data and texture data) necessary for the GPU 11b to execute the graphics command. When an image is generated, the GPU 11b creates image data using data stored in the VRAM 11d.

DSP11cは、オーディオプロセッサとして機能し、内部メインメモリ11eや外部メインメモリ12に記憶されるサウンドデータや音波形(音色)データを用いて、音声データを生成する。   The DSP 11c functions as an audio processor, and generates sound data using sound data and sound waveform (tone color) data stored in the internal main memory 11e and the external main memory 12.

上述のように生成された画像データおよび音声データは、AV−IC15によって読み出される。AV−IC15は、読み出した画像データをAVコネクタ16を介してテレビ2に出力するとともに、読み出した音声データを、テレビ2に内蔵されるスピーカ2aに出力する。これによって、画像がテレビ2に表示されるとともに音がスピーカ2aから出力される。   The image data and audio data generated as described above are read out by the AV-IC 15. The AV-IC 15 outputs the read image data to the television 2 via the AV connector 16, and outputs the read audio data to the speaker 2 a built in the television 2. As a result, an image is displayed on the television 2 and a sound is output from the speaker 2a.

入出力プロセッサ11aは、それに接続される構成要素との間でデータの送受信を実行したり、外部装置からのデータのダウンロードを実行したりする。入出力プロセッサ11aは、フラッシュメモリ17、無線通信モジュール18、無線コントローラモジュール19、拡張コネクタ20、およびメモリカード用コネクタ21に接続される。無線通信モジュール18にはアンテナ22が接続され、無線コントローラモジュール19にはアンテナ23が接続される。   The input / output processor 11a performs transmission / reception of data to / from components connected to the input / output processor 11a and downloads data from an external device. The input / output processor 11a is connected to the flash memory 17, the wireless communication module 18, the wireless controller module 19, the expansion connector 20, and the memory card connector 21. An antenna 22 is connected to the wireless communication module 18, and an antenna 23 is connected to the wireless controller module 19.

入出力プロセッサ11aは、無線通信モジュール18およびアンテナ22を介してネットワークに接続し、ネットワークに接続される他のゲーム装置や各種サーバと通信することができる。入出力プロセッサ11aは、定期的にフラッシュメモリ17にアクセスし、ネットワークへ送信する必要があるデータの有無を検出し、当該データが有る場合には、無線通信モジュール18およびアンテナ22を介してネットワークに送信する。また、入出力プロセッサ11aは、他のゲーム装置から送信されてくるデータやダウンロードサーバからダウンロードしたデータを、ネットワーク、アンテナ22および無線通信モジュール18を介して受信し、受信したデータをフラッシュメモリ17に記憶する。CPU10はゲームプログラムを実行することにより、フラッシュメモリ17に記憶されたデータを読み出してゲームプログラムで利用する。フラッシュメモリ17には、ゲーム装置3と他のゲーム装置や各種サーバとの間で送受信されるデータの他、ゲーム装置3を利用してプレイしたゲームのセーブデータ(ゲームの結果データまたは途中データ)が記憶されてもよい。   The input / output processor 11a is connected to the network via the wireless communication module 18 and the antenna 22, and can communicate with other game devices and various servers connected to the network. The input / output processor 11a periodically accesses the flash memory 17 to detect the presence / absence of data that needs to be transmitted to the network. If there is such data, the input / output processor 11a communicates with the network via the wireless communication module 18 and the antenna 22. Send. Further, the input / output processor 11a receives data transmitted from other game devices and data downloaded from the download server via the network, the antenna 22 and the wireless communication module 18, and receives the received data in the flash memory 17. Remember. By executing the game program, the CPU 10 reads out the data stored in the flash memory 17 and uses it in the game program. In the flash memory 17, in addition to data transmitted and received between the game apparatus 3 and other game apparatuses and various servers, save data (game result data or intermediate data) of the game played using the game apparatus 3 May be stored.

また、入出力プロセッサ11aは、コントローラ5から送信される操作データをアンテナ23および無線コントローラモジュール19を介して受信し、内部メインメモリ11eまたは外部メインメモリ12のバッファ領域に記憶(一時記憶)する。   The input / output processor 11a receives operation data transmitted from the controller 5 via the antenna 23 and the wireless controller module 19, and stores (temporarily stores) the data in the buffer area of the internal main memory 11e or the external main memory 12.

さらに、入出力プロセッサ11aには、拡張コネクタ20およびメモリカード用コネクタ21が接続される。拡張コネクタ20は、USBやSCSIのようなインターフェースのためのコネクタであり、外部記憶媒体のようなメディアを接続したり、他のコントローラのような周辺機器を接続したり、有線の通信用コネクタを接続することによって無線通信モジュール18に替えてネットワークとの通信を行ったりすることができる。メモリカード用コネクタ21は、メモリカードのような外部記憶媒体を接続するためのコネクタである。例えば、入出力プロセッサ11aは、拡張コネクタ20やメモリカード用コネクタ21を介して外部記憶媒体にアクセスし、外部記憶媒体にデータを保存したり、外部記憶媒体からデータを読み出したりすることができる。   Further, an expansion connector 20 and a memory card connector 21 are connected to the input / output processor 11a. The expansion connector 20 is a connector for an interface such as USB or SCSI, and connects a medium such as an external storage medium, a peripheral device such as another controller, or a wired communication connector. By connecting, communication with the network can be performed instead of the wireless communication module 18. The memory card connector 21 is a connector for connecting an external storage medium such as a memory card. For example, the input / output processor 11a can access an external storage medium via the expansion connector 20 or the memory card connector 21 to store data in the external storage medium or read data from the external storage medium.

ゲーム装置3には、電源ボタン24、リセットボタン25、およびイジェクトボタン26が設けられる。電源ボタン24およびリセットボタン25は、システムLSI11に接続される。電源ボタン24がオンされると、ゲーム装置3の各構成要素に対して、図示しないACアダプタを経て電源が供給される。リセットボタン25が押されると、システムLSI11は、ゲーム装置3の起動プログラムを再起動する。イジェクトボタン26は、ディスクドライブ14に接続される。イジェクトボタン26が押されると、ディスクドライブ14から光ディスク4が排出される。   The game apparatus 3 is provided with a power button 24, a reset button 25, and an eject button 26. The power button 24 and the reset button 25 are connected to the system LSI 11. When the power button 24 is turned on, power is supplied to each component of the game apparatus 3 via an AC adapter (not shown). When the reset button 25 is pressed, the system LSI 11 restarts the boot program for the game apparatus 3. The eject button 26 is connected to the disk drive 14. When the eject button 26 is pressed, the optical disk 4 is ejected from the disk drive 14.

[入力装置8の構成]
次に、図3〜図6を参照して、入力装置8について説明する。図3は、入力装置8の外観構成を示す斜視図である。図4は、コントローラ5の外観構成を示す斜視図である。図3は、コントローラ5の上側後方から見た斜視図であり、図4は、コントローラ5を下側前方から見た斜視図である。
[Configuration of Input Device 8]
Next, the input device 8 will be described with reference to FIGS. FIG. 3 is a perspective view showing an external configuration of the input device 8. FIG. 4 is a perspective view showing an external configuration of the controller 5. 3 is a perspective view of the controller 5 as seen from the upper rear side, and FIG. 4 is a perspective view of the controller 5 as seen from the lower front side.

図3および図4において、コントローラ5は、例えばプラスチック成型によって形成されたハウジング31を有している。ハウジング31は、その前後方向(図3に示すZ軸方向)を長手方向とした略直方体形状を有しており、全体として大人や子供の片手で把持可能な大きさである。プレイヤは、コントローラ5に設けられたボタンを押下すること、および、コントローラ5自体を動かしてその位置や姿勢を変えることによってゲーム操作を行うことができる。   3 and 4, the controller 5 includes a housing 31 formed by plastic molding, for example. The housing 31 has a substantially rectangular parallelepiped shape whose longitudinal direction is the front-rear direction (the Z-axis direction shown in FIG. 3), and is a size that can be gripped with one hand of an adult or a child as a whole. The player can perform a game operation by pressing a button provided on the controller 5 and moving the controller 5 itself to change its position and posture.

ハウジング31には、複数の操作ボタンが設けられる。図3に示すように、ハウジング31の上面には、十字ボタン32a、1番ボタン32b、2番ボタン32c、Aボタン32d、マイナスボタン32e、ホームボタン32f、プラスボタン32g、および電源ボタン32hが設けられる。本明細書では、これらのボタン32a〜32hが設けられるハウジング31の上面を「ボタン面」と呼ぶことがある。一方、図4に示すように、ハウジング31の下面には凹部が形成されており、当該凹部の後面側傾斜面にはBボタン32iが設けられる。これらの各操作ボタン32a〜32iには、ゲーム装置3が実行するゲームプログラムに応じた機能が適宜割り当てられる。また、電源ボタン32hは遠隔からゲーム装置3本体の電源をオン/オフするためのものである。ホームボタン32fおよび電源ボタン32hは、その上面がハウジング31の上面に埋没している。これによって、プレイヤがホームボタン32fまたは電源ボタン32hを誤って押下することを防止することができる。   The housing 31 is provided with a plurality of operation buttons. As shown in FIG. 3, a cross button 32a, a first button 32b, a second button 32c, an A button 32d, a minus button 32e, a home button 32f, a plus button 32g, and a power button 32h are provided on the upper surface of the housing 31. It is done. In the present specification, the upper surface of the housing 31 on which these buttons 32a to 32h are provided may be referred to as a “button surface”. On the other hand, as shown in FIG. 4, a recess is formed on the lower surface of the housing 31, and a B button 32i is provided on the rear inclined surface of the recess. A function corresponding to the game program executed by the game apparatus 3 is appropriately assigned to each of the operation buttons 32a to 32i. The power button 32h is for remotely turning on / off the main body of the game apparatus 3. The home button 32 f and the power button 32 h are embedded in the upper surface of the housing 31. This can prevent the player from pressing the home button 32f or the power button 32h by mistake.

ハウジング31の後面にはコネクタ33が設けられている。コネクタ33は、コントローラ5に他の機器(例えば、ジャイロセンサユニット7や他のコントローラ)を接続するために利用される。また、ハウジング31の後面におけるコネクタ33の両側には、上記他の機器が容易に離脱することを防止するために係止穴33aが設けられている。   A connector 33 is provided on the rear surface of the housing 31. The connector 33 is used to connect another device (for example, the gyro sensor unit 7 or another controller) to the controller 5. Further, locking holes 33a are provided on both sides of the connector 33 on the rear surface of the housing 31 in order to prevent the other devices from being easily detached.

ハウジング31上面の後方には複数(図3では4つ)のLED34a〜34dが設けられる。ここで、コントローラ5には、他のメインコントローラと区別するためにコントローラ種別(番号)が付与される。各LED34a〜34dは、コントローラ5に現在設定されている上記コントローラ種別をプレイヤに通知したり、コントローラ5の電池残量をプレイヤに通知したりする等の目的で用いられる。具体的には、コントローラ5を用いてゲーム操作が行われる際、上記コントローラ種別に応じて複数のLED34a〜34dのいずれか1つが点灯する。   A plurality (four in FIG. 3) of LEDs 34 a to 34 d are provided behind the upper surface of the housing 31. Here, the controller type (number) is assigned to the controller 5 to distinguish it from other main controllers. The LEDs 34a to 34d are used for the purpose of notifying the player of the controller type currently set in the controller 5 and notifying the player of the remaining battery level of the controller 5. Specifically, when a game operation is performed using the controller 5, any one of the plurality of LEDs 34a to 34d is turned on according to the controller type.

また、コントローラ5は撮像情報演算部35(図6)を有しており、図4に示すように、ハウジング31前面には撮像情報演算部35の光入射面35aが設けられる。光入射面35aは、マーカ6Rおよび6Lからの赤外光を少なくとも透過する材質で構成される。   Further, the controller 5 has an imaging information calculation unit 35 (FIG. 6), and a light incident surface 35a of the imaging information calculation unit 35 is provided on the front surface of the housing 31, as shown in FIG. The light incident surface 35a is made of a material that transmits at least infrared light from the markers 6R and 6L.

ハウジング31上面における1番ボタン32bとホームボタン32fとの間には、コントローラ5に内蔵されるスピーカ49(図5)からの音を外部に放出するための音抜き孔31aが形成されている。   Between the first button 32b and the home button 32f on the upper surface of the housing 31, a sound release hole 31a for releasing sound from the speaker 49 (FIG. 5) built in the controller 5 is formed.

次に、図5および図6を参照して、コントローラ5の内部構造について説明する。図5および図6は、コントローラ5の内部構造を示す図である。なお、図5は、コントローラ5の上筐体(ハウジング31の一部)を外した状態を示す斜視図である。図6は、コントローラ5の下筐体(ハウジング31の一部)を外した状態を示す斜視図である。図6に示す斜視図は、図5に示す基板30を裏面から見た斜視図となっている。   Next, the internal structure of the controller 5 will be described with reference to FIGS. 5 and 6 are diagrams showing the internal structure of the controller 5. FIG. FIG. 5 is a perspective view showing a state in which the upper housing (a part of the housing 31) of the controller 5 is removed. FIG. 6 is a perspective view showing a state in which the lower casing (a part of the housing 31) of the controller 5 is removed. The perspective view shown in FIG. 6 is a perspective view of the substrate 30 shown in FIG.

図5において、ハウジング31の内部には基板30が固設されており、当該基板30の上主面上に各操作ボタン32a〜32h、各LED34a〜34d、加速度センサ37、アンテナ45、およびスピーカ49等が設けられる。これらは、基板30等に形成された配線(図示せず)によってマイクロコンピュータ(Micro Computer:マイコン)42(図6参照)に接続される。本実施形態では、加速度センサ37は、X軸方向に関してコントローラ5の中心からずれた位置に配置されている。これによって、コントローラ5をZ軸回りに回転させたときのコントローラ5の動きが算出しやすくなる。また、加速度センサ37は、長手方向(Z軸方向)に関してコントローラ5の中心よりも前方に配置されている。また、無線モジュール44(図6)およびアンテナ45によって、コントローラ5がワイヤレスコントローラとして機能する。   In FIG. 5, a substrate 30 is fixed inside the housing 31, and operation buttons 32 a to 32 h, LEDs 34 a to 34 d, an acceleration sensor 37, an antenna 45, and a speaker 49 are provided on the upper main surface of the substrate 30. Etc. are provided. These are connected to a microcomputer (microcomputer) 42 (see FIG. 6) by wiring (not shown) formed on the substrate 30 and the like. In the present embodiment, the acceleration sensor 37 is disposed at a position shifted from the center of the controller 5 with respect to the X-axis direction. This makes it easier to calculate the movement of the controller 5 when the controller 5 is rotated about the Z axis. The acceleration sensor 37 is disposed in front of the center of the controller 5 in the longitudinal direction (Z-axis direction). Further, the controller 5 functions as a wireless controller by the wireless module 44 (FIG. 6) and the antenna 45.

一方、図6において、基板30の下主面上の前端縁に撮像情報演算部35が設けられる。撮像情報演算部35は、コントローラ5の前方から順に赤外線フィルタ38、レンズ39、撮像素子40、および画像処理回路41を備えている。これらの部材38〜41はそれぞれ基板30の下主面に取り付けられる。   On the other hand, in FIG. 6, an imaging information calculation unit 35 is provided at the front edge on the lower main surface of the substrate 30. The imaging information calculation unit 35 includes an infrared filter 38, a lens 39, an imaging element 40, and an image processing circuit 41 in order from the front of the controller 5. These members 38 to 41 are respectively attached to the lower main surface of the substrate 30.

さらに、基板30の下主面上には、上記マイコン42およびバイブレータ48が設けられている。バイブレータ48は、例えば振動モータやソレノイドであり、基板30等に形成された配線によってマイコン42と接続される。マイコン42の指示によりバイブレータ48が作動することによってコントローラ5に振動が発生する。これによって、コントローラ5を把持しているプレイヤの手にその振動が伝達される、いわゆる振動対応ゲームを実現することができる。本実施形態では、バイブレータ48は、ハウジング31のやや前方寄りに配置される。つまり、バイブレータ48がコントローラ5の中心よりも端側に配置することによって、バイブレータ48の振動によりコントローラ5全体を大きく振動させることができる。また、コネクタ33は、基板30の下主面上の後端縁に取り付けられる。なお、図5および図6に示す他、コントローラ5は、マイコン42の基本クロックを生成する水晶振動子、スピーカ49に音声信号を出力するアンプ等を備えている。   Further, the microcomputer 42 and the vibrator 48 are provided on the lower main surface of the substrate 30. The vibrator 48 is, for example, a vibration motor or a solenoid, and is connected to the microcomputer 42 by wiring formed on the substrate 30 or the like. The controller 48 is vibrated by the operation of the vibrator 48 according to the instruction of the microcomputer 42. As a result, a so-called vibration-compatible game in which the vibration is transmitted to the hand of the player holding the controller 5 can be realized. In the present embodiment, the vibrator 48 is disposed slightly forward of the housing 31. That is, by arranging the vibrator 48 on the end side of the center of the controller 5, the entire controller 5 can be vibrated greatly by the vibration of the vibrator 48. The connector 33 is attached to the rear edge on the lower main surface of the substrate 30. 5 and 6, the controller 5 includes a crystal resonator that generates a basic clock of the microcomputer 42, an amplifier that outputs an audio signal to the speaker 49, and the like.

また、ジャイロセンサユニット7は、角速度センサの一例であり、3軸回りの角速度を検知するジャイロセンサ(図7に示すジャイロセンサ55および56)を有する。ジャイロセンサユニット7は、コントローラ5のコネクタ33に着脱可能に装着される。ジャイロセンサユニット7の前端(図3に示すZ軸正方向側の端部)には、コネクタ33に接続可能なプラグ(図7に示すプラグ53)が設けられる。さらに、プラグ53の両側にはフック(図示せず)が設けられる。ジャイロセンサユニット7がコントローラ5に対して装着される状態では、プラグ53がコネクタ33に接続されるとともに、上記フックがコントローラ5の係止穴33aに係止する。これによって、コントローラ5とジャイロセンサユニット7とがしっかりと固定される。また、ジャイロセンサユニット7は側面(図3に示すX軸方向の面)にボタン51を有している。ボタン51は、それを押下すれば上記フックの係止穴33aに対する係止状態を解除することができるように構成されている。したがって、ボタン51を押下しながらプラグ53をコネクタ33から抜くことによって、ジャイロセンサユニット7をコントローラ5から離脱することができる。   The gyro sensor unit 7 is an example of an angular velocity sensor, and includes gyro sensors (gyro sensors 55 and 56 shown in FIG. 7) that detect angular velocities around three axes. The gyro sensor unit 7 is detachably attached to the connector 33 of the controller 5. A plug (plug 53 shown in FIG. 7) that can be connected to the connector 33 is provided at the front end of the gyro sensor unit 7 (end on the Z-axis positive direction side shown in FIG. 3). Further, hooks (not shown) are provided on both sides of the plug 53. In a state where the gyro sensor unit 7 is attached to the controller 5, the plug 53 is connected to the connector 33 and the hook is locked in the locking hole 33 a of the controller 5. Thereby, the controller 5 and the gyro sensor unit 7 are firmly fixed. The gyro sensor unit 7 has a button 51 on a side surface (surface in the X-axis direction shown in FIG. 3). The button 51 is configured such that when the button 51 is pressed, the hook is released from the locked state with respect to the locking hole 33a. Therefore, the gyro sensor unit 7 can be detached from the controller 5 by removing the plug 53 from the connector 33 while pressing the button 51.

また、ジャイロセンサユニット7の後端には、上記コネクタ33と同形状のコネクタが設けられる。したがって、コントローラ5(のコネクタ33)に対して装着可能な他の機器は、ジャイロセンサユニット7のコネクタに対しても装着可能である。なお、図3においては、当該コネクタに対してカバー52が着脱可能に装着されている。   A connector having the same shape as the connector 33 is provided at the rear end of the gyro sensor unit 7. Therefore, other devices that can be attached to the controller 5 (connector 33 thereof) can also be attached to the connector of the gyro sensor unit 7. In FIG. 3, a cover 52 is detachably attached to the connector.

なお、図3〜図6に示したコントローラ5およびジャイロセンサユニット7の形状や、各操作ボタンの形状、加速度センサやバイブレータの数および設置位置等は単なる一例に過ぎず、他の形状、数、および設置位置であっても、本発明を実現することができる。また、本実施形態では、撮像手段による撮像方向はZ軸正方向であるが、撮像方向はいずれの方向であってもよい。すなわち、コントローラ5における撮像情報演算部35の位置(撮像情報演算部35の光入射面35a)は、ハウジング31の前面でなくてもよく、ハウジング31の外部から光を取り入れることができれば他の面に設けられてもかまわない。   The shapes of the controller 5 and the gyro sensor unit 7 shown in FIGS. 3 to 6, the shapes of the operation buttons, the number of acceleration sensors and vibrators, and the installation positions are merely examples, and other shapes, numbers, Even in the installation position, the present invention can be realized. In the present embodiment, the imaging direction by the imaging unit is the positive Z-axis direction, but the imaging direction may be any direction. That is, the position of the imaging information calculation unit 35 in the controller 5 (the light incident surface 35a of the imaging information calculation unit 35) does not have to be the front surface of the housing 31, and other surfaces can be used as long as light can be taken in from the outside of the housing 31. May be provided.

図7は、入力装置8(コントローラ5およびジャイロセンサユニット7)の構成を示すブロック図である。コントローラ5は、操作部32(各操作ボタン32a〜32i)、コネクタ33、撮像情報演算部35、通信部36、および加速度センサ37を備えている。コントローラ5は、自機に対して行われた操作内容を示すデータを操作データとしてゲーム装置3へ送信するものである。   FIG. 7 is a block diagram showing a configuration of the input device 8 (the controller 5 and the gyro sensor unit 7). The controller 5 includes an operation unit 32 (operation buttons 32a to 32i), a connector 33, an imaging information calculation unit 35, a communication unit 36, and an acceleration sensor 37. The controller 5 transmits data indicating the details of the operation performed on the own device to the game apparatus 3 as operation data.

操作部32は、上述した各操作ボタン32a〜32iを含み、各操作ボタン32a〜32iに対する入力状態(各操作ボタン32a〜32iが押下されたか否か)を示す操作ボタンデータを通信部36のマイコン42へ出力する。   The operation unit 32 includes the operation buttons 32a to 32i described above, and the operation button data indicating the input state (whether or not each operation button 32a to 32i is pressed) to each operation button 32a to 32i is transmitted to the microcomputer of the communication unit 36. Output to 42.

撮像情報演算部35は、撮像手段が撮像した画像データを解析してその中で輝度が高い領域を判別してその領域の重心位置やサイズなどを算出するためのシステムである。撮像情報演算部35は、例えば最大200フレーム/秒程度のサンプリング周期を有するので、比較的高速なコントローラ5の動きでも追跡して解析することができる。   The imaging information calculation unit 35 is a system for analyzing the image data captured by the imaging unit, discriminating a region having a high luminance in the image data, and calculating a center of gravity position, a size, and the like of the region. Since the imaging information calculation unit 35 has a sampling period of, for example, about 200 frames / second at the maximum, it can track and analyze even a relatively fast movement of the controller 5.

撮像情報演算部35は、赤外線フィルタ38、レンズ39、撮像素子40、および画像処理回路41を含んでいる。赤外線フィルタ38は、コントローラ5の前方から入射する光から赤外線のみを通過させる。レンズ39は、赤外線フィルタ38を透過した赤外線を集光して撮像素子40へ入射させる。撮像素子40は、例えばCMOSセンサやあるいはCCDセンサのような固体撮像素子であり、レンズ39が集光した赤外線を受光して画像信号を出力する。ここで、テレビ2の表示画面近傍に配置されるマーカ部6のマーカ6Rおよび6Lは、テレビ2の前方に向かって赤外光を出力する赤外LEDで構成される。したがって、赤外線フィルタ38を設けることによって、撮像素子40は、赤外線フィルタ38を通過した赤外線だけを受光して画像データを生成するので、マーカ6Rおよび6Lの画像をより正確に撮像することができる。以下では、撮像素子40によって撮像された画像を撮像画像と呼ぶ。撮像素子40によって生成された画像データは、画像処理回路41で処理される。画像処理回路41は、撮像画像内における撮像対象(マーカ6Rおよび6L)の位置を算出する。画像処理回路41は、算出された位置を示す座標を通信部36のマイコン42へ出力する。この座標のデータは、マイコン42によって操作データとしてゲーム装置3に送信される。以下では、上記座標を「マーカ座標」と呼ぶ。マーカ座標はコントローラ5自体の向き(傾斜角度)や位置に対応して変化するので、ゲーム装置3はこのマーカ座標を用いてコントローラ5の向きや位置を算出することができる。   The imaging information calculation unit 35 includes an infrared filter 38, a lens 39, an imaging element 40, and an image processing circuit 41. The infrared filter 38 passes only infrared rays from the light incident from the front of the controller 5. The lens 39 collects the infrared light transmitted through the infrared filter 38 and makes it incident on the image sensor 40. The image sensor 40 is a solid-state image sensor such as a CMOS sensor or a CCD sensor, for example, and receives the infrared light collected by the lens 39 and outputs an image signal. Here, the markers 6 </ b> R and 6 </ b> L of the marker unit 6 disposed in the vicinity of the display screen of the television 2 are configured by infrared LEDs that output infrared light toward the front of the television 2. Therefore, by providing the infrared filter 38, the image sensor 40 receives only the infrared light that has passed through the infrared filter 38 and generates image data, so that the images of the markers 6R and 6L can be captured more accurately. Hereinafter, an image captured by the image sensor 40 is referred to as a captured image. Image data generated by the image sensor 40 is processed by the image processing circuit 41. The image processing circuit 41 calculates the position of the imaging target (markers 6R and 6L) in the captured image. The image processing circuit 41 outputs coordinates indicating the calculated position to the microcomputer 42 of the communication unit 36. The coordinate data is transmitted to the game apparatus 3 as operation data by the microcomputer 42. Hereinafter, the coordinates are referred to as “marker coordinates”. Since the marker coordinates change corresponding to the direction (tilt angle) and position of the controller 5 itself, the game apparatus 3 can calculate the direction and position of the controller 5 using the marker coordinates.

なお、他の実施形態においては、コントローラ5は画像処理回路41を備えていない構成であってもよく、撮像画像自体がコントローラ5からゲーム装置3へ送信されてもよい。このとき、ゲーム装置3は、画像処理回路41と同様の機能を有する回路あるいはプログラムを有しており、上記マーカ座標を算出するようにしてもよい。   In other embodiments, the controller 5 may not include the image processing circuit 41, and the captured image itself may be transmitted from the controller 5 to the game apparatus 3. At this time, the game apparatus 3 may have a circuit or a program having the same function as the image processing circuit 41, and may calculate the marker coordinates.

加速度センサ37は、コントローラ5の加速度(重力加速度を含む)を検出する、すなわち、コントローラ5に加わる力(重力を含む)を検出する。加速度センサ37は、当該加速度センサ37の検出部に加わっている加速度のうち、センシング軸方向に沿った直線方向の加速度(直線加速度)の値を検出する。例えば、2軸以上の多軸加速度センサの場合には、加速度センサの検出部に加わっている加速度として、各軸に沿った成分の加速度をそれぞれ検出する。例えば、3軸または2軸の加速度センサは、アナログ・デバイセズ株式会社(Analog Devices, Inc.)またはSTマイクロエレクトロニクス社(STMicroelectronics N.V.)から入手可能である種類のものでもよい。なお、加速度センサ37は、例えば静電容量式の加速度センサであるとするが、他の方式の加速度センサを用いるようにしてもよい。   The acceleration sensor 37 detects the acceleration (including gravity acceleration) of the controller 5, that is, detects the force (including gravity) applied to the controller 5. The acceleration sensor 37 detects the value of the acceleration (linear acceleration) in the linear direction along the sensing axis direction among the accelerations applied to the detection unit of the acceleration sensor 37. For example, in the case of a multi-axis acceleration sensor having two or more axes, the component acceleration along each axis is detected as the acceleration applied to the detection unit of the acceleration sensor. For example, the triaxial or biaxial acceleration sensor may be of the type available from Analog Devices, Inc. or ST Microelectronics NV. The acceleration sensor 37 is, for example, a capacitance type acceleration sensor, but other types of acceleration sensors may be used.

本実施形態では、加速度センサ37は、コントローラ5を基準とした上下方向(図3に示すY軸方向)、左右方向(図3に示すX軸方向)および前後方向(図3に示すZ軸方向)の3軸方向に関してそれぞれ直線加速度を検出する。加速度センサ37は、各軸に沿った直線方向に関する加速度を検出するものであるため、加速度センサ37からの出力は3軸それぞれの直線加速度の値を表すものとなる。すなわち、検出された加速度は、入力装置8(コントローラ5)を基準に設定されるXYZ座標系(コントローラ座標系)における3次元のベクトル(ax,ay,az)として表される。以下では、加速度センサ37によって検出される3軸に関する各加速度値を各成分とするベクトルを加速度ベクトルと呼ぶ。   In the present embodiment, the acceleration sensor 37 has a vertical direction (Y-axis direction shown in FIG. 3), a horizontal direction (X-axis direction shown in FIG. 3), and a front-back direction (Z-axis direction shown in FIG. 3) with reference to the controller 5. ) Linear acceleration is detected in each of the three axis directions. Since the acceleration sensor 37 detects acceleration in the linear direction along each axis, the output from the acceleration sensor 37 represents the linear acceleration value of each of the three axes. That is, the detected acceleration is represented as a three-dimensional vector (ax, ay, az) in an XYZ coordinate system (controller coordinate system) set with reference to the input device 8 (controller 5). Hereinafter, a vector having the respective acceleration values related to the three axes detected by the acceleration sensor 37 as components is referred to as an acceleration vector.

加速度センサ37が検出した加速度を示すデータ(加速度データ)は、通信部36へ出力される。なお、加速度センサ37が検出した加速度は、コントローラ5自体の向き(傾斜角度)や動きに対応して変化するので、ゲーム装置3は加速度データを用いてコントローラ5の向きや動きを算出することができる。本実施形態では、ゲーム装置3は、加速度データに基づいてコントローラ5の姿勢を判断する。   Data indicating the acceleration detected by the acceleration sensor 37 (acceleration data) is output to the communication unit 36. The acceleration detected by the acceleration sensor 37 changes in accordance with the direction (tilt angle) and movement of the controller 5 itself, so that the game apparatus 3 can calculate the direction and movement of the controller 5 using the acceleration data. it can. In the present embodiment, the game apparatus 3 determines the attitude of the controller 5 based on the acceleration data.

加速度センサ37が検出した加速度(加速度ベクトル)を示すデータ(加速度データ)は、通信部36へ出力される。本実施形態において、加速度センサ37は、コントローラ5の傾斜角度を判断するためのデータを出力するセンサとして用いられる。   Data (acceleration data) indicating the acceleration (acceleration vector) detected by the acceleration sensor 37 is output to the communication unit 36. In the present embodiment, the acceleration sensor 37 is used as a sensor that outputs data for determining the tilt angle of the controller 5.

なお、加速度センサ37から出力される加速度の信号に基づいて、ゲーム装置3のプロセッサ(例えばCPU10)またはコントローラ5のプロセッサ(例えばマイコン42)等のコンピュータが処理を行うことによって、コントローラ5に関するさらなる情報を推測または算出(判定)することができることは、当業者であれば本明細書の説明から容易に理解できるであろう。例えば、加速度センサ37を搭載するコントローラ5が静止状態であることを前提としてコンピュータ側の処理が実行される場合(すなわち、加速度センサによって検出される加速度が重力加速度のみであるとして処理が実行される場合)、コントローラ5が現実に静止状態であれば、検出された加速度に基づいてコントローラ5の姿勢が重力方向に対して傾いているか否かまたはどの程度傾いているかを知ることができる。具体的には、加速度センサ37の検出軸が鉛直下方向を向いている状態を基準としたとき、1G(重力加速度)がかかっているか否かによって、コントローラ5が基準に対して傾いているか否かを知ることができるし、その大きさによって基準に対してどの程度傾いているかも知ることができる。また、多軸の加速度センサ37の場合には、さらに各軸の加速度の信号に対して処理を施すことによって、重力方向に対してコントローラ5がどの程度傾いているかをより詳細に知ることができる。この場合において、プロセッサは、加速度センサ37からの出力に基づいてコントローラ5の傾斜角度を算出してもよいし、当該傾斜角度を算出せずに、コントローラ5の傾斜方向を算出するようにしてもよい。このように、加速度センサ37をプロセッサと組み合わせて用いることによって、コントローラ5の傾斜角度または姿勢を判定することができる。   In addition, based on the acceleration signal output from the acceleration sensor 37, a computer such as a processor (for example, the CPU 10) of the game apparatus 3 or a processor (for example, the microcomputer 42) of the controller 5 performs processing, whereby further information regarding the controller 5 is obtained. Those skilled in the art will be able to easily understand from the description of the present specification that can be estimated or calculated (determined). For example, when processing on the computer side is executed on the assumption that the controller 5 on which the acceleration sensor 37 is mounted is stationary (that is, the processing is executed assuming that the acceleration detected by the acceleration sensor is only gravitational acceleration). When the controller 5 is actually stationary, it can be determined whether or not the attitude of the controller 5 is inclined with respect to the direction of gravity based on the detected acceleration. Specifically, whether or not the controller 5 is inclined with respect to the reference depending on whether or not 1G (gravity acceleration) is applied, based on the state in which the detection axis of the acceleration sensor 37 is directed vertically downward. It is possible to know how much it is inclined with respect to the reference according to its size. Further, in the case of the multi-axis acceleration sensor 37, it is possible to know in detail how much the controller 5 is inclined with respect to the direction of gravity by further processing the acceleration signal of each axis. . In this case, the processor may calculate the tilt angle of the controller 5 based on the output from the acceleration sensor 37, or may calculate the tilt direction of the controller 5 without calculating the tilt angle. Good. Thus, by using the acceleration sensor 37 in combination with the processor, the tilt angle or posture of the controller 5 can be determined.

一方、コントローラ5が動的な状態(コントローラ5が動かされている状態)であることを前提とする場合には、加速度センサ37は重力加速度に加えてコントローラ5の動きに応じた加速度を検出するので、検出された加速度から重力加速度の成分を所定の処理により除去することによってコントローラ5の動き方向を知ることができる。また、コントローラ5が動的な状態であることを前提とする場合であっても、検出された加速度から、加速度センサの動きに応じた加速度の成分を所定の処理により除去することによって、重力方向に対するコントローラ5の傾きを知ることが可能である。なお、他の実施例では、加速度センサ37は、内蔵の加速度検出手段で検出された加速度信号をマイコン42に出力する前に当該加速度信号に対して所定の処理を行うための、組込み式の処理装置または他の種類の専用の処理装置を備えていてもよい。組込み式または専用の処理装置は、例えば、加速度センサ37が静的な加速度(例えば、重力加速度)を検出するために用いられる場合、加速度信号を傾斜角(あるいは、他の好ましいパラメータ)に変換するものであってもよい。   On the other hand, when it is assumed that the controller 5 is in a dynamic state (a state in which the controller 5 is moved), the acceleration sensor 37 detects an acceleration corresponding to the movement of the controller 5 in addition to the gravitational acceleration. Therefore, the movement direction of the controller 5 can be known by removing the gravitational acceleration component from the detected acceleration by a predetermined process. Even if it is assumed that the controller 5 is in a dynamic state, the direction of gravity is obtained by removing the acceleration component corresponding to the movement of the acceleration sensor from the detected acceleration by a predetermined process. It is possible to know the inclination of the controller 5 with respect to. In another embodiment, the acceleration sensor 37 is a built-in process for performing a predetermined process on the acceleration signal before outputting the acceleration signal detected by the built-in acceleration detection means to the microcomputer 42. An apparatus or other type of dedicated processing apparatus may be provided. A built-in or dedicated processing device converts the acceleration signal into a tilt angle (or other preferred parameter) if, for example, the acceleration sensor 37 is used to detect static acceleration (eg, gravitational acceleration). It may be a thing.

通信部36は、マイコン42、メモリ43、無線モジュール44、およびアンテナ45を含んでいる。マイコン42は、処理を行う際にメモリ43を記憶領域として用いながら、マイコン42が取得したデータをゲーム装置3へ無線送信する無線モジュール44を制御する。また、マイコン42はコネクタ33に接続されている。ジャイロセンサユニット7から送信されてくるデータは、コネクタ33を介してマイコン42に入力される。以下、ジャイロセンサユニット7の構成について説明する。   The communication unit 36 includes a microcomputer 42, a memory 43, a wireless module 44, and an antenna 45. The microcomputer 42 controls the wireless module 44 that wirelessly transmits data acquired by the microcomputer 42 to the game apparatus 3 while using the memory 43 as a storage area when performing processing. The microcomputer 42 is connected to the connector 33. Data transmitted from the gyro sensor unit 7 is input to the microcomputer 42 via the connector 33. Hereinafter, the configuration of the gyro sensor unit 7 will be described.

ジャイロセンサユニット7は、プラグ53、マイコン54、2軸ジャイロセンサ55、および1軸ジャイロセンサ56を備えている。上述のように、ジャイロセンサユニット7は、3軸(本実施形態では、XYZ軸)回りの角速度を検出し、検出した角速度を示すデータ(角速度データ)をコントローラ5へ送信する。   The gyro sensor unit 7 includes a plug 53, a microcomputer 54, a 2-axis gyro sensor 55, and a 1-axis gyro sensor 56. As described above, the gyro sensor unit 7 detects angular velocities around three axes (XYZ axes in the present embodiment), and transmits data (angular velocity data) indicating the detected angular velocities to the controller 5.

2軸ジャイロセンサ55は、X軸回りの角速度およびY軸回りの(単位時間あたりの)角速度を検出する。また、1軸ジャイロセンサ56は、Z軸回りの(単位時間あたりの)角速度を検出する。なお、本明細書では、コントローラ5の撮像方向(Z軸正方向)を基準として、XYZ軸回りの回転方向を、それぞれ、ロール方向、ピッチ方向、ヨー方向と呼ぶ。すなわち、2軸ジャイロセンサ55は、ロール方向(X軸回りの回転方向)およびピッチ方向(Y軸回りの回転方向)の角速度を検出し、1軸ジャイロセンサ56は、ヨー方向(Z軸回りの回転方向)の角速度を検出する。   The biaxial gyro sensor 55 detects an angular velocity around the X axis and an angular velocity (per unit time) around the Y axis. Further, the uniaxial gyro sensor 56 detects an angular velocity (per unit time) around the Z axis. In this specification, the rotation directions around the XYZ axes are referred to as a roll direction, a pitch direction, and a yaw direction, respectively, with reference to the imaging direction (Z-axis positive direction) of the controller 5. That is, the biaxial gyro sensor 55 detects angular velocities in the roll direction (rotation direction around the X axis) and the pitch direction (rotation direction around the Y axis), and the single axis gyro sensor 56 detects the yaw direction (around the Z axis). Detect the angular velocity in the rotation direction.

なお、本実施形態では、3軸回りの角速度を検出するために、2軸ジャイロセンサ55と1軸ジャイロセンサ56とを用いる構成としたが、他の実施形態においては、3軸回りの角速度を検出することができればよく、用いるジャイロセンサの数および組み合わせはどのようなものであってもよい。   In this embodiment, the 2-axis gyro sensor 55 and the 1-axis gyro sensor 56 are used to detect the angular velocity around the three axes. However, in other embodiments, the angular velocity around the three axes is Any number and combination of gyro sensors may be used as long as they can be detected.

また、本実施形態では、後述する姿勢算出処理における計算を容易にする目的で、各ジャイロセンサ55および56が角速度を検出する3つの軸は、加速度センサ37が加速度を検出する3つの軸(XYZ軸)と一致するように設定される。ただし、他の実施形態においては、各ジャイロセンサ56および57が角速度を検出する3つの軸と、加速度センサ37が加速度を検出する3つの軸とは一致しなくてもよい。   Further, in the present embodiment, for the purpose of facilitating the calculation in the posture calculation process described later, the three axes where the gyro sensors 55 and 56 detect the angular velocity are the three axes (XYZ) where the acceleration sensor 37 detects the acceleration. Axis). However, in other embodiments, the three axes for detecting the angular velocities by the gyro sensors 56 and 57 and the three axes for detecting the acceleration by the acceleration sensor 37 may not coincide with each other.

各ジャイロセンサ56および57で検出された角速度を示すデータは、マイコン54に出力される。したがって、マイコン54には、XYZ軸の3軸回りの角度速度を示すデータが入力されることになる。マイコン54は、上記3軸回りの角速度を示すデータを角速度データとしてプラグ53を介してコントローラ5へ送信する。なお、マイコン54からコントローラ5への送信は所定の周期毎に逐次行われるが、ゲームの処理は1/60秒を単位として(1フレーム時間として)行われることが一般的であるので、この時間以下の周期で送信を行うことが好ましい。   Data indicating the angular velocity detected by each of the gyro sensors 56 and 57 is output to the microcomputer 54. Accordingly, the microcomputer 54 receives data indicating the angular velocity around the three axes of the XYZ axes. The microcomputer 54 transmits data indicating the angular velocities around the three axes as angular velocity data to the controller 5 via the plug 53. Although transmission from the microcomputer 54 to the controller 5 is sequentially performed every predetermined cycle, since the game processing is generally performed in units of 1/60 seconds (one frame time), this time Transmission is preferably performed in the following cycle.

コントローラ5の説明に戻り、操作部32、撮像情報演算部35、および加速度センサ37からマイコン42へ出力されたデータ、ならびに、ジャイロセンサユニット7からマイコン42へ送信されてきたデータは、一時的にメモリ43に格納される。これらのデータは、上記操作データとしてゲーム装置3へ送信される。すなわち、マイコン42は、ゲーム装置3の無線コントローラモジュール19への送信タイミングが到来すると、メモリ43に格納されている操作データを無線モジュール44へ出力する。無線モジュール44は、例えばBluetooth(ブルートゥース)(登録商標)の技術を用いて、所定周波数の搬送波を操作データで変調し、その微弱電波信号をアンテナ45から放射する。つまり、操作データは、無線モジュール44で微弱電波信号に変調されてコントローラ5から送信される。微弱電波信号はゲーム装置3側の無線コントローラモジュール19で受信される。受信された微弱電波信号について復調や復号を行うことによって、ゲーム装置3は操作データを取得することができる。そして、ゲーム装置3のCPU10は、取得した操作データとゲームプログラムとに基づいて、ゲーム処理を行う。なお、通信部36から無線コントローラモジュール19への無線送信は所定の周期毎に逐次行われるが、ゲームの処理は1/60秒を単位として(1フレーム時間として)行われることが一般的であるので、この時間以下の周期で送信を行うことが好ましい。コントローラ5の通信部36は、例えば1/200秒に1回の割合で各操作データをゲーム装置3の無線コントローラモジュール19へ出力する。   Returning to the description of the controller 5, the data output from the operation unit 32, the imaging information calculation unit 35, and the acceleration sensor 37 to the microcomputer 42 and the data transmitted from the gyro sensor unit 7 to the microcomputer 42 are temporarily stored. Stored in the memory 43. These data are transmitted to the game apparatus 3 as the operation data. That is, the microcomputer 42 outputs the operation data stored in the memory 43 to the wireless module 44 when the transmission timing to the wireless controller module 19 of the game apparatus 3 arrives. The wireless module 44 modulates a carrier wave of a predetermined frequency with operation data using, for example, Bluetooth (registered trademark) technology, and radiates a weak radio signal from the antenna 45. That is, the operation data is modulated by the wireless module 44 into a weak radio signal and transmitted from the controller 5. The weak radio signal is received by the wireless controller module 19 on the game apparatus 3 side. By demodulating and decoding the received weak radio signal, the game apparatus 3 can acquire operation data. And CPU10 of the game device 3 performs a game process based on the acquired operation data and a game program. Note that the wireless transmission from the communication unit 36 to the wireless controller module 19 is sequentially performed at predetermined intervals, but the game processing is generally performed in units of 1/60 seconds (one frame time). Therefore, it is preferable to perform transmission at a period equal to or shorter than this time. The communication unit 36 of the controller 5 outputs each operation data to the wireless controller module 19 of the game apparatus 3 at a rate of once every 1/200 seconds, for example.

上記コントローラ5を用いることによって、プレイヤは、各操作ボタンを押下する従来の一般的なゲーム操作に加えて、コントローラ5を任意の傾斜角度に傾ける操作を行うことができる。その他、上記コントローラ5によれば、プレイヤは、コントローラ5によって画面上の任意の位置を指示する操作、および、コントローラ5自体を動かす操作を行うこともできる。   By using the controller 5, the player can perform an operation of tilting the controller 5 to an arbitrary tilt angle in addition to the conventional general game operation of pressing each operation button. In addition, according to the controller 5, the player can also perform an operation of instructing an arbitrary position on the screen by the controller 5 and an operation of moving the controller 5 itself.

[姿勢算出処理の概要]
次に、図8〜図12を参照して、ゲーム装置3において実行される、入力装置8の姿勢を算出する姿勢算出処理の概要を説明する。本実施形態では、ゲーム装置3は、ジャイロセンサ55および56と、加速度センサ37と、撮像手段(撮像素子40)とを備えた入力装置8からデータ(操作データ)を取得し、入力装置8の姿勢を算出する。なお、本実施形態では、入力装置8は、加速度センサ37と撮像素子40とを両方備える構成とするが、他の実施形態においては、加速度センサ37と撮像素子40とのいずれか一方のみを備える構成であってもよい。
[Outline of posture calculation processing]
Next, with reference to FIGS. 8 to 12, an outline of a posture calculation process for calculating the posture of the input device 8 executed in the game apparatus 3 will be described. In the present embodiment, the game apparatus 3 acquires data (operation data) from the input device 8 including the gyro sensors 55 and 56, the acceleration sensor 37, and the imaging means (imaging element 40). Calculate the posture. In the present embodiment, the input device 8 is configured to include both the acceleration sensor 37 and the image sensor 40. However, in other embodiments, the input device 8 includes only one of the acceleration sensor 37 and the image sensor 40. It may be a configuration.

ゲーム装置3は、(1)姿勢算出手段と、(2)第1補正手段と、(3)第2補正手段とを備えている。本実施形態においては、これら各手段は、ゲーム装置3のコンピュータ(CPU10)によって実行されるゲームプログラム(姿勢算出プログラム)が、当該コンピュータを当該各手段として機能させることによって実現される。なお、他の実施形態においては、上記各手段の一部または全部は、ゲーム装置3が備える専用回路として実現されてもよい。   The game apparatus 3 includes (1) posture calculation means, (2) first correction means, and (3) second correction means. In the present embodiment, these means are realized by causing a game program (attitude calculation program) executed by the computer (CPU 10) of the game apparatus 3 to function as the means. In other embodiments, part or all of the above means may be realized as a dedicated circuit included in the game apparatus 3.

(1)姿勢算出手段
姿勢算出手段は、ジャイロセンサ55および56が検出する角速度に基づいて入力装置8の姿勢を算出する(後述するステップS4)。角速度から姿勢を算出する方法はどのような方法であってもよいが、例えば、初期姿勢に(単位時間あたりの)角速度を逐次加算する方法がある。すなわち、ジャイロセンサ55および56から逐次出力される角速度を積分し、初期状態からの姿勢の変化量を積分結果から算出することによって、現在の姿勢を算出することができる。なお、以下では、姿勢算出手段によって角速度から算出される入力装置8の姿勢を「第1の姿勢」と呼ぶ。ただし、第1の姿勢に補正が加えられた後の姿勢も第1の姿勢と呼ぶ。
(1) Attitude calculation means The attitude calculation means calculates the attitude of the input device 8 based on the angular velocity detected by the gyro sensors 55 and 56 (step S4 described later). Any method may be used to calculate the posture from the angular velocity. For example, there is a method of sequentially adding the angular velocity (per unit time) to the initial posture. That is, the current posture can be calculated by integrating the angular velocities sequentially output from the gyro sensors 55 and 56 and calculating the amount of change in posture from the initial state from the integration result. In the following, the posture of the input device 8 calculated from the angular velocity by the posture calculation means is referred to as a “first posture”. However, the posture after the first posture is corrected is also referred to as the first posture.

ここで、ジャイロセンサ55および56が検出する角速度を用いて算出される上記第1の姿勢には、ジャイロセンサ55および56の誤検知が原因で、入力装置8の実際の姿勢との間に誤差が生じることがある。そこで、本実施形態では、ゲーム装置3は、加速度センサ37によって検出される加速度を用いて上記第1の姿勢を補正する。また、撮像素子40によって撮像される画像(撮像画像)を用いて上記第1の姿勢を補正する。   Here, the first posture calculated using the angular velocities detected by the gyro sensors 55 and 56 has an error between the actual posture of the input device 8 due to erroneous detection of the gyro sensors 55 and 56. May occur. Therefore, in the present embodiment, the game apparatus 3 corrects the first posture using the acceleration detected by the acceleration sensor 37. Further, the first posture is corrected using an image (captured image) captured by the image sensor 40.

(2)第1補正手段
第1補正手段は、加速度センサ37が検出する加速度データに基づいて上記第1の姿勢を補正する(後述するステップS5)。本実施形態では、第1補正手段は、上記第1の姿勢を第2の姿勢へと近づける補正を行う。ここで、第2の姿勢とは、加速度データから決まる姿勢、具体的には、加速度データが示す加速度の向きが鉛直下向きであると想定する場合における入力装置8の姿勢を指す。すなわち、加速度データが示す加速度が重力加速度であると仮定して算出された姿勢である。以下、図8〜図10を参照して、第1補正手段による補正処理(第1補正処理)を説明する。なお、本実施形態では、第1補正手段の具体的な方法として第1および第2の処理例を記載するが、図8〜図10では第1の処理例について説明する。
(2) First Correction Unit The first correction unit corrects the first posture based on acceleration data detected by the acceleration sensor 37 (step S5 described later). In the present embodiment, the first correction unit performs correction to bring the first posture closer to the second posture. Here, the second posture refers to a posture determined from the acceleration data, specifically, a posture of the input device 8 when it is assumed that the direction of acceleration indicated by the acceleration data is vertically downward. That is, the posture is calculated on the assumption that the acceleration indicated by the acceleration data is gravitational acceleration. Hereinafter, a correction process (first correction process) by the first correction unit will be described with reference to FIGS. In the present embodiment, first and second processing examples are described as specific methods of the first correction unit, but FIGS. 8 to 10 illustrate the first processing example.

図8は、第2の姿勢を用いた第1の姿勢の補正を示す図である。なお、本実施形態では、実際には3次元空間における姿勢を処理しているが、図8〜図10では、図面をわかりやすくするために2次元平面における姿勢を用いて説明する。図8(a)に示すベクトルGは、入力装置8が存在する空間の所定位置を基準とした空間座標系に定義された鉛直下方向、すなわち重力方向を示す。また、図8(a)に示すベクトルv1は、コントローラ5が第1の姿勢であるときの、入力装置8の下向きのベクトル(すなわち図3−図5に示されるY軸負方向)の空間座標系での向きを示したものである。なお、入力装置8の姿勢が基本状態にあるときには、姿勢を示すベクトルはベクトルGと一致することになる。したがって、ベクトルv1は、空間座標系における第1の姿勢に対応する。上記第1の姿勢は、ベクトルGに対してベクトルv1がなす回転としても表すことができ、2次元の図8においては角度θ1として示している。第1の姿勢は角速度によって算出されるので、ベクトルv1は、前回の姿勢に角速度を加えて回転させることによって算出されるものである。第2の姿勢は加速度データに基づいて算出される。図8(a)に示すベクトルv2は、加速度データが示す加速度の向き(ビュー座標系における加速度の向き)を示している。ただし、加速度データは入力装置8に加えられる加速度であって、取得できるのは入力装置8を基準とした座標系におけるベクトルである。図8(b)に、加速度センサの軸と加速度ベクトルとの関係を示す。図8(b)のように、加速度センサから取得される加速度ベクトルv0と、センサのY軸負方向とのなす角度がθ2であるとき、図8(a)の空間座標系においては、ベクトルv1に回転θ2を加えたベクトルv2が空間座標系における加速度ベクトルとなる。そして、第2の姿勢は、上述したように「加速度データが示す加速度の向きが鉛直下向きとみなした場合における入力装置8の姿勢」であるので、ベクトルv2からベクトルv1へ向いた角度θ2の回転が第2の姿勢となる。第2の姿勢を、ベクトルv1のように空間座標系における入力装置8の下向きのベクトルで表すと、ベクトルGをθ2だけ回転させたベクトルv2’として示すことができる。また、3次元の姿勢の場合には、3次元の回転行列等で表現することもできる。なお、角速度から第1の姿勢が正しく算出され、かつ、加速度データが重力方向を正確に示している場合には、加速度の向きを示すベクトルv2の方向は空間座標系の鉛直下方向、つまり重力方向と一致する。つまり、角速度から第1の姿勢が正しく算出されていない場合や、加速度データが正確な重力方向を示していない場合には、図8(a)のように、加速度の向きを示すベクトルv2と重力方向のベクトルGとが異なる。そして、例えば静止状態等のように、加速度データにより示される方向が重力方向と一致すると想定される状況においては、ベクトルv1よりもベクトルv2の方が入力装置8の姿勢に対応するデータとして正確なものと考えられる。また、入力装置が静止していない場合であっても、ある程度の期間内における平均的な姿勢の精度を考慮すると、加速度ベクトルは平均的には重力方向に近いものとなるので、時間とともに誤差の蓄積する角速度から算出される姿勢よりも信頼できるものと考えられる。一方で、前回の算出タイミングで正しい姿勢が算出されている状態であった場合には、次の算出タイミングにおける姿勢の算出には、加速度よりも角速度を用いた方が正確な姿勢が算出されると考えられる。すなわち、角速度による姿勢算出は、タイミングごとの誤差は加速度による算出よりも小さいが、時間と共に誤差が増大する一方、加速度による姿勢算出は、タイミングごとの誤差は場合よっては大きい可能性もあるが、タイミングごとに算出可能であるので誤差が蓄積しないという特徴を持つ。したがって、第1補正手段では、第1の姿勢と第2の姿勢の両方を考慮した補正を行う。   FIG. 8 is a diagram illustrating correction of the first posture using the second posture. In this embodiment, the posture in the three-dimensional space is actually processed. However, in FIGS. 8 to 10, the posture in the two-dimensional plane will be described for easy understanding of the drawings. A vector G shown in FIG. 8A indicates a vertically downward direction defined in a spatial coordinate system based on a predetermined position in a space where the input device 8 exists, that is, a gravity direction. Also, the vector v1 shown in FIG. 8A is a spatial coordinate of the downward vector of the input device 8 when the controller 5 is in the first posture (that is, the negative Y-axis direction shown in FIGS. 3 to 5). It shows the orientation in the system. When the posture of the input device 8 is in the basic state, the vector indicating the posture matches the vector G. Therefore, the vector v1 corresponds to the first posture in the spatial coordinate system. The first posture can also be expressed as a rotation made by the vector v1 with respect to the vector G, and is shown as an angle θ1 in the two-dimensional FIG. Since the first posture is calculated based on the angular velocity, the vector v1 is calculated by adding the angular velocity to the previous posture and rotating the vector v1. The second posture is calculated based on the acceleration data. A vector v2 shown in FIG. 8A indicates the direction of acceleration indicated by the acceleration data (the direction of acceleration in the view coordinate system). However, the acceleration data is an acceleration applied to the input device 8, and what can be acquired is a vector in a coordinate system based on the input device 8. FIG. 8B shows the relationship between the acceleration sensor axis and the acceleration vector. As shown in FIG. 8B, when the angle formed by the acceleration vector v0 acquired from the acceleration sensor and the Y-axis negative direction of the sensor is θ2, the vector v1 in the spatial coordinate system of FIG. A vector v2 obtained by adding the rotation θ2 to the acceleration vector in the spatial coordinate system. Since the second posture is “the posture of the input device 8 when the acceleration direction indicated by the acceleration data is regarded as being vertically downward” as described above, the rotation of the angle θ2 from the vector v2 to the vector v1 is performed. Becomes the second posture. If the second posture is represented by a downward vector of the input device 8 in the spatial coordinate system as a vector v1, it can be represented as a vector v2 'obtained by rotating the vector G by θ2. In the case of a three-dimensional posture, it can be expressed by a three-dimensional rotation matrix or the like. When the first posture is correctly calculated from the angular velocity and the acceleration data accurately indicates the direction of gravity, the direction of the vector v2 indicating the direction of acceleration is the vertical downward direction of the spatial coordinate system, that is, gravity. Match the direction. That is, when the first posture is not correctly calculated from the angular velocity, or when the acceleration data does not indicate the correct gravity direction, the vector v2 indicating the direction of acceleration and the gravity as shown in FIG. The direction vector G is different. In a situation where the direction indicated by the acceleration data is assumed to coincide with the direction of gravity, such as in a stationary state, the vector v2 is more accurate as data corresponding to the attitude of the input device 8 than the vector v1. It is considered a thing. Even when the input device is not stationary, taking into account the accuracy of the average posture within a certain period of time, the acceleration vector will be close to the direction of gravity on average, so that the error may increase with time. It can be considered more reliable than the posture calculated from the accumulated angular velocity. On the other hand, if the correct posture has been calculated at the previous calculation timing, the posture at the next calculation timing is calculated more accurately using the angular velocity than the acceleration. it is conceivable that. In other words, the posture calculation based on the angular velocity has a smaller error for each timing than the calculation based on the acceleration, but the error increases with time, while the posture calculation based on the acceleration may have a larger error for each timing. Since it can be calculated at each timing, it has a feature that no error is accumulated. Therefore, the first correction unit performs correction in consideration of both the first posture and the second posture.

第1補正手段による補正は、上記第1の姿勢を第2の姿勢へと近づける補正である。つまり、第1補正手段は、上記角度θ1を上記角度θ2に近づける補正を行う。これは、ベクトルv1をベクトルv2’に近づける補正と表現してもよい。ただし、演算の過程上は、ベクトルv2がわかっていれば、ベクトルv2’自体は算出されなくとも補正は可能である。本実施形態では、上記補正は、補正量を示すベクトルv3を用いて行われる。図9は、補正量を示すベクトルv3を示す図である。図9に示すベクトルv3は、第1の姿勢を補正する補正量を示すベクトルである。具体的には、ベクトルv2に対してベクトルv3がなす角度Δθが、補正量となる。詳細は後述するが、ベクトルv3は、ベクトルGとベクトルv2との間に設定される(図9参照)。ベクトルv1をΔθだけ回転させることで、ベクトルv1が上述のベクトルv2’に近づくことになる。   The correction by the first correction means is correction that brings the first posture closer to the second posture. That is, the first correction unit performs correction to bring the angle θ1 close to the angle θ2. This may be expressed as a correction that brings the vector v1 closer to the vector v2 '. However, in the calculation process, if the vector v2 is known, the correction is possible even if the vector v2 'itself is not calculated. In the present embodiment, the correction is performed using a vector v3 indicating the correction amount. FIG. 9 is a diagram illustrating a vector v3 indicating the correction amount. A vector v3 illustrated in FIG. 9 is a vector indicating a correction amount for correcting the first posture. Specifically, an angle Δθ formed by the vector v3 with respect to the vector v2 is a correction amount. Although details will be described later, the vector v3 is set between the vector G and the vector v2 (see FIG. 9). By rotating the vector v1 by Δθ, the vector v1 approaches the vector v2 ′ described above.

第1補正処理は、第1の姿勢(ベクトルv1)を上記補正量だけ回転させることによって行われる。図10は、第1補正処理による補正後の第1の姿勢を示すベクトルを示す図である。図10に示すように、補正後の第1の姿勢(ベクトルv1’)は、補正前の第1の姿勢(ベクトルv1)を角度Δθだけ回転させることによって得られる。これによって、補正後の第1の姿勢を表す角度θ1’は、角度θ1と角度θ2との間となっており、上記角度θ1を上記角度θ2に近づける補正が行われたことがわかる。   The first correction process is performed by rotating the first posture (vector v1) by the correction amount. FIG. 10 is a diagram illustrating a vector indicating the first posture after the correction by the first correction process. As shown in FIG. 10, the corrected first posture (vector v1 ') is obtained by rotating the first posture before correction (vector v1) by an angle Δθ. As a result, the angle θ1 ′ representing the first posture after correction is between the angle θ1 and the angle θ2, and it can be seen that the correction for bringing the angle θ1 closer to the angle θ2 was performed.

なお、上記第1の方法においては、第1補正手段は、第1の姿勢を第2の姿勢へと近づける補正を行い、補正後の第1の姿勢を第2の姿勢と一致させていない。これは、加速度データが誤検出や激しい操作等の原因で急激に変化する場合であっても補正後の第1の姿勢が急激に変化しないようにするためである。ただし、第1補正手段は、補正後の第1の姿勢を第2の姿勢と一致させるように補正を行ってもよい(後述する第2の方法)。また、詳細は後述するが、第1の方法においては、第1補正手段が第1の姿勢を第2の姿勢へと近づける割合は、加速度データにより示される加速度の大きさ(より具体的には、当該大きさと重力加速度の大きさとの差分)に応じて変化するように決められる。ただし、他の実施形態においては、上記割合を予め定められた固定値としてもよい。   In the first method, the first correction unit performs correction to bring the first posture closer to the second posture, and does not match the corrected first posture with the second posture. This is to prevent the corrected first posture from changing suddenly even when the acceleration data changes suddenly due to erroneous detection or intense operation. However, the first correction unit may perform correction so that the corrected first posture matches the second posture (second method described later). Although the details will be described later, in the first method, the rate at which the first correction unit brings the first posture closer to the second posture is the magnitude of the acceleration indicated by the acceleration data (more specifically, , The difference between the magnitude and the magnitude of gravitational acceleration). However, in other embodiments, the ratio may be a predetermined fixed value.

(3)第2補正手段
第2補正手段は、撮像手段が撮像する所定の撮像対象の画像に基づいて第1の姿勢を補正する(後述するステップS6)。ここで、本実施形態においては、所定の撮像対象とは上記マーカ部6(の赤外LED)である。本実施形態では、第2補正手段は、上記第1の姿勢を第3の姿勢へと近づける補正を行う。第3の姿勢は、上記撮像対象の画像から算出される姿勢であり、具体的には、当該画像内での撮像対象の向きおよび/または位置から算出される入力装置8の姿勢である。以下、図11および図12を参照して、第2補正手段による補正処理(第2補正処理)を説明する。
(3) Second Correction Unit The second correction unit corrects the first posture based on a predetermined image to be captured that is captured by the imaging unit (step S6 described later). Here, in the present embodiment, the predetermined imaging target is the marker unit 6 (infrared LED). In the present embodiment, the second correction unit performs correction to bring the first posture closer to the third posture. The third posture is a posture calculated from the image to be imaged, and specifically, the posture of the input device 8 calculated from the orientation and / or position of the imaged object in the image. Hereinafter, the correction processing (second correction processing) by the second correction means will be described with reference to FIGS. 11 and 12.

図11は、第3の姿勢を用いた第1の姿勢の補正を示す図である。なお、本実施形態では、実際には3次元空間における姿勢を処理しているが、図11および図12では、図面をわかりやすくするために2次元平面における姿勢を用いて説明する。図11に示すベクトルv1は、空間座標系における第1の姿勢を示す。図11に示すベクトルv4は、空間座標系における第3の姿勢を示す。マーカ部6の位置や姿勢は予め定められているので、画像内での当該マーカの姿勢や位置によって、相対的に入力装置8の姿勢を算出することができる。第3の姿勢が正しい姿勢を表していることを前提とすれば、角速度から第1の姿勢が正しく算出されている場合には、第1の姿勢を示すベクトルv1は、第3の姿勢を示すベクトルv4と一致する。つまり、角速度から第1の姿勢が正しく算出されていない場合には、図11のように、第1の姿勢を示すベクトルv1と第3の姿勢を示すベクトルv4とが異なる。   FIG. 11 is a diagram illustrating the correction of the first posture using the third posture. In this embodiment, the posture in the three-dimensional space is actually processed. However, in FIG. 11 and FIG. 12, the posture in the two-dimensional plane will be described for easy understanding of the drawings. A vector v1 shown in FIG. 11 indicates the first posture in the spatial coordinate system. A vector v4 shown in FIG. 11 indicates the third posture in the spatial coordinate system. Since the position and orientation of the marker unit 6 are determined in advance, the orientation of the input device 8 can be relatively calculated based on the orientation and position of the marker in the image. Assuming that the third posture represents the correct posture, when the first posture is correctly calculated from the angular velocity, the vector v1 indicating the first posture indicates the third posture. It matches the vector v4. That is, when the first posture is not correctly calculated from the angular velocity, the vector v1 indicating the first posture and the vector v4 indicating the third posture are different as shown in FIG.

第2補正処理は、第1の姿勢(ベクトルv1)を、第3の姿勢(ベクトルv4)に所定の割合で近づけることによって行われる。図12は、第2補正処理による補正後の第1の姿勢を示す図である。図12に示されるように、補正後の第1の姿勢(ベクトルv1’)は、補正前の第1の姿勢(ベクトルv1)を、第3の姿勢(ベクトルv4)に所定の割合で近づけることによって得られる。   The second correction process is performed by bringing the first posture (vector v1) closer to the third posture (vector v4) at a predetermined rate. FIG. 12 is a diagram illustrating the first posture after correction by the second correction processing. As shown in FIG. 12, the first posture after correction (vector v1 ′) brings the first posture before correction (vector v1) closer to the third posture (vector v4) at a predetermined rate. Obtained by.

ここで、入力装置8の姿勢や位置によっては撮像手段がマーカ部6を撮像することができない場合があり、この場合、第2補正手段は第2補正処理を行うことができない。したがって、仮に、第2補正手段が補正後の第1の姿勢を第3の姿勢と一致させるように補正を行うとすれば、第2補正処理を行うことができない状態から第2補正処理を行うことができる状態へと移行した際に、第1の姿勢が急激に変化してしまうおそれがある。このように第1の姿勢がプレイヤの意図に沿わずに急激に変化してしまうと、(たとえ補正後の姿勢が正確なものであったとしても)プレイヤは操作に違和感を感じてしまう。このような急激な変化を防止するために、本実施形態では、第1の姿勢を第3の姿勢に所定の割合で近づけるように補正を行っている。これによって、第1の姿勢が急激に変化することを防止することができるので、プレイヤが操作に違和感を感じることを防止することができる。ただし、撮像手段が常にマーカ部6を撮像することが可能な姿勢で入力装置8が使用されることが想定できる場合等、他の実施形態においては、第2補正手段は、補正後の第1の姿勢を第3の姿勢と一致させるように補正を行ってもよい。   Here, depending on the orientation and position of the input device 8, the imaging unit may not be able to capture the marker unit 6. In this case, the second correction unit cannot perform the second correction process. Therefore, if the second correction unit performs correction so that the corrected first posture matches the third posture, the second correction processing is performed from a state where the second correction processing cannot be performed. There is a possibility that the first posture may change abruptly when transitioning to a state where it is possible to do so. In this way, if the first posture suddenly changes without conforming to the player's intention, the player will feel uncomfortable with the operation (even if the corrected posture is accurate). In order to prevent such a sudden change, in the present embodiment, correction is performed so that the first posture approaches the third posture at a predetermined rate. As a result, it is possible to prevent the first posture from changing suddenly, thereby preventing the player from feeling uncomfortable with the operation. However, in other embodiments, such as when the input device 8 can be assumed to be used in a posture in which the imaging unit can always image the marker unit 6, the second correction unit is the corrected first unit. You may correct | amend so that this attitude | position may correspond with a 3rd attitude | position.

なお、本実施形態では、ゲーム装置3は、第1補正処理と第2補正処理との両方を実行するが、他の実施形態においては、第1補正処理と第2補正処理とのいずれか一方のみを実行するようにしてもよい。また、本実施形態においては、ゲーム装置3は、第1補正処理を先に行い、第2補正処理を後に行うこととするが、第1補正処理と第2補正処理とのいずれを先に行うようにしてもよい。   In the present embodiment, the game apparatus 3 executes both the first correction process and the second correction process, but in other embodiments, one of the first correction process and the second correction process. May be executed only. In the present embodiment, the game apparatus 3 performs the first correction process first and the second correction process later, but either the first correction process or the second correction process is performed first. You may do it.

以上のように、本実施形態によれば、ジャイロセンサ55および56によって検知された角速度から算出される入力装置8の姿勢を、加速度センサ37によって検知された加速度を用いて補正し、また、撮像手段による撮像画像を用いて補正する。これによって、ジャイロセンサから算出される姿勢の誤差を減少することができ、入力装置8の姿勢をより正確に算出することができる。   As described above, according to the present embodiment, the attitude of the input device 8 calculated from the angular velocities detected by the gyro sensors 55 and 56 is corrected using the acceleration detected by the acceleration sensor 37, and imaging is performed. Correction is performed using the image captured by the means. Thereby, the error of the attitude calculated from the gyro sensor can be reduced, and the attitude of the input device 8 can be calculated more accurately.

なお、加速度センサ37の検出結果からは、重力方向を軸とした回転(ヨー方向の回転)を検知することはできないので、第1補正手段による補正は、ヨー方向に関しては行うことができない。しかし、加速度センサ37の検出結果を用いた補正は、入力装置8の姿勢がどのような姿勢であっても(常に加速度を検出することができるので)可能であるという特長を有する。一方、入力装置8の撮像方向にマーカ部6がなければマーカ座標が検出されないので、第2補正手段による補正は、入力装置8の姿勢によっては行うことができない。しかし、撮像画像を用いた補正は、姿勢(特にロール方向の姿勢)を正確に算出することができるという特長を有する。本実施形態においては、このように特長の異なる2種類の補正を行うことによって、入力装置8の姿勢をより正確に算出することができる。   In addition, from the detection result of the acceleration sensor 37, the rotation around the gravity direction (rotation in the yaw direction) cannot be detected, and therefore the correction by the first correction unit cannot be performed in the yaw direction. However, the correction using the detection result of the acceleration sensor 37 has a feature that the posture of the input device 8 can be any posture (because acceleration can always be detected). On the other hand, if the marker unit 6 is not present in the imaging direction of the input device 8, the marker coordinates are not detected, and therefore the correction by the second correction unit cannot be performed depending on the attitude of the input device 8. However, the correction using the captured image has a feature that the posture (especially the posture in the roll direction) can be accurately calculated. In the present embodiment, the posture of the input device 8 can be calculated more accurately by performing two types of corrections having different features as described above.

[ゲーム装置3における処理の詳細]
次に、ゲーム装置3において実行される処理の詳細について説明する。まず、ゲーム装置3における処理において用いられる主なデータについて図13を用いて説明する。図13は、ゲーム装置3のメインメモリ(外部メインメモリ12または内部メインメモリ11e)に記憶される主なデータを示す図である。図13に示すように、ゲーム装置3のメインメモリには、ゲームプログラム60、操作データ62、およびゲーム処理用データ67が記憶される。なお、メインメモリには、図13に示すデータの他、ゲームに登場する各種オブジェクトの画像データや、オブジェクトの各種パラメータを示すデータ等、ゲーム処理に必要なデータが記憶される。
[Details of processing in game device 3]
Next, details of processing executed in the game apparatus 3 will be described. First, main data used in the processing in the game apparatus 3 will be described with reference to FIG. FIG. 13 is a diagram illustrating main data stored in the main memory (the external main memory 12 or the internal main memory 11e) of the game apparatus 3. As shown in FIG. 13, a game program 60, operation data 62, and game processing data 67 are stored in the main memory of the game apparatus 3. In addition to the data shown in FIG. 13, the main memory stores data necessary for game processing, such as image data of various objects appearing in the game and data indicating various parameters of the objects.

ゲームプログラム60は、ゲーム装置3に電源が投入された後の適宜のタイミングで光ディスク4からその一部または全部が読み込まれてメインメモリに記憶される。ゲームプログラム60には、姿勢算出プログラム61が含まれる。姿勢算出プログラム61は、入力装置8の姿勢を算出するための姿勢算出処理を実行するためのプログラムである。   A part or all of the game program 60 is read from the optical disc 4 and stored in the main memory at an appropriate timing after the game apparatus 3 is turned on. The game program 60 includes a posture calculation program 61. The attitude calculation program 61 is a program for executing an attitude calculation process for calculating the attitude of the input device 8.

操作データ62は、コントローラ5からゲーム装置3へ送信されてくる操作データである。上述したように、コントローラ5からゲーム装置3へ1/200秒に1回の割合で操作データが送信されるので、メインメモリに記憶される操作データ62はこの割合で更新される。本実施形態においては、メインメモリには、最新の(最後に取得された)操作データのみが記憶されればよい。   The operation data 62 is operation data transmitted from the controller 5 to the game apparatus 3. As described above, since the operation data is transmitted from the controller 5 to the game apparatus 3 at a rate of once every 1/200 seconds, the operation data 62 stored in the main memory is updated at this rate. In the present embodiment, only the latest (last acquired) operation data may be stored in the main memory.

操作データ62には、角速度データ63、加速度データ64、マーカ座標データ65、および操作ボタンデータ66が含まれる。角速度データ63は、ジャイロセンサユニット7のジャイロセンサ55および56によって検出された角速度を示すデータである。ここでは、角速度データ63は、図3に示すXYZの3軸回りのそれぞれの角速度を示す。また、加速度データ64は、加速度センサ37によって検出された加速度(加速度ベクトル)を示すデータである。ここでは、加速度データ64は、図3に示すXYZの3軸の方向に関する加速度を各成分とする3次元の加速度ベクトルVa1を示す。また、本実施形態においては、コントローラ5が静止している状態で加速度センサ37が検出する加速度ベクトルVa1の大きさを“1”とする。つまり、加速度センサ37によって検出される重力加速度の大きさは“1”である。   The operation data 62 includes angular velocity data 63, acceleration data 64, marker coordinate data 65, and operation button data 66. The angular velocity data 63 is data indicating angular velocities detected by the gyro sensors 55 and 56 of the gyro sensor unit 7. Here, the angular velocity data 63 indicates the respective angular velocities around the three axes of XYZ shown in FIG. The acceleration data 64 is data indicating the acceleration (acceleration vector) detected by the acceleration sensor 37. Here, the acceleration data 64 represents a three-dimensional acceleration vector Va1 having as components the accelerations in the directions of the three axes of XYZ shown in FIG. In the present embodiment, the magnitude of the acceleration vector Va1 detected by the acceleration sensor 37 while the controller 5 is stationary is “1”. That is, the magnitude of gravitational acceleration detected by the acceleration sensor 37 is “1”.

マーカ座標データ65は、撮像情報演算部35の画像処理回路41によって算出される座標、すなわち上記マーカ座標を示すデータである。マーカ座標は、撮像画像に対応する平面上の位置を表すための2次元座標系(図23に示すx’y’座標系)で表現される。なお、撮像素子40によって2つのマーカ6Rおよび6Lが撮像される場合には、2つのマーカ座標が算出される。一方、撮像素子40の撮像可能な範囲内にマーカ6Rおよび6Lのいずれか一方が位置しない場合には、撮像素子40によって1つのマーカのみが撮像され、1つのマーカ座標のみが算出される。また、撮像素子40の撮像可能な範囲内にマーカ6Rおよび6Lの両方が位置しない場合には、撮像素子40によってマーカが撮像されず、マーカ座標は算出されない。したがって、マーカ座標データ65は、2つのマーカ座標を示す場合もあるし、1つのマーカ座標を示す場合もあるし、マーカ座標がないことを示す場合もある。   The marker coordinate data 65 is data indicating coordinates calculated by the image processing circuit 41 of the imaging information calculation unit 35, that is, the marker coordinates. The marker coordinates are expressed by a two-dimensional coordinate system (x′y ′ coordinate system shown in FIG. 23) for representing a position on a plane corresponding to the captured image. Note that, when the two markers 6R and 6L are imaged by the imaging element 40, two marker coordinates are calculated. On the other hand, if either one of the markers 6R and 6L is not located within the imageable range of the image sensor 40, only one marker is imaged by the image sensor 40, and only one marker coordinate is calculated. Further, when both of the markers 6R and 6L are not located within the image capturing range of the image sensor 40, the marker is not imaged by the image sensor 40, and the marker coordinates are not calculated. Therefore, the marker coordinate data 65 may indicate two marker coordinates, may indicate one marker coordinate, or may indicate that there is no marker coordinate.

操作ボタンデータ66は、各操作ボタン32a〜32iに対する入力状態を示すデータである。   The operation button data 66 is data indicating an input state for each of the operation buttons 32a to 32i.

ゲーム処理用データ67は、後述するゲーム処理(図14)において用いられるデータである。ゲーム処理用データ67は、第1姿勢データ68、加速度大きさデータ69、補正度データ70、補正量ベクトルデータ71、補正行列データ72、ロール姿勢成分データ73、ヨー姿勢成分データ74、ピッチ姿勢成分データ75、および第3姿勢データ76を含む。なお、図13に示すデータの他、ゲーム処理用データ67は、ゲーム処理において用いられる各種データ(ゲームパラメータを示すデータ等)を含む。   The game process data 67 is data used in a game process (FIG. 14) described later. The game processing data 67 includes first posture data 68, acceleration magnitude data 69, correction degree data 70, correction amount vector data 71, correction matrix data 72, roll posture component data 73, yaw posture component data 74, pitch posture component. Data 75 and third attitude data 76 are included. In addition to the data shown in FIG. 13, the game processing data 67 includes various data (data indicating game parameters, etc.) used in the game processing.

第1姿勢データ68は、角速度データ63を用いて算出される上記第1の姿勢を示すデータである。本実施形態では、第1の姿勢は、以下の式(1)に示す3×3の行列M1で表現される。

Figure 0005872136
上記行列M1は、所定の基準姿勢から現在の入力装置8の姿勢への回転を表す回転行列である。以下では、第1の姿勢を示す行列M1を、「第1姿勢行列M1」と呼ぶ。なお、第1姿勢行列M1により表される第1の姿勢は、入力装置8が存在する空間の所定位置を基準としたxyz座標系(上記空間座標系)における姿勢である。ここでは、xyz座標系は、入力装置8がマーカ部6の正面に位置することを前提とし、入力装置8の位置からマーカ部6を向く方向をz軸正方向とし、鉛直上向き(重力方向の逆方向)をy軸正方向とし、入力装置8の位置からマーカ部6を向いた場合の左方向をx軸正方向とした座標系であるとする。ここでは、上記所定の基準姿勢は、マーカ部6の正面に位置する入力装置8の撮像方向がマーカ部6の中央を向き、かつ、コントローラ5のボタン面が鉛直上向きとなる姿勢(すなわち、入力装置8を基準としたX軸、Y軸、Z軸が、それぞれx軸、y軸、z軸の向きと一致する姿勢)であるとする。なお、本実施形態では、行列を用いて第1の姿勢を表現することとしたが、他の実施形態においては、第1の姿勢は、3次のベクトルまたは3つの角度によって表現されてもよい。 The first attitude data 68 is data indicating the first attitude calculated using the angular velocity data 63. In the present embodiment, the first posture is expressed by a 3 × 3 matrix M1 shown in the following equation (1).
Figure 0005872136
The matrix M1 is a rotation matrix representing the rotation from a predetermined reference posture to the current input device 8 posture. Hereinafter, the matrix M1 indicating the first posture is referred to as a “first posture matrix M1”. Note that the first posture represented by the first posture matrix M1 is a posture in the xyz coordinate system (the spatial coordinate system) with reference to a predetermined position in the space where the input device 8 exists. Here, the xyz coordinate system is based on the premise that the input device 8 is located in front of the marker unit 6, and the direction from the input device 8 toward the marker unit 6 is the z-axis positive direction, and is vertically upward (in the gravitational direction). It is assumed that the coordinate system is such that the reverse direction) is the y-axis positive direction and the left direction when facing the marker unit 6 from the position of the input device 8 is the x-axis positive direction. Here, the predetermined reference posture is a posture in which the imaging direction of the input device 8 located in front of the marker unit 6 faces the center of the marker unit 6 and the button surface of the controller 5 is vertically upward (that is, input) Assume that the X axis, the Y axis, and the Z axis with respect to the device 8 are postures that coincide with the directions of the x axis, the y axis, and the z axis, respectively. In the present embodiment, the first posture is expressed using a matrix. However, in other embodiments, the first posture may be expressed by a cubic vector or three angles. .

加速度大きさデータ69は、加速度データ64により示される加速度ベクトルVa1の大きさ(長さ)Lを示すデータである。   The acceleration magnitude data 69 is data indicating the magnitude (length) L of the acceleration vector Va1 indicated by the acceleration data 64.

補正度データ70は、第2の姿勢を用いて第1の姿勢を補正する度合(補正度A)を示すデータである。補正度Aは、0≦A≦C1(C1は、0<C1≦1の所定の定数)の範囲を取り得る値である。詳細は後述するが、補正後の第1の姿勢は、補正度Aの値が大きいほど第2の姿勢に近くなる。   The correction degree data 70 is data indicating the degree of correction of the first attitude using the second attitude (correction degree A). The correction degree A is a value that can take a range of 0 ≦ A ≦ C1 (C1 is a predetermined constant of 0 <C1 ≦ 1). Although details will be described later, the corrected first posture becomes closer to the second posture as the correction degree A is larger.

補正量ベクトルデータ71は、第1の姿勢を補正する補正量を示すベクトル(図9に示すベクトルv3。以下、補正量ベクトルと呼ぶ。)を示すデータである。補正量ベクトルVgは、上記加速度ベクトルVa1を上記xyz座標系で表したベクトルVa2と、上記補正度Aとに基づいて算出される。   The correction amount vector data 71 is data indicating a vector indicating a correction amount for correcting the first posture (vector v3 shown in FIG. 9; hereinafter referred to as a correction amount vector). The correction amount vector Vg is calculated based on the vector Va2 representing the acceleration vector Va1 in the xyz coordinate system and the correction degree A.

補正行列データ72は、第1の姿勢を補正するために用いる回転行列(補正行列と呼ぶ)Maを示すデータである。つまり、第1補正処理においては、第1の姿勢を表す第1姿勢行列M1に補正行列Maを掛けることで第1の姿勢が補正される。補正行列Maは、上記ベクトルVa2と上記補正量ベクトルVgとに基づいて算出される。   The correction matrix data 72 is data indicating a rotation matrix (referred to as a correction matrix) Ma used for correcting the first posture. That is, in the first correction process, the first posture is corrected by multiplying the first posture matrix M1 representing the first posture by the correction matrix Ma. The correction matrix Ma is calculated based on the vector Va2 and the correction amount vector Vg.

ロール姿勢成分データ73は、上記撮像対象の画像から算出される第3の姿勢に含まれる姿勢成分のうち、ロール方向に関する姿勢成分(ロール姿勢成分)M3rを示すデータである。また、ヨー姿勢成分データ74は、上記第3の姿勢に含まれる姿勢成分のうち、ヨー方向に関する姿勢成分(ヨー姿勢成分)M3yを示すデータであり、ピッチ姿勢成分データ75は、上記第3の姿勢に含まれる姿勢成分のうち、ピッチ方向に関する姿勢成分(ピッチ姿勢成分)M3pを示すデータである。なお、ここで言うロール方向、ヨー方向、およびピッチ方向とは、入力装置8の撮像方向(Z軸正方向)を基準とした場合の回転方向である。本実施形態においては、各姿勢成分M3r、M3y、およびM3pは、第1の姿勢と同様、3×3の行列で表現される。   The roll posture component data 73 is data indicating a posture component (roll posture component) M3r related to the roll direction among the posture components included in the third posture calculated from the image to be captured. The yaw posture component data 74 is data indicating the posture component (yaw posture component) M3y related to the yaw direction among the posture components included in the third posture, and the pitch posture component data 75 is the third posture information. Among the posture components included in the posture, this is data indicating a posture component (pitch posture component) M3p related to the pitch direction. Note that the roll direction, yaw direction, and pitch direction referred to here are rotation directions when the imaging direction (Z-axis positive direction) of the input device 8 is used as a reference. In the present embodiment, each of the posture components M3r, M3y, and M3p is represented by a 3 × 3 matrix as in the first posture.

第3姿勢データ76は、上記撮像対象の画像から算出される第3の姿勢を示すデータである。本実施形態では、第3の姿勢は、第1の姿勢と同様、3×3の行列M3で表現される。以下では、第3の姿勢を示す行列M3を「第3姿勢行列M3」と呼ぶ。本実施形態では、入力装置8から操作データとしてマーカ座標データが送信されてくるので、第3姿勢行列M3は、マーカ座標データ65に基づいて算出される。具体的には、第3姿勢行列M3は、上記各姿勢成分M3r、M3y、およびM3pを合成することによって得られる。   The third attitude data 76 is data indicating a third attitude calculated from the image to be imaged. In the present embodiment, the third posture is represented by a 3 × 3 matrix M3, like the first posture. Hereinafter, the matrix M3 indicating the third posture is referred to as a “third posture matrix M3”. In the present embodiment, since the marker coordinate data is transmitted as operation data from the input device 8, the third posture matrix M <b> 3 is calculated based on the marker coordinate data 65. Specifically, the third posture matrix M3 is obtained by combining the posture components M3r, M3y, and M3p.

次に、ゲーム装置3において行われる処理の詳細を、図14〜図23を用いて説明する。図14は、ゲーム装置3において実行される処理の流れを示すメインフローチャートである。ゲーム装置3の電源が投入されると、ゲーム装置3のCPU10は、図示しないブートROMに記憶されている起動プログラムを実行し、これによってメインメモリ等の各ユニットが初期化される。そして、光ディスク4に記憶されたゲームプログラムがメインメモリに読み込まれ、CPU10によって当該ゲームプログラムの実行が開始される。図14に示すフローチャートは、以上の処理が完了した後に行われる処理を示すフローチャートである。   Next, details of processing performed in the game apparatus 3 will be described with reference to FIGS. FIG. 14 is a main flowchart showing the flow of processing executed in the game apparatus 3. When the power of the game apparatus 3 is turned on, the CPU 10 of the game apparatus 3 executes a startup program stored in a boot ROM (not shown), whereby each unit such as the main memory is initialized. Then, the game program stored in the optical disc 4 is read into the main memory, and the CPU 10 starts executing the game program. The flowchart shown in FIG. 14 is a flowchart showing processing performed after the above processing is completed.

まず、ステップS1において、CPU10は、ゲームに関する初期化処理を実行する。この初期化処理においては、ゲーム処理に用いられる各種パラメータの値が初期化されたり、仮想のゲーム空間が構築されたり、プレイヤオブジェクトや他のオブジェクトがゲーム空間の初期位置に配置されたりする。以上のステップS1の次にステップS2の処理が実行される。   First, in step S1, the CPU 10 executes an initialization process relating to the game. In this initialization process, the values of various parameters used in the game process are initialized, a virtual game space is constructed, and player objects and other objects are placed at initial positions in the game space. Following step S1, the process of step S2 is executed.

ステップS2において、CPU10は、初期姿勢設定処理が実行される。具体的には、プレイヤが所定の操作(例えば、Aボタン32dを押下する操作)を行ったことに応じて、入力装置8の第1の姿勢の初期姿勢として所定の値が設定される。ここでは、基準となる姿勢は、Z軸が鉛直方向と平行となり、かつ、入力装置8の撮像方向がマーカ部6の中央(マーカ6Rおよび6Lの中央)を向く姿勢としているので、プレイヤは、初期姿勢が上記基準となる姿勢となるように入力装置8を把持した状態で、上記所定の操作を行うことが望ましいが、入力装置が静止状態に近く、かつマーカ部を撮像可能であれば、初期姿勢を算出することが可能である。CPU10は、所定の操作が行われると、上記初期姿勢を表す行列を示すデータを第1姿勢データとしてメインメモリに記憶する。以上のステップS2の後、ステップS3〜S8の処理ループが、ゲームが実行される間繰り返し実行される。なお、1回の当該処理ループは、1フレーム時間(例えば1/60秒)に1回の割合で実行される。   In step S2, the CPU 10 executes an initial posture setting process. Specifically, a predetermined value is set as the initial posture of the input device 8 in response to the player performing a predetermined operation (for example, an operation of pressing the A button 32d). Here, the reference posture is a posture in which the Z axis is parallel to the vertical direction and the imaging direction of the input device 8 faces the center of the marker unit 6 (the center of the markers 6R and 6L). It is desirable to perform the predetermined operation while holding the input device 8 so that the initial posture becomes the reference posture, but if the input device is close to a stationary state and the marker portion can be imaged, It is possible to calculate the initial posture. When a predetermined operation is performed, the CPU 10 stores data indicating a matrix representing the initial posture in the main memory as first posture data. After the above step S2, the processing loop of steps S3 to S8 is repeatedly executed while the game is executed. Note that one processing loop is executed once per frame time (for example, 1/60 seconds).

なお、本実施形態では、初期姿勢設定処理(ステップS2)は、ゲーム開始前(ステップS3〜S8の処理ループが実行される前)に1回実行されるのみであるとしたが、他の実施形態においては、ゲーム中における任意のタイミングで初期姿勢設定処理が実行されるようにしてもよい。すなわち、CPU10は、ゲーム中においてプレイヤが上記所定の操作を行ったことに応じて初期姿勢設定処理を実行するようにしてもよい。   In this embodiment, the initial posture setting process (step S2) is executed only once before the game starts (before the processing loop of steps S3 to S8 is executed). In the embodiment, the initial posture setting process may be executed at an arbitrary timing during the game. That is, the CPU 10 may execute the initial posture setting process in response to the player performing the predetermined operation during the game.

ステップS3において、CPU10は操作データを取得する。すなわち、コントローラ5から送信されてくる操作データが無線コントローラモジュール19を介して受信される。そして、受信された操作データに含まれる角速度データ、加速度データ、マーカ座標データ、操作ボタンデータがそれぞれメインメモリに記憶される。ステップS3の次にステップS4の処理が実行される。   In step S3, the CPU 10 acquires operation data. That is, operation data transmitted from the controller 5 is received via the wireless controller module 19. Then, angular velocity data, acceleration data, marker coordinate data, and operation button data included in the received operation data are stored in the main memory. Following step S3, the process of step S4 is executed.

ステップS4において、CPU10は、メインメモリに記憶されている角速度データ63に基づいて第1の姿勢を算出する。入力装置8の姿勢を角速度から算出する方法はどのような方法であってもよいが、本実施形態においては、第1の姿勢は、前回の第1の姿勢(前回の処理ループにおいて算出された第1の姿勢)と、今回の角速度(今回の処理ループにおいて取得された角速度)とを用いて算出される。具体的には、CPU10は、前回の第1の姿勢を今回の角速度で単位時間分回転させた姿勢を、第1の姿勢とする。なお、前回の第1の姿勢は、メインメモリに記憶されている第1姿勢データ68により示され、今回の角速度は、メインメモリに記憶されている角速度データ63により示されている。ステップS4で算出された姿勢(3×3の行列)を示すデータが、第1姿勢データ68としてメインメモリに新たに記憶される。上記ステップS4の次にステップS5の処理が実行される。   In step S4, the CPU 10 calculates the first posture based on the angular velocity data 63 stored in the main memory. Any method may be used to calculate the attitude of the input device 8 from the angular velocity. However, in the present embodiment, the first attitude is the previous first attitude (calculated in the previous processing loop). (First attitude) and the current angular velocity (the angular velocity acquired in the current processing loop). Specifically, the CPU 10 sets the posture obtained by rotating the previous first posture by unit time at the current angular velocity as the first posture. The previous first posture is indicated by the first posture data 68 stored in the main memory, and the current angular velocity is indicated by the angular velocity data 63 stored in the main memory. Data indicating the posture (3 × 3 matrix) calculated in step S4 is newly stored in the main memory as the first posture data 68. Following step S4, the process of step S5 is executed.

ステップS5において、CPU10は前述した第1補正処理を実行する。第1補正処理は、加速度データを用いて第1の姿勢を補正する処理である。以下、図15を参照して、第1補正処理における第1の処理例を説明し、図16〜図21を参照して、第1補正処理における第2の処理例を説明する。   In step S5, the CPU 10 executes the first correction process described above. The first correction process is a process of correcting the first posture using acceleration data. Hereinafter, the first processing example in the first correction processing will be described with reference to FIG. 15, and the second processing example in the first correction processing will be described with reference to FIGS. 16 to 21.

図15は、図14に示す第1補正処理(ステップS5)の第1の処理例の流れを示すフローチャートである。第1補正処理においては、まずステップS11において、CPU10は、加速度センサ37によって検出された加速度の大きさLを算出する。すなわち、メインメモリに記憶されている加速度データ64を読み出し、当該加速度データ64により示される加速度ベクトルVa1について大きさLを算出する。算出された大きさLを示すデータは加速度大きさデータ69としてメインメモリに記憶される。ステップS11の次にステップS12の処理が実行される。   FIG. 15 is a flowchart showing the flow of the first processing example of the first correction processing (step S5) shown in FIG. In the first correction process, first, in step S <b> 11, the CPU 10 calculates the magnitude L of the acceleration detected by the acceleration sensor 37. That is, the acceleration data 64 stored in the main memory is read, and the magnitude L is calculated for the acceleration vector Va1 indicated by the acceleration data 64. Data indicating the calculated magnitude L is stored as acceleration magnitude data 69 in the main memory. Following step S11, the process of step S12 is executed.

ステップS12において、CPU10は、加速度センサ37によって検出された加速度の大きさが0であるか否かを判定する。すなわち、メインメモリに記憶されている加速度大きさデータ69を読み出し、当該加速度大きさデータ69により示される大きさLが0であるか否かを判定する。ステップS12の判定結果が否定である場合、ステップS13の処理が実行される。一方、ステップS12の判定結果が肯定である場合、以降のステップS13〜S21の処理がスキップされて、CPU10は第1補正処理を終了する。このように、本実施形態においては、加速度センサ37によって検出された加速度の大きさが0である場合には、当該加速度を用いた補正が行われない。これは、加速度の大きさが0である場合には加速度センサ37の検出結果から重力方向を算出できないということ、および、加速度ベクトルの大きさが0であれば以降のステップS13〜S21の処理が困難であることが理由である。   In step S12, the CPU 10 determines whether or not the magnitude of the acceleration detected by the acceleration sensor 37 is zero. That is, the acceleration magnitude data 69 stored in the main memory is read, and it is determined whether or not the magnitude L indicated by the acceleration magnitude data 69 is zero. If the determination result of step S12 is negative, the process of step S13 is executed. On the other hand, when the determination result of step S12 is affirmative, the processes of subsequent steps S13 to S21 are skipped, and the CPU 10 ends the first correction process. Thus, in this embodiment, when the magnitude of the acceleration detected by the acceleration sensor 37 is 0, correction using the acceleration is not performed. This means that the direction of gravity cannot be calculated from the detection result of the acceleration sensor 37 when the magnitude of the acceleration is 0, and the subsequent steps S13 to S21 are performed if the magnitude of the acceleration vector is 0. The reason is that it is difficult.

ステップS13において、CPU10は、加速度センサ37によって検出された加速度ベクトルVa1を正規化する。すなわち、メインメモリに記憶されている加速度データ64を読み出し、当該加速度データ64により示される加速度ベクトルVa1を、大きさが1となるように補正する。CPU10は、正規化された加速度ベクトルVa1を示すデータをメインメモリに記憶しておく。ステップS13の次にステップS14の処理が実行される。   In step S <b> 13, the CPU 10 normalizes the acceleration vector Va <b> 1 detected by the acceleration sensor 37. That is, the acceleration data 64 stored in the main memory is read, and the acceleration vector Va1 indicated by the acceleration data 64 is corrected so that the magnitude is 1. The CPU 10 stores data indicating the normalized acceleration vector Va1 in the main memory. Following step S13, the process of step S14 is executed.

ステップS14において、CPU10は、第1補正処理において第1の姿勢を補正する度合を示す上記補正度Aを算出する。補正度Aは、正規化される前の加速度ベクトルVa1の大きさLに基づいて算出される。具体的には、CPU10は、メインメモリに記憶されている加速度大きさデータ69を読み出す。そして、当該加速度大きさデータ69により示される大きさLを用いて、次の式(2)に従って補正度Aを算出する。
A=|L−1| …(2)
上式(2)で算出された補正度Aを示すデータは、補正度データ70としてメインメモリに記憶される。なお、上式(2)で算出された補正度Aは、最終的な値ではない演算中の値であって、以降のステップS16で値が変換されることによって、最終的な補正度Aの値が得られる。ステップS14の次にステップS15の処理が実行される。
In step S <b> 14, the CPU 10 calculates the correction degree A indicating the degree of correction of the first posture in the first correction process. The correction degree A is calculated based on the magnitude L of the acceleration vector Va1 before normalization. Specifically, the CPU 10 reads acceleration magnitude data 69 stored in the main memory. Then, using the magnitude L indicated by the acceleration magnitude data 69, the correction degree A is calculated according to the following equation (2).
A = | L−1 | (2)
Data indicating the correction degree A calculated by the above equation (2) is stored as correction degree data 70 in the main memory. The correction degree A calculated by the above equation (2) is a value that is not a final value and is being calculated, and the final correction degree A is obtained by converting the value in the subsequent step S16. A value is obtained. Following step S14, the process of step S15 is executed.

ステップS15において、CPU10は、ステップS14で算出された補正度Aが所定値Rよりも小さいか否かを判定する。所定値Rは、予め定められており、例えば0.4に設定される。ここで、上述したように、本実施形態においては、加速度センサ37によって検出される重力加速度の大きさは“1”であり、また、補正度Aは加速度ベクトルVa1の大きさLと“1”との差の絶対値である(上式(2))。したがって、補正度Aが所定値R以上である場合とは、加速度ベクトルVa1の大きさLが重力加速度の大きさから所定値R以上離れている場合である。ステップS15の判定結果が肯定である場合、ステップS16の処理が実行される。一方、ステップS15の判定結果が否定である場合、以降のステップS16〜S21の処理がスキップされて、CPU10は第1補正処理を終了する。   In step S15, the CPU 10 determines whether or not the correction degree A calculated in step S14 is smaller than a predetermined value R. The predetermined value R is determined in advance and is set to 0.4, for example. Here, as described above, in the present embodiment, the magnitude of the gravitational acceleration detected by the acceleration sensor 37 is “1”, and the correction degree A is the magnitude L of the acceleration vector Va1 and “1”. (The above formula (2)). Therefore, the case where the correction degree A is equal to or greater than the predetermined value R is a case where the magnitude L of the acceleration vector Va1 is separated from the magnitude of the gravitational acceleration by the predetermined value R or more. If the determination result of step S15 is affirmative, the process of step S16 is executed. On the other hand, when the determination result of step S15 is negative, the processes of subsequent steps S16 to S21 are skipped, and the CPU 10 ends the first correction process.

上記のように、本実施形態では、加速度センサ37によって検出される加速度の大きさLと重力加速度の大きさ(=1)との差が所定の基準(所定値R)よりも小さい場合にのみ補正が行われ、当該大きさLと重力加速度の大きさとの差が所定の基準以上である場合には補正が行われない。ここで、入力装置8が動かされている状態では、重力加速度以外に、入力装置8が動かされることによって生じる慣性による加速度が加速度センサ37によって検出されるので、検出される加速度ベクトルVa1の大きさLが“1”とは異なる値となり、入力装置8が激しく動かされている場合には、大きさLが“1”から大きく離れた値となる。したがって、上記大きさLと重力加速度の大きさとの差が所定の基準以上である場合とは、入力装置8が激しく動かされている場合であると推測される。一方、入力装置8が激しく動かされている場合には、加速度センサ37によって検出される加速度ベクトルVa1に重力加速度以外の成分(上記慣性による加速度の成分)が多く含まれているため、加速度ベクトルVa1の値は、重力方向を示す値としては信頼できないものと推測される。したがって、上記ステップS15の判定処理は、入力装置8が激しく動かされているか否か、換言すれば、加速度ベクトルVa1の値が重力方向を示す値としては信頼できるものであるか否かを判定する処理である。本実施形態においては、上記ステップS15の判定処理によって、加速度ベクトルVa1の値が重力方向を示す値としては信頼できない場合には補正を行わず、加速度ベクトルVa1の値が重力方向を示す値としては信頼できる場合にのみ補正を行うようにしている。これによって、重力方向を示す値としては信頼できない加速度ベクトルVa1を用いて第1の姿勢に対する補正が行われた結果、第1の姿勢が正しく補正されなくなることを防止することができる。   As described above, in the present embodiment, only when the difference between the acceleration magnitude L detected by the acceleration sensor 37 and the gravitational acceleration magnitude (= 1) is smaller than a predetermined reference (predetermined value R). Correction is performed, and correction is not performed when the difference between the magnitude L and the magnitude of gravitational acceleration is equal to or greater than a predetermined reference. Here, in the state where the input device 8 is moved, in addition to the gravitational acceleration, the acceleration due to inertia caused by the movement of the input device 8 is detected by the acceleration sensor 37, so the magnitude of the detected acceleration vector Va1. L becomes a value different from “1”, and when the input device 8 is moved violently, the size L becomes a value far from “1”. Therefore, the case where the difference between the magnitude L and the magnitude of the gravitational acceleration is equal to or greater than a predetermined reference is estimated to be a case where the input device 8 is moved violently. On the other hand, when the input device 8 is moved violently, the acceleration vector Va1 detected by the acceleration sensor 37 contains many components other than gravitational acceleration (the acceleration component due to inertia), and therefore the acceleration vector Va1. The value of is presumed to be unreliable as a value indicating the direction of gravity. Therefore, the determination process of step S15 determines whether or not the input device 8 is moved violently, in other words, whether or not the value of the acceleration vector Va1 is reliable as a value indicating the direction of gravity. It is processing. In the present embodiment, if the value of the acceleration vector Va1 is not reliable as a value indicating the direction of gravity by the determination process in step S15, no correction is performed, and the value of the acceleration vector Va1 is a value indicating the direction of gravity. Corrections are made only when reliable. As a result, it is possible to prevent the first posture from being correctly corrected as a result of performing the correction on the first posture using the acceleration vector Va1 that is not reliable as a value indicating the direction of gravity.

ステップS16において、CPU10は、補正度Aの値を変換する。本実施形態では、補正度Aを、検出された加速度ベクトルVa1の大きさLが重力加速度の大きさに近いほど1に近くなるように、補正度Aを変換する。具体的には、CPU10は、メインメモリに記憶されている補正度データ70を読み出し、当該補正度データ70により示される補正度Aを、以下の式(3)〜(5)に従って変換する。
A2=1−(A1/R) …(3)
A3=A2×A2 …(4)
A4=A3×C1 …(5)
上式(3)〜(5)において、変数A1は変換前の補正度(メインメモリに現在記憶されている補正度データ70により示される値)であり、変数A4がステップS16において最終的に変換される補正度である。上式(3)は、変換前の補正度A1の大きさが重力加速度の大きさ(=1)に近いほど1に近くなるように変換後の補正度A2を得るための式である。上式(4)は、変換前の補正度A2が1に近いほど大きい重みが付されるように変換後の補正度A3を得るための式である。上式(5)は、補正量の大きさを調整するための式である。すなわち、定数C1は、定数C1の値が大きいほど補正量は大きくなる。定数C1は、予め定められ、0<C1≦1の範囲(例えば0.03)で設定される。以上の式(3)〜(5)による変換によって得られた補正度A4を示すデータが、新たな補正度データ70としてメインメモリに記憶される。上記ステップS16の次にステップS17の処理が実行される。
In step S16, the CPU 10 converts the value of the correction degree A. In the present embodiment, the correction degree A is converted so that the correction degree A becomes closer to 1 as the magnitude L of the detected acceleration vector Va1 is closer to the magnitude of gravitational acceleration. Specifically, the CPU 10 reads the correction degree data 70 stored in the main memory, and converts the correction degree A indicated by the correction degree data 70 according to the following equations (3) to (5).
A2 = 1- (A1 / R) (3)
A3 = A2 × A2 (4)
A4 = A3 × C1 (5)
In the above formulas (3) to (5), the variable A1 is the correction degree before conversion (value indicated by the correction degree data 70 currently stored in the main memory), and the variable A4 is finally converted in step S16. Is the degree of correction. The above expression (3) is an expression for obtaining the corrected degree of correction A2 so that the degree of correction A1 before the conversion becomes closer to 1 as the magnitude of the gravitational acceleration (= 1) is closer. The above equation (4) is an equation for obtaining the corrected degree of correction A3 so that a larger weight is assigned as the correction degree A2 before conversion is closer to 1. The above equation (5) is an equation for adjusting the magnitude of the correction amount. That is, the correction amount of the constant C1 increases as the value of the constant C1 increases. The constant C1 is determined in advance and is set in a range of 0 <C1 ≦ 1 (for example, 0.03). Data indicating the correction degree A4 obtained by the conversion according to the above equations (3) to (5) is stored as new correction degree data 70 in the main memory. Following step S16, the process of step S17 is executed.

なお、本実施形態においては、上式(3)〜(5)による変換を行ったが、他の実施形態においては、上式(3)〜(5)のうち一部または全部の変換を省略してもよい。ただし、上式(3)の変換を省略する場合には、後述するステップS18で用いる式(7)において、加速度ベクトルVa2と重力方向ベクトル(0,−1,0)とを入れ替える必要がある。   In the present embodiment, the conversions according to the above formulas (3) to (5) are performed. However, in other embodiments, some or all of the conversions in the above formulas (3) to (5) are omitted. May be. However, when the conversion of the above equation (3) is omitted, it is necessary to replace the acceleration vector Va2 and the gravity direction vector (0, -1, 0) in equation (7) used in step S18 described later.

ステップS17において、CPU10は、XYZ座標系で表現される加速度ベクトルVa1をxyz座標系の値Va2へと変換する。xyz座標系における加速度ベクトルVa2は、正規化された加速度ベクトルVa1を、前回のフレームにおいて得られた第1の姿勢を表す第1姿勢行列M1を用いて変換することによって算出される。すなわち、CPU10は、ステップS13においてメインメモリに記憶された(正規化された)加速度ベクトルVa1のデータと、第1姿勢データ68とを読み出す。そして、当該加速度ベクトルVa1と当該第1姿勢データ68により示される第1姿勢行列M1とを用いて、xyz座標系における加速度ベクトルVa2を算出する。より具体的には、正規化された加速度ベクトルVa1=(nx,ny,nz)とし、第1姿勢行列M1の各要素を上式(1)に示す変数とし、xyz座標系で表現される加速度ベクトルVa2=(vx,vy,vz)とすると、加速度ベクトルVa2は次の式(6)に従って算出される。
vx=Xx×nx+Yx×ny+Zx×nz
vy=Xy×nx+Yy×ny+Zy×nz
vz=Xz×nx+Yz×ny+Zz×nz …(6)
上式(6)に示されるように、加速度ベクトルVa2は、回転行列である第1姿勢行列M1によって加速度ベクトルVa1を回転させることによって得ることができる。ステップS17において算出された加速度ベクトルVa2はメインメモリに記憶される。上記ステップS17の次にステップS18の処理が実行される。
In step S17, the CPU 10 converts the acceleration vector Va1 expressed in the XYZ coordinate system into a value Va2 in the xyz coordinate system. The acceleration vector Va2 in the xyz coordinate system is calculated by converting the normalized acceleration vector Va1 using the first posture matrix M1 representing the first posture obtained in the previous frame. That is, the CPU 10 reads the data of the acceleration vector Va1 (normalized) stored in the main memory and the first attitude data 68 in step S13. Then, using the acceleration vector Va1 and the first posture matrix M1 indicated by the first posture data 68, an acceleration vector Va2 in the xyz coordinate system is calculated. More specifically, normalized acceleration vector Va1 = (nx, ny, nz), each element of the first posture matrix M1 is a variable shown in the above equation (1), and acceleration expressed in the xyz coordinate system If the vector Va2 = (vx, vy, vz), the acceleration vector Va2 is calculated according to the following equation (6).
vx = Xx * nx + Yx * ny + Zx * nz
vy = Xy * nx + Yy * ny + Zy * nz
vz = Xz * nx + Yz * ny + Zz * nz (6)
As shown in the above equation (6), the acceleration vector Va2 can be obtained by rotating the acceleration vector Va1 by the first posture matrix M1 that is a rotation matrix. The acceleration vector Va2 calculated in step S17 is stored in the main memory. Following step S17, the process of step S18 is executed.

ステップS18において、CPU10は、xyz座標系で表現される加速度ベクトルVa2と補正度Aとを用いて補正量ベクトルVgを算出する。補正量ベクトルVgは、上記ステップS16による変換後の補正度と、xyz座標系の鉛直下方向(重力方向)を示すベクトル(0,−1,0)とを用いて算出される。具体的には、CPU10は、メインメモリに記憶されている補正度データ70を読み出し、当該補正度データ70により示される補正度Aを用いて、以下の式(7)に従って補正量ベクトルVg=(gx,gy,gz)を算出する。
gx=(0−vx)×A+vx
gy=(−1−vy)×A+vy
gz=(0−vz)×A+vz …(7)
上式(7)に示されるように、補正量ベクトルVgは、加速度ベクトルVa2の終点から重力方向ベクトル(0,−1,0)の終点までを結ぶ線分をA:(1−A)に内分する点を終点とするベクトルである。したがって、補正量ベクトルVgは、補正度Aの値が大きいほど、重力方向ベクトルに近づくこととなる。CPU10は、上式(7)によって算出された補正量ベクトルVgを示すデータを、補正量ベクトルデータ71としてメインメモリに記憶する。上記ステップS18の次にステップS19の処理が実行される。
In step S18, the CPU 10 calculates the correction amount vector Vg using the acceleration vector Va2 expressed in the xyz coordinate system and the correction degree A. The correction amount vector Vg is calculated using the degree of correction after the conversion in step S16 and a vector (0, -1, 0) indicating the vertical downward direction (gravity direction) of the xyz coordinate system. Specifically, the CPU 10 reads out the correction degree data 70 stored in the main memory, and uses the correction degree A indicated by the correction degree data 70, according to the following equation (7), the correction amount vector Vg = ( gx, gy, gz) is calculated.
gx = (0−vx) × A + vx
gy = (− 1−vy) × A + vy
gz = (0−vz) × A + vz (7)
As shown in the above equation (7), the correction amount vector Vg is a line segment connecting the end point of the acceleration vector Va2 to the end point of the gravity direction vector (0, -1, 0) as A: (1-A). It is a vector whose end point is a point to be internally divided. Accordingly, the correction amount vector Vg is closer to the gravity direction vector as the correction degree A is larger. The CPU 10 stores data indicating the correction amount vector Vg calculated by the above equation (7) as correction amount vector data 71 in the main memory. Following step S18, the process of step S19 is executed.

ステップS19において、CPU10は、上記ステップS18で算出された補正量ベクトルVgを正規化する。すなわち、メインメモリに記憶されている補正量ベクトルデータ71を読み出し、当該補正量ベクトルデータ71により示されるベクトルを正規化する。そして、正規化されたベクトルを示すデータを新たな補正量ベクトルデータ71としてメインメモリに記憶する。なお、上記ステップS19で算出された補正量ベクトルVgが、図9に示すベクトルv3に相当する。上記ステップS19の次にステップS20の処理が実行される。   In step S19, the CPU 10 normalizes the correction amount vector Vg calculated in step S18. That is, the correction amount vector data 71 stored in the main memory is read, and the vector indicated by the correction amount vector data 71 is normalized. Then, the data indicating the normalized vector is stored as new correction amount vector data 71 in the main memory. The correction amount vector Vg calculated in step S19 corresponds to the vector v3 shown in FIG. Following step S19, the process of step S20 is executed.

ステップS20において、CPU10は、第1の姿勢を補正するための補正行列Maを算出する。補正行列Maは、xyz座標系で表現される加速度ベクトルVa2と、ステップS19において正規化された補正量ベクトルVgとに基づいて算出される。具体的には、CPU10は、ステップS17でメインメモリに記憶された加速度ベクトルVa2と、補正量ベクトルデータ71を読み出す。そして、上記加速度ベクトルVa2を補正量ベクトルVgと一致するように回転させる回転行列を算出し、算出された回転行列を補正行列Maとする。つまり、補正行列Maは、図9に示す角度Δθの回転を行う回転行列である。ステップS20で算出された補正行列Maを示すデータは、補正行列データ72としてメインメモリに記憶される。上記ステップS20の次にステップS21の処理が実行される。   In step S20, the CPU 10 calculates a correction matrix Ma for correcting the first posture. The correction matrix Ma is calculated based on the acceleration vector Va2 expressed in the xyz coordinate system and the correction amount vector Vg normalized in step S19. Specifically, the CPU 10 reads the acceleration vector Va2 and the correction amount vector data 71 stored in the main memory in step S17. Then, a rotation matrix for rotating the acceleration vector Va2 so as to coincide with the correction amount vector Vg is calculated, and the calculated rotation matrix is set as a correction matrix Ma. That is, the correction matrix Ma is a rotation matrix that performs the rotation of the angle Δθ shown in FIG. Data indicating the correction matrix Ma calculated in step S20 is stored in the main memory as correction matrix data 72. Following step S20, the process of step S21 is executed.

ステップS21において、CPU10は、第1の姿勢を示す第1姿勢行列M1を補正行列Maで補正する。具体的には、CPU10は、メインメモリに記憶されている第1姿勢データ68および補正行列データ72を読み出す。そして、当該第1姿勢データ68により示される第1姿勢行列M1を、当該補正行列データ72により示される補正行列Maによって変換する(第1姿勢行列M1と補正行列Maとの積を算出する)。変換後の第1姿勢行列M1が、補正された第1の姿勢を示すこととなる。つまり、ステップS21の処理は、図10に示すベクトルv1を角度Δθだけ回転させる処理に相当する。CPU10は、変換後の第1姿勢行列M1を示すデータを、新たな第1姿勢データ68としてメインメモリに記憶する。上記ステップS21の後、CPU10は第1補正処理を終了する。   In step S21, the CPU 10 corrects the first posture matrix M1 indicating the first posture with the correction matrix Ma. Specifically, the CPU 10 reads the first attitude data 68 and the correction matrix data 72 stored in the main memory. Then, the first attitude matrix M1 indicated by the first attitude data 68 is converted by the correction matrix Ma indicated by the correction matrix data 72 (the product of the first attitude matrix M1 and the correction matrix Ma is calculated). The converted first posture matrix M1 indicates the corrected first posture. That is, the process of step S21 corresponds to the process of rotating the vector v1 shown in FIG. 10 by the angle Δθ. The CPU 10 stores data indicating the converted first attitude matrix M1 as new first attitude data 68 in the main memory. After step S21, the CPU 10 ends the first correction process.

以上のように、第1補正処理においては、加速度センサ37によって検出された加速度ベクトルと、重力方向ベクトル(図8に示すベクトルG)との間に補正量ベクトルVgを算出し(ステップS18およびS19)、この補正量ベクトルVgにより表される補正量(補正行列Ma。図9に示す角度Δθ)だけ第1の姿勢を補正した(ステップS21)。これによって、ジャイロセンサ55および56から算出される第1の姿勢(図8に示すベクトルv1または角度θ1)を、加速度センサ37によって決められる第2の姿勢(図8に示す角度θ2)に近づける補正を行うことができる。かかる補正を行うことにより、より正確な値となるように第1の姿勢を補正することができる。   As described above, in the first correction process, the correction amount vector Vg is calculated between the acceleration vector detected by the acceleration sensor 37 and the gravity direction vector (vector G shown in FIG. 8) (steps S18 and S19). ), The first posture is corrected by the correction amount (correction matrix Ma. Angle Δθ shown in FIG. 9) represented by the correction amount vector Vg (step S21). As a result, the first attitude calculated from the gyro sensors 55 and 56 (vector v1 or angle θ1 shown in FIG. 8) is corrected to approach the second attitude (angle θ2 shown in FIG. 8) determined by the acceleration sensor 37. It can be performed. By performing such correction, the first posture can be corrected so as to have a more accurate value.

また、第1補正処理においては、加速度ベクトルVa1が信頼できる場合ほど(加速度ベクトルVa1の大きさLと重力加速度の大きさとの差が小さいほど)、補正度Aの値が大きくなり、その結果、第1の姿勢は第2の姿勢により近づくように補正される。つまり、加速度ベクトルVa1が信頼できる場合ほど、補正量が大きくなり、補正後の第1の姿勢に第2の姿勢が強く反映されることとなる。このように、本実施形態によれば、加速度センサベクトルVa1の信頼度に応じて第1補正処理における補正量が決まるので、補正量を当該信頼度に応じて適切に決定することができ、ひいては入力装置8の姿勢をより正確に算出することができる。   In the first correction process, as the acceleration vector Va1 is reliable (the smaller the difference between the magnitude L of the acceleration vector Va1 and the magnitude of gravitational acceleration), the value of the correction degree A increases. The first posture is corrected so as to be closer to the second posture. That is, the more reliable the acceleration vector Va1, the larger the correction amount, and the second posture is strongly reflected in the corrected first posture. As described above, according to the present embodiment, the correction amount in the first correction process is determined according to the reliability of the acceleration sensor vector Va1, and therefore the correction amount can be appropriately determined according to the reliability. The attitude of the input device 8 can be calculated more accurately.

なお、本実施形態においては、上記ステップS18で算出される補正量ベクトルVgは、加速度ベクトルVa2の終点から重力方向ベクトルの終点までを結ぶ線分をA:(1−A)に内分する点を終点とするベクトルであって、補正度Aの値が大きいほど重力方向ベクトルに近づくベクトルであった。ここで、他の実施形態において、補正度Aの算出方法によっては、補正量ベクトルVgは、重力方向ベクトルの終点と加速度ベクトルVa2の終点とを(1−A):Aに内分する点を終点とするベクトルであって、補正度Aの値が小さいほど重力方向ベクトルに近づくベクトルとしてもよい。このとき、上記ステップS20においては、上記補正量ベクトルVgを重力方向と一致するように回転させる回転行列を算出し、算出された回転行列を補正行列Maとすればよい。これによっても、本実施形態と同様に補正を行うことができる。   In the present embodiment, the correction amount vector Vg calculated in step S18 is a point that internally divides the line segment connecting the end point of the acceleration vector Va2 to the end point of the gravity direction vector into A: (1-A). Is the vector that approaches the gravity direction vector as the value of the correction degree A increases. In another embodiment, depending on the method of calculating the correction degree A, the correction amount vector Vg is a point that internally divides the end point of the gravity direction vector and the end point of the acceleration vector Va2 into (1-A): A. The end point vector may be a vector that approaches the gravity direction vector as the correction degree A is smaller. At this time, in step S20, a rotation matrix for rotating the correction amount vector Vg so as to coincide with the direction of gravity may be calculated, and the calculated rotation matrix may be used as the correction matrix Ma. This also makes it possible to perform correction as in the present embodiment.

次に、第1補正処理の第2の処理例について説明する。本実施形態においては、ゲーム装置3は、第1補正処理として上記第1の処理例を採用してもよいし、下記の第2の処理例を採用してもよい。   Next, a second processing example of the first correction processing will be described. In the present embodiment, the game apparatus 3 may adopt the first processing example as the first correction processing, or may adopt the following second processing example.

上述のように、本実施形態では、加速度ベクトルの向きが鉛直下向きとなる場合における入力装置8の姿勢を第2の姿勢とし、第1の姿勢を第2の姿勢へと近づける補正を行っている(図8〜図10、図15)。つまり、第1の姿勢を第2の姿勢へと近づける(または一致させる)ために、加速度ベクトルと重力方向ベクトルとを近づける(一致させる)ように、第1の姿勢を回転させる補正を行っている。ここで、第1の姿勢を回転させる方法の一例として、図16および図17を参照して、加速度ベクトルを単純に回転させて重力方向ベクトルと一致させる方法、すなわち、加速度ベクトルを最短距離で回転させて重力方向ベクトルと一致させる回転行列を用いて第1の姿勢を回転させる方法を考える。   As described above, in the present embodiment, when the direction of the acceleration vector is vertically downward, the posture of the input device 8 is set as the second posture, and correction is performed so that the first posture approaches the second posture. (FIGS. 8 to 10, FIG. 15). That is, in order to bring the first posture closer to (or match) the second posture, correction is performed to rotate the first posture so that the acceleration vector and the gravity direction vector are brought closer (matched). . Here, as an example of a method of rotating the first posture, referring to FIGS. 16 and 17, a method of simply rotating the acceleration vector to match the gravity direction vector, that is, rotating the acceleration vector at the shortest distance Let us consider a method of rotating the first posture using a rotation matrix that matches the gravity direction vector.

図16は、空間座標系における重力方向、加速度、および姿勢を表すベクトルを示す図である。図16においては、重力ベクトルG(=(0,−1,0))が重力方向(鉛直下方向)を表し、Z軸ベクトルM1Zは、入力装置8が第1の姿勢である場合における入力装置8のZ軸の向きを表し、加速度ベクトルVa(上記ベクトルVa2に相当)が入力装置8に加えられる加速度を表している。また、図17は、図16に示す状態から、加速度ベクトルVaを最短距離で回転させる方法によって第1の姿勢(Z軸ベクトルM1Z)を回転させた状態を示す図である。図16に示す場合において、上記方法によって第1の姿勢(Z軸ベクトルM1Z)を回転させると、図17に示すように、Z軸ベクトルM1Zが補正前後において大きく変化する。このように、加速度ベクトルを単純に重力方向ベクトルと一致させる方法では、入力装置8の姿勢を表す所定軸(図16ではZ軸)が、補正前後において大きく変化してしまうことがある。   FIG. 16 is a diagram illustrating vectors representing the gravity direction, acceleration, and posture in the spatial coordinate system. In FIG. 16, the gravity vector G (= (0, -1, 0)) represents the direction of gravity (vertically downward), and the Z-axis vector M1Z is an input device when the input device 8 is in the first posture. 8 represents the direction of the Z axis, and an acceleration vector Va (corresponding to the vector Va2) represents an acceleration applied to the input device 8. FIG. 17 is a diagram illustrating a state in which the first posture (Z-axis vector M1Z) is rotated by the method of rotating the acceleration vector Va at the shortest distance from the state illustrated in FIG. In the case shown in FIG. 16, when the first posture (Z-axis vector M1Z) is rotated by the above method, as shown in FIG. 17, the Z-axis vector M1Z largely changes before and after correction. As described above, in the method of simply matching the acceleration vector with the gravity direction vector, the predetermined axis (the Z axis in FIG. 16) representing the attitude of the input device 8 may greatly change before and after correction.

入力装置8の姿勢を表す所定軸が補正前後において大きく変化することは、例えば、仮想空間内におけるオブジェクトの姿勢を入力装置8の姿勢に応じて制御する場合に問題となる。一例として、仮想のゲーム空間内における剣オブジェクトの姿勢を入力装置8の姿勢に応じて変化させることによって、入力装置8を振る操作によって剣オブジェクトを振ることを可能とするゲーム処理を考える。このようなゲーム処理において、例えば剣オブジェクトの長手方向が入力装置8のZ軸方向に対応しているとすると、入力装置8のZ軸が補正によって大きく変化することによって、剣オブジェクトの長手方向の向きが大きく変化することになる。このように、オブジェクトの長手方向が大きく変化すると、(たとえ補正後の姿勢が正確なものであったとしても)プレイヤは操作に違和感を感じてしまう。したがって、入力装置8の姿勢を表す軸のうち、オブジェクトの長手方向に対応する軸については、補正による変化をできるだけ小さくすることが好ましい。また、オブジェクトの長手方向に対応する軸でなくても、他の軸よりもプレイヤが注意を向ける軸(例えば、他の軸よりもゲーム上重要な意味を持つ軸)については、補正による変化をできるだけ小さくすることが好ましい。   The fact that the predetermined axis representing the posture of the input device 8 changes greatly before and after the correction becomes a problem when, for example, the posture of the object in the virtual space is controlled according to the posture of the input device 8. As an example, consider a game process in which a sword object can be shaken by an operation of shaking the input device 8 by changing the posture of the sword object in the virtual game space according to the posture of the input device 8. In such a game process, for example, if the longitudinal direction of the sword object corresponds to the Z-axis direction of the input device 8, the Z-axis of the input device 8 changes greatly due to the correction so that the longitudinal direction of the sword object The direction will change greatly. Thus, when the longitudinal direction of the object changes greatly, the player feels uncomfortable with the operation (even if the corrected posture is accurate). Therefore, it is preferable to minimize the change due to the correction of the axis corresponding to the longitudinal direction of the object among the axes representing the attitude of the input device 8. Even if the axis is not the axis corresponding to the longitudinal direction of the object, the axis that the player pays more attention to than the other axis (for example, the axis having a more important meaning in the game than the other axis) is changed by the correction. It is preferable to make it as small as possible.

そこで、本実施形態の第1補正処理の第2の処理例では、入力装置8の姿勢を表す所定軸に関して、補正前後における変化ができるだけ小さくなるように、上記第1の姿勢の補正を行う。以下、図18−図21を参照して、第1補正処理の第2の処理例について説明する。なお、以下では、補正前後における変化をできるだけ小さくする上記所定軸が入力装置8のZ軸である場合を例として説明を行う。   Therefore, in the second processing example of the first correction processing of the present embodiment, the first posture is corrected so that the change before and after correction is as small as possible with respect to the predetermined axis representing the posture of the input device 8. Hereinafter, a second processing example of the first correction processing will be described with reference to FIGS. In the following description, the case where the predetermined axis that minimizes the change before and after correction is the Z axis of the input device 8 will be described as an example.

図18は、図14に示す第1補正処理(ステップS5)の第2の処理例の流れを示すフローチャートである。第1補正処理の第2の処理例においては、まずステップS11において、CPU10は、加速度センサ37によって検出された加速度の大きさLを算出する。ステップS30において、CPU10は、加速度センサ37によって検出された加速度の大きさがLと重力加速度の大きさ(ここでは1とする)との差を算出し、その差の大きさが所定値Kより小さいか否かを判定する。すなわち、加速度の大きさが重力加速度の大きさから大きく外れている場合には、少なくとも入力装置8の姿勢(加速度から推測される姿勢)が安定しておらず、加速度方向を重力加速度とみなすことが妥当でないと考えられるので、加速度の大きさが重力加速度の大きさに近いときだけ補正の処理を行うようにする。ステップS30を行う理由は第1の処理例におけるステップS15と同様の理由である。ステップS30の判定結果が肯定である場合、ステップS31の処理が実行される。一方、ステップS30の判定結果が否定である場合、以降のステップS31〜S37の処理がスキップされて、CPU10は第1補正処理を終了する。   FIG. 18 is a flowchart showing the flow of the second processing example of the first correction processing (step S5) shown in FIG. In the second processing example of the first correction process, first, in step S <b> 11, the CPU 10 calculates the magnitude L of the acceleration detected by the acceleration sensor 37. In step S30, the CPU 10 calculates the difference between the magnitude of the acceleration detected by the acceleration sensor 37 and the magnitude of the gravitational acceleration (here, 1), and the magnitude of the difference is based on the predetermined value K. It is determined whether it is small. That is, when the magnitude of acceleration deviates significantly from the magnitude of gravitational acceleration, at least the posture of the input device 8 (posture estimated from acceleration) is not stable, and the acceleration direction is regarded as gravitational acceleration. Therefore, correction processing is performed only when the magnitude of acceleration is close to the magnitude of gravitational acceleration. The reason for performing step S30 is the same reason as step S15 in the first processing example. If the determination result of step S30 is affirmative, the process of step S31 is executed. On the other hand, when the determination result of step S30 is negative, the processes of subsequent steps S31 to S37 are skipped, and the CPU 10 ends the first correction process.

ステップS31において、CPU10は、投影加速度ベクトルVapを算出する。図19は、投影加速度ベクトルおよび投影重力ベクトル(後述)を示す図である。図19に示すように、投影加速度ベクトルVapは、空間座標系(xyz座標系)において、入力装置8のZ軸(Z軸ベクトルM1Z)に垂直な平面XYに対して、加速度ベクトルVaを投影したベクトルである。   In step S31, the CPU 10 calculates a projection acceleration vector Vap. FIG. 19 is a diagram showing a projected acceleration vector and a projected gravity vector (described later). As shown in FIG. 19, the projected acceleration vector Vap is obtained by projecting the acceleration vector Va onto a plane XY perpendicular to the Z axis (Z axis vector M1Z) of the input device 8 in the spatial coordinate system (xyz coordinate system). Is a vector.

上記投影加速度ベクトルVapは、第1姿勢行列M1と、加速度センサ37によって検出された加速度ベクトル(加速度データ64により示される加速度ベクトル)Va1とを用いて算出することができる。具体的には、ステップS31においてCPU10は、メインメモリに記憶されている加速度データ64および第1姿勢データ68を読み出す。そして、加速度データ64により示される加速度ベクトルVa1および第1姿勢データ68により示される第1姿勢行列M1を用いて、次の式(8)に従って投影加速度ベクトルVap=(Vax,Vay,Vaz)を算出する。すなわち、加速度ベクトルVa1=(VX,VY,VZ)とし、第1姿勢行列M1の各要素を上式(1)に示す変数とし、投影加速度ベクトルVap=(Vax,Vay,Vaz)とすると、投影加速度ベクトルVapは次の式(8)に従って算出される。
Vax=Xx・VX+Yx・VY
Vay=Xy・VX+Yy・VY
Vaz=Xz・VX+Yz・VY …(8)
上式(8)は、コントローラ座標系(XYZ座標系)で表現される加速度ベクトルVa1のXY成分を、xyz座標系に変換する(第1姿勢行列M1で回転させる)処理を意味している。投影加速度ベクトルVapは、xyz座標系で表現される、XY平面上のベクトルである。したがって、投影加速度ベクトルVapは、上式(8)のとおり、加速度ベクトルVa1をからZ成分を除いたベクトル(VX,VY,0)を、xyz座標系に変換することによって得ることができる。CPU10は、上式(8)によって算出された投影加速度ベクトルVapを正規化し、正規化された投影加速度ベクトルVapを示すデータ(投影加速度データ)はメインメモリに記憶される。上記ステップS31の次にステップS32の処理が実行される。
The projected acceleration vector Vap can be calculated using the first posture matrix M1 and the acceleration vector (acceleration vector indicated by the acceleration data 64) Va1 detected by the acceleration sensor 37. Specifically, in step S31, the CPU 10 reads the acceleration data 64 and the first attitude data 68 stored in the main memory. Then, using the acceleration vector Va1 indicated by the acceleration data 64 and the first attitude matrix M1 indicated by the first attitude data 68, the projection acceleration vector Vap = (Vax, Vay, Vaz) is calculated according to the following equation (8). To do. That is, if the acceleration vector Va1 = (VX, VY, VZ), each element of the first posture matrix M1 is a variable shown in the above equation (1), and the projection acceleration vector Vap = (Vax, Vay, Vaz), the projection The acceleration vector Vap is calculated according to the following equation (8).
Vax = Xx / VX + Yx / VY
Vay = Xy / VX + Yy / VY
Vaz = Xz · VX + Yz · VY (8)
The above equation (8) means a process of converting the XY component of the acceleration vector Va1 expressed in the controller coordinate system (XYZ coordinate system) into the xyz coordinate system (rotating with the first attitude matrix M1). The projected acceleration vector Vap is a vector on the XY plane expressed in the xyz coordinate system. Therefore, the projected acceleration vector Vap can be obtained by converting a vector (VX, VY, 0) obtained by removing the Z component from the acceleration vector Va1 into the xyz coordinate system as shown in the above equation (8). The CPU 10 normalizes the projection acceleration vector Vap calculated by the above equation (8), and data indicating the normalized projection acceleration vector Vap (projection acceleration data) is stored in the main memory. Following step S31, the process of step S32 is executed.

ステップS32において、CPU10は、投影重力ベクトルGpを算出する。図19に示すように、投影重力ベクトルGpは、空間座標系(xyz座標系)において、入力装置8のZ軸(Z軸ベクトルM1Z)に垂直な平面XYに対して、重力ベクトルGを投影したベクトルである。   In step S32, the CPU 10 calculates a projected gravity vector Gp. As shown in FIG. 19, the projected gravity vector Gp is obtained by projecting the gravity vector G onto the plane XY perpendicular to the Z axis (Z axis vector M1Z) of the input device 8 in the spatial coordinate system (xyz coordinate system). Is a vector.

上記投影重力ベクトルGpは、上記投影加速度ベクトルVapと同様の方法で算出することができる。すなわち、投影重力ベクトルGpは、第1姿勢行列M1と、重力ベクトルとを用いて算出することができる。ここで、空間座標系(xyz座標系)における重力ベクトルG=(0,−1,0)は、コントローラ座標系(XYZ座標系)では(−Xy,−Yy,−Zy)と表すことができる。以上より、ステップS31においてCPU10は、メインメモリに記憶されている第1姿勢データ68を読み出す。そして、第1姿勢データ68により示される第1姿勢行列M1と、XYZ座標系における重力ベクトルG=(−Xy,−Yy,−Zy)とを用いて、次の式(9)に従って投影重力ベクトルGp=(Gx,Gy,Gz)を算出する。
Gx=−Xx・Xy−Yx・Yy
Gy=−Xy・Xy−Yy・Yy
Gz=−Xz・Xy−Yz・Yy …(9)
上式(8)と同様の考え方により、投影重力ベクトルVpは、XYZ座標系における重力ベクトルGからZ成分を除いたベクトルを、xyz座標系に変換することによって得ることができる。したがって、上式(9)のように、XYZ座標系で表現される重力ベクトルGのXY成分を、第1姿勢行列M1で回転させることによって、投影重力ベクトルVpを得ることができる。CPU10は、上式(9)によって算出された投影重力ベクトルGpを正規化し、正規化された投影重力ベクトルGpを示すデータ(投影重力データ)はメインメモリに記憶される。上記ステップS32の次にステップS33の処理が実行される。
The projected gravity vector Gp can be calculated by the same method as the projected acceleration vector Vap. That is, the projected gravity vector Gp can be calculated using the first posture matrix M1 and the gravity vector. Here, the gravity vector G = (0, −1, 0) in the spatial coordinate system (xyz coordinate system) can be expressed as (−Xy, −Yy, −Zy) in the controller coordinate system (XYZ coordinate system). . As described above, in step S31, the CPU 10 reads the first attitude data 68 stored in the main memory. Then, using the first posture matrix M1 indicated by the first posture data 68 and the gravity vector G = (− Xy, −Yy, −Zy) in the XYZ coordinate system, the projected gravity vector according to the following equation (9). Gp = (Gx, Gy, Gz) is calculated.
Gx = −Xx · Xy−Yx · Yy
Gy = -Xy.Xy-Yy.Yy
Gz = −Xz · Xy−Yz · Yy (9)
The projected gravity vector Vp can be obtained by converting a vector obtained by removing the Z component from the gravity vector G in the XYZ coordinate system into the xyz coordinate system based on the same idea as the above equation (8). Therefore, the projected gravity vector Vp can be obtained by rotating the XY component of the gravity vector G expressed in the XYZ coordinate system by the first posture matrix M1 as in the above equation (9). The CPU 10 normalizes the projected gravity vector Gp calculated by the above equation (9), and data indicating the normalized projected gravity vector Gp (projected gravity data) is stored in the main memory. Following step S32, the process of step S33 is executed.

ステップS33において、CPU10は、第1の姿勢に対して第1の変換を行うための第1変換行列mtx1を算出する。第1変換行列mtx1は、投影加速度ベクトルVapを投影重力ベクトルGpと一致させるように、Z軸回りの回転を行う回転行列である(図19に示す矢印参照)。具体的には、CPU10は、メインメモリに記憶されている上記投影加速度データおよび上記投影重力データを読み出す。そして、投影加速度ベクトルVapを投影重力ベクトルGpと一致するように回転させる回転行列を算出し、算出された回転行列を第1変換行列mtx1とする。ステップS33で算出された第1変換行列mtx1を示すデータ(第1変換行列データ)はメインメモリに記憶される。上記ステップS33の次にステップS34の処理が実行される。   In step S33, the CPU 10 calculates a first transformation matrix mtx1 for performing the first transformation on the first posture. The first transformation matrix mtx1 is a rotation matrix that rotates around the Z axis so that the projected acceleration vector Vap matches the projected gravity vector Gp (see the arrow shown in FIG. 19). Specifically, the CPU 10 reads the projection acceleration data and the projection gravity data stored in the main memory. Then, a rotation matrix for rotating the projection acceleration vector Vap so as to coincide with the projection gravity vector Gp is calculated, and the calculated rotation matrix is set as a first conversion matrix mtx1. Data (first conversion matrix data) indicating the first conversion matrix mtx1 calculated in step S33 is stored in the main memory. Following step S33, the process of step S34 is executed.

ステップS34において、CPU10は、第1の姿勢を示す第1姿勢行列M1を第1変換行列mtx1で変換する。具体的には、CPU10は、メインメモリに記憶されている第1姿勢データ68および上記第1変換行列データを読み出す。そして、当該第1姿勢データ68により示される第1姿勢行列M1を、当該第1変換行列データにより示される第1変換行列mtx1によって変換する(第1姿勢行列M1に対して右側から第1変換行列mtx1を掛ける)。これによって、第1の姿勢に対して第1の変換が行われたこととなる。CPU10は、変換後の第1姿勢行列M1を示すデータを、新たな第1姿勢データ68としてメインメモリに記憶する。上記ステップS34の次にステップS35の処理が実行される。   In step S34, the CPU 10 converts the first posture matrix M1 indicating the first posture with the first conversion matrix mtx1. Specifically, the CPU 10 reads the first attitude data 68 and the first transformation matrix data stored in the main memory. Then, the first attitude matrix M1 indicated by the first attitude data 68 is converted by the first conversion matrix mtx1 indicated by the first conversion matrix data (the first conversion matrix from the right side with respect to the first attitude matrix M1). multiply by mtx1). As a result, the first conversion is performed on the first posture. The CPU 10 stores data indicating the converted first attitude matrix M1 as new first attitude data 68 in the main memory. Following step S34, the process of step S35 is executed.

上記ステップS34によって、第1の姿勢に対して第1変換行列によって変換が行われたこととなる。図20は、図19に示す状態から第1の変換を行った状態を示す図である。ここで、第1変換行列による第1の変換はZ軸回りの回転であるので、図20に示されるように、入力装置8のZ軸を表すZ軸ベクトルM1Zは第1の変換によっては向きが変わらない。ただし、図20には示していないが、入力装置8のX軸およびY軸は第1の変換によってZ軸回りに回転しており、第1の姿勢は変化している。   In step S34, the first posture is transformed by the first transformation matrix. FIG. 20 is a diagram illustrating a state in which the first conversion is performed from the state illustrated in FIG. 19. Here, since the first transformation by the first transformation matrix is rotation around the Z axis, as shown in FIG. 20, the Z axis vector M1Z representing the Z axis of the input device 8 is oriented depending on the first transformation. Does not change. However, although not shown in FIG. 20, the X axis and the Y axis of the input device 8 are rotated around the Z axis by the first conversion, and the first posture is changed.

ステップS35において、CPU10は、上記ステップS34によって変換された後の入力装置8の姿勢に対応する(入力装置8に加えられる)加速度を示すように、加速度ベクトルVaを修正する。修正後の加速度ベクトルVa’は、上記ステップS34によって変換された後の第1の姿勢(第1姿勢行列M1)と、XYZ座標系における加速度ベクトルVa1とを用いて算出することができる。具体的には、CPU10は、メインメモリに記憶されている第1姿勢データ68および加速度データ64を読み出し、第1姿勢行列M1と加速度ベクトルVa1と用いて、次の式(10)に従って修正後の加速度ベクトルVa’=(Cx,Cy,Cz)を算出する。
Cx=Xx・VX+Yx・VY+Zx・VZ
Cy=Xy・VX+Yy・VY+Zy・VZ
Cz=Xz・VX+Yz・VY+Zz・VZ …(10)
上式(10)に示されるように、修正後の加速度ベクトルVa’は、XYZ座標系における加速度ベクトルVa1を、上記ステップS34によって変換された後の第1姿勢行列M1で回転させることによって得ることができる。なお、図20に示されるように、修正後の加速度ベクトルVa’は、xyz座標系における加速度ベクトルVa2を、上記第1変換行列mtx1で回転させたものである。つまり、修正後の加速度ベクトルVa’は、加速度ベクトルVa2と、上記第1変換行列mtx1とを用いて算出することも可能である。なお、第2の処理例では、加速度ベクトルVa2を算出する処理を省くために、加速度ベクトルVa1が用いられる上式(10)によってベクトルVa’を算出している。CPU10は、上式(10)で算出された加速度ベクトルVa’を正規化し、正規化された加速度ベクトルVa’を示すデータ(修正加速度データ)をメインメモリに記憶する。上記ステップS35の次にステップS36の処理が実行される。
In step S35, the CPU 10 corrects the acceleration vector Va so as to indicate the acceleration corresponding to the attitude of the input device 8 after being converted in step S34 (applied to the input device 8). The corrected acceleration vector Va ′ can be calculated using the first posture (first posture matrix M1) after being converted in step S34 and the acceleration vector Va1 in the XYZ coordinate system. Specifically, the CPU 10 reads the first attitude data 68 and the acceleration data 64 stored in the main memory, and uses the first attitude matrix M1 and the acceleration vector Va1 to make a correction according to the following equation (10). An acceleration vector Va ′ = (Cx, Cy, Cz) is calculated.
Cx = Xx / VX + Yx / VY + Zx / VZ
Cy = Xy / VX + Yy / VY + Zy / VZ
Cz = Xz.VX + Yz.VY + Zz.VZ (10)
As shown in the above equation (10), the corrected acceleration vector Va ′ is obtained by rotating the acceleration vector Va1 in the XYZ coordinate system by the first posture matrix M1 after being converted in step S34. Can do. As shown in FIG. 20, the corrected acceleration vector Va ′ is obtained by rotating the acceleration vector Va2 in the xyz coordinate system by the first conversion matrix mtx1. That is, the corrected acceleration vector Va ′ can be calculated using the acceleration vector Va2 and the first conversion matrix mtx1. In the second processing example, in order to omit the process of calculating the acceleration vector Va2, the vector Va ′ is calculated by the above equation (10) using the acceleration vector Va1. The CPU 10 normalizes the acceleration vector Va ′ calculated by the above equation (10), and stores data (corrected acceleration data) indicating the normalized acceleration vector Va ′ in the main memory. Following step S35, the process of step S36 is executed.

ステップS36において、CPU10は、第1の姿勢に対して第2の変換を行うための第2変換行列mtx2を算出する。図21は、図20に示す状態から第2の変換を行った状態を示す図である。第2変換行列mtx2は、ステップS35における修正後の加速度ベクトルVa’を重力ベクトルGと一致させるように回転を行う回転行列である(図20に示す矢印参照)。具体的には、CPU10は、メインメモリに記憶されている上記修正加速度データを読み出す。そして、修正後の加速度ベクトルVa’を重力ベクトルG=(0,−1,0)と一致するように回転させる回転行列を算出し、算出された回転行列を第2変換行列mtx2とする。ステップS36で算出された第2変換行列mtx2を示すデータ(第2変換行列データ)はメインメモリに記憶される。上記ステップS36の次にステップS37の処理が実行される。   In step S36, the CPU 10 calculates a second conversion matrix mtx2 for performing the second conversion on the first posture. FIG. 21 is a diagram illustrating a state in which the second conversion is performed from the state illustrated in FIG. 20. The second transformation matrix mtx2 is a rotation matrix that rotates so that the corrected acceleration vector Va 'in step S35 matches the gravity vector G (see the arrow shown in FIG. 20). Specifically, the CPU 10 reads the corrected acceleration data stored in the main memory. Then, a rotation matrix for rotating the corrected acceleration vector Va ′ so as to coincide with the gravity vector G = (0, −1,0) is calculated, and the calculated rotation matrix is set as a second transformation matrix mtx2. Data indicating the second transformation matrix mtx2 calculated in step S36 (second transformation matrix data) is stored in the main memory. Following step S36, the process of step S37 is executed.

ステップS37において、CPU10は、第1の姿勢を示す第1姿勢行列M1を第2変換行列mtx2で変換する。具体的には、CPU10は、メインメモリに記憶されている第1姿勢データ68および上記第2変換行列データを読み出す。そして、当該第1姿勢データ68により示される第1姿勢行列M1を、当該第2変換行列データにより示される第2変換行列mtx2によって変換する(第1姿勢行列M1と第2変換行列mtx2との積を算出する)。これによって、第1の姿勢に対して第2の変換が行われたこととなる。このとき、図21に示されるように、Z軸ベクトルM1Zは第2の変換によって向きが変更される。CPU10は、変換後の第1姿勢行列M1を示すデータを、新たな第1姿勢データ68としてメインメモリに記憶する。上記ステップS37の後、CPU10は第1補正処理を終了する。   In step S37, the CPU 10 converts the first posture matrix M1 indicating the first posture with the second conversion matrix mtx2. Specifically, the CPU 10 reads out the first attitude data 68 and the second conversion matrix data stored in the main memory. Then, the first posture matrix M1 indicated by the first posture data 68 is transformed by the second transformation matrix mtx2 indicated by the second transformation matrix data (the product of the first posture matrix M1 and the second transformation matrix mtx2). Is calculated). As a result, the second conversion is performed on the first posture. At this time, as shown in FIG. 21, the direction of the Z-axis vector M1Z is changed by the second transformation. The CPU 10 stores data indicating the converted first attitude matrix M1 as new first attitude data 68 in the main memory. After step S37, the CPU 10 ends the first correction process.

以上のように、第1補正処理の第2の処理例によれば、まず、第1の姿勢に対して、Z軸に垂直な平面XYに加速度ベクトルVaを投影した方向(投影加速度ベクトルVap)と、当該平面XYに鉛直下方向(重力方向)を投影した方向(投影重力ベクトルGp)とを一致させるZ軸回りの回転を行う第1の変換によって変換される(ステップS34、図20)。そしてさらに、第1の姿勢に対して、上記第1の変換が行われた加速度ベクトル(加速度ベクトルVa’)の方向と鉛直下方向とを一致させる回転を行う第2の変換が行われる(ステップS37、図21)。このように、第1の変換を行ってから第2の変換を行うことによって、補正前後におけるZ軸の変化は最小となる。したがって、第2の処理例によれば、加速度ベクトルを単純に(最短距離で)回転させて重力方向ベクトルと一致させる方法(図17)に比べて、Z軸の変化を小さくすることができる。これによれば、入力装置8の姿勢によってオブジェクトの姿勢を操作する場合であって、例えば入力装置8のZ軸を仮想空間のオブジェクトの長手方向に対応させる場合において、第1補正処理による補正が行われてもオブジェクトの長手方向の向きがあまり変化しない。そのため、当該補正をプレイヤにとって目立ちにくくする(プレイヤが補正に気づきにくくする)ことができ、当該補正によってプレイヤが違和感を感じることを防止することができるので、その結果操作性の良いゲーム操作を提供することができる。   As described above, according to the second processing example of the first correction process, first, the direction in which the acceleration vector Va is projected onto the plane XY perpendicular to the Z axis with respect to the first posture (projected acceleration vector Vap). And the first transformation that performs rotation about the Z axis to match the direction (projected gravity vector Gp) in which the vertically downward direction (gravity direction) is projected onto the plane XY (step S34, FIG. 20). Further, a second conversion is performed for the first posture, in which rotation is performed so that the direction of the acceleration vector (acceleration vector Va ′) subjected to the first conversion matches the vertical downward direction (step). S37, FIG. 21). As described above, by performing the second conversion after the first conversion, the change in the Z-axis before and after the correction is minimized. Therefore, according to the second processing example, the change in the Z-axis can be reduced as compared with the method (FIG. 17) in which the acceleration vector is simply rotated (at the shortest distance) to coincide with the gravity direction vector. According to this, when the posture of the object is operated by the posture of the input device 8 and the Z axis of the input device 8 is made to correspond to the longitudinal direction of the object in the virtual space, for example, the correction by the first correction process is performed. Even if it is done, the longitudinal direction of the object does not change much. Therefore, the correction can be made inconspicuous for the player (the player can hardly notice the correction), and the player can be prevented from feeling uncomfortable with the correction, thereby providing a game operation with good operability. can do.

なお、上記実施形態においては、CPU10は、第1の変換処理(ステップS34)と第2の変換処理(ステップS35)とを別々に実行したが、他の実施形態においては、第1および第2の変換処理をまとめて1回の処理で実行するようにしてもよい。すなわち、図18に示す処理において、CPU10は、ステップS34の処理を実行しない代わりに、ステップS37において、第1変換行列mtx1と第2変換行列mtx2とを合成し、合成した回転行列で第1の姿勢を回転させるようにしてもよい。この場合でも、第1の変換と第2の変換とからなる変換によって入力装置8の姿勢を補正することができ、上記実施形態と同様の効果を得ることができる。   In the above embodiment, the CPU 10 separately executes the first conversion process (step S34) and the second conversion process (step S35). However, in other embodiments, the first and second conversion processes are performed. These conversion processes may be executed together in a single process. That is, in the process illustrated in FIG. 18, instead of executing the process of step S34, the CPU 10 combines the first conversion matrix mtx1 and the second conversion matrix mtx2 in step S37, and the first rotation matrix is combined with the first rotation matrix. The posture may be rotated. Even in this case, the posture of the input device 8 can be corrected by the conversion including the first conversion and the second conversion, and the same effect as in the above embodiment can be obtained.

また、上記第2の処理例は、上記第1および第2の変換からなる変換によって、入力装置8の姿勢を表す所定軸(Z軸)に関して補正前後の向きの変化が最も小さくなるように、第1の姿勢を補正するものであった。ここで、他の実施形態においては、CPU10は、入力装置8の姿勢を表す所定軸に関して補正前後の向きの変化が最も小さくなるようにすればよく、例えば次の処理によって第1の姿勢を補正するようにしてもよい。すなわち、CPU10は、まず、加速度ベクトルを最短距離で回転させて重力方向ベクトルと一致させる回転行列を用いて第1の姿勢を回転させ(図17)、次に、補正前後で所定軸の向きの変化が最小となるように、鉛直下方向回りに第1の姿勢を回転させるようにしてもよい。これによっても、上記実施形態と同様の効果を得ることができる。   Further, in the second processing example, by the conversion composed of the first and second conversions, the change in the orientation before and after correction is minimized with respect to the predetermined axis (Z axis) representing the attitude of the input device 8. The first posture was corrected. Here, in another embodiment, the CPU 10 only needs to minimize the change in orientation before and after correction with respect to a predetermined axis representing the attitude of the input device 8. For example, the CPU 10 corrects the first attitude by the following process. You may make it do. That is, the CPU 10 first rotates the first posture by using the rotation matrix that rotates the acceleration vector by the shortest distance and matches the gravity direction vector (FIG. 17), and then the orientation of the predetermined axis before and after the correction. The first posture may be rotated about the vertically downward direction so that the change is minimized. Also by this, the same effect as the above embodiment can be obtained.

また、上記第2の処理例においては、上記第1の処理例で用いた補正度Aを用いず、加速度ベクトルVaと重力ベクトルGとを一致させるように補正を行った。ここで、他の実施形態においては、第2の処理例においても補正度Aを用いるようにしてもよい。具体的には、ステップS33において、CPU10は、投影加速度ベクトルVapの終点から投影重力ベクトルGpの終点までを結ぶ線分をA:(1−A)に内分する点を終点とするベクトルを算出し、投影加速度ベクトルVapを当該ベクトルと一致させるようにZ軸回りの回転を行う回転行列を上記第1変換行列として算出すればよい。また、ステップS36においては、修正後の加速度ベクトルVa’の終点から重力ベクトルGの終点までを結ぶ線分をA:(1−A)に内分する点を終点とするベクトルを算出し、加速度ベクトルVa’を当該ベクトルと一致させるように回転を行う回転行列を上記第2変換行列として算出すればよい。なお、第2の処理例において補正度Aを用いる場合、第1の変換による補正と第2の変換による補正とで補正度Aとして同じ値を用いてもよいし、異なる値を用いてもよい。   Further, in the second processing example, correction is performed so that the acceleration vector Va and the gravity vector G coincide with each other without using the correction degree A used in the first processing example. Here, in another embodiment, the correction degree A may be used also in the second processing example. Specifically, in step S33, the CPU 10 calculates a vector whose end point is a point that internally divides the line segment connecting the end point of the projected acceleration vector Vap to the end point of the projected gravity vector Gp into A: (1-A). Then, a rotation matrix that rotates around the Z axis so as to make the projected acceleration vector Vap coincide with the vector may be calculated as the first conversion matrix. In step S36, a vector whose end point is a point dividing the line segment connecting the end point of the corrected acceleration vector Va ′ to the end point of the gravity vector G into A: (1-A) is calculated, and the acceleration What is necessary is just to calculate the rotation matrix which rotates so that vector Va 'may correspond with the said vector as said 2nd conversion matrix. When the correction degree A is used in the second processing example, the same value may be used as the correction degree A for the correction by the first conversion and the correction by the second conversion, or different values may be used. .

また、上記第2の処理例においては、XY平面と加速度ベクトルVaとが垂直になる場合、または、XY平面と重力方向ベクトルGとが垂直になる場合、正しく補正が行われない可能性がある。投影加速度ベクトルVapまたは投影重力ベクトルGpが0になってしまうからである。したがって、上記の場合には、CPU10は、第2の処理例による補正を実行せずに、第1の補正処理を終了してもよい(つまり、第1の補正処理は実行されない)。あるいは、上記の場合には、CPU10は、上記第1の処理例による補正を実行するようにしてもよい。   In the second processing example, if the XY plane and the acceleration vector Va are perpendicular to each other, or if the XY plane and the gravity direction vector G are perpendicular to each other, the correction may not be performed correctly. . This is because the projected acceleration vector Vap or the projected gravity vector Gp becomes zero. Therefore, in the above case, the CPU 10 may end the first correction process without executing the correction according to the second process example (that is, the first correction process is not executed). Alternatively, in the above case, the CPU 10 may execute correction according to the first processing example.

図14の説明に戻り、ステップS5の次のステップS6において、CPU10は、前述した第2補正処理を実行する。第2補正処理は、マーカ座標データを用いて第1の姿勢を補正する処理である。以下、図22を参照して、第2補正処理の詳細を説明する。   Returning to the description of FIG. 14, in step S <b> 6 subsequent to step S <b> 5, the CPU 10 executes the second correction process described above. The second correction process is a process of correcting the first posture using the marker coordinate data. Hereinafter, the details of the second correction process will be described with reference to FIG.

図22は、図14に示す第2補正処理(ステップS6)の流れを示すフローチャートである。第1補正処理においては、まずステップS41において、CPU10は、入力装置8の撮像手段(撮像素子40)によってマーカ部6が撮像されているか否かを判定する。ステップS41の判定は、メインメモリに記憶されているマーカ座標データ65を参照することによって行うことができる。ここでは、マーカ座標データ65が2つのマーカ座標を示す場合、マーカ部6が撮像されていると判定し、マーカ座標データ65が1つのマーカ座標のみを示す場合、または、マーカ座標がないことを示す場合、マーカ部6が撮像されていないと判定する。ステップS41の判定結果が肯定である場合、以降のステップS42〜S47の処理が実行される。一方、ステップS41の判定結果が否定である場合、以降のステップS42〜S47の処理がスキップされ、CPU10は、第2補正処理を終了する。このように、撮像素子40によってマーカ部6が撮像されていない場合には、撮像素子40から得られるデータを用いて入力装置8の姿勢を算出することができないので、この場合には第2補正処理において補正は行われない。   FIG. 22 is a flowchart showing the flow of the second correction process (step S6) shown in FIG. In the first correction process, first, in step S <b> 41, the CPU 10 determines whether or not the marker unit 6 is imaged by the imaging unit (imaging device 40) of the input device 8. The determination in step S41 can be made by referring to the marker coordinate data 65 stored in the main memory. Here, when the marker coordinate data 65 indicates two marker coordinates, it is determined that the marker unit 6 is captured, and when the marker coordinate data 65 indicates only one marker coordinate, or there is no marker coordinate. When it shows, it determines with the marker part 6 not being imaged. If the determination result of step S41 is affirmative, the processes of subsequent steps S42 to S47 are executed. On the other hand, when the determination result of step S41 is negative, the processes of the subsequent steps S42 to S47 are skipped, and the CPU 10 ends the second correction process. As described above, when the marker unit 6 is not imaged by the image sensor 40, the attitude of the input device 8 cannot be calculated using data obtained from the image sensor 40. In this case, the second correction is performed. No correction is performed in the process.

ステップS42において、CPU10は、マーカ座標データに基づいてロール姿勢成分M3rを算出する。ロール姿勢成分M3rは、撮像画像内でのマーカ部6の向きに基づいて、すなわち、マーカ座標データ65により示される2つのマーカ座標を結ぶ線の傾きに基づいて算出される。以下、図23を参照して、ロール姿勢成分M3rの算出方法の例を説明する。   In step S42, the CPU 10 calculates a roll posture component M3r based on the marker coordinate data. The roll posture component M3r is calculated based on the orientation of the marker unit 6 in the captured image, that is, based on the slope of the line connecting the two marker coordinates indicated by the marker coordinate data 65. Hereinafter, an example of a method for calculating the roll posture component M3r will be described with reference to FIG.

図23は、撮像画像に対応する2次元座標を示す図である。図23に示されるように、本実施形態においては、撮像画像における位置を表すための2次元座標系(x’y’座標系)は、撮像画像の範囲を−1≦x’≦1、−1≦y’≦1で表すものとする。x’y’座標系は、入力装置8が基準姿勢(入力装置8の撮像方向がマーカ部6の中央を向き、かつ、コントローラ5のボタン面が鉛直上向きとなる姿勢)にある場合に、撮像画像において鉛直下向きがy’軸正方向となり、右向きがx’軸正方向となるように設定されるものとする。また、図23に示す点P1および点P2はマーカ座標の位置を示し、点P3は点P1と点P2との中点である。図23に示すベクトルv10は、点P1を始点とし、点P2を終点とするベクトルである。   FIG. 23 is a diagram illustrating two-dimensional coordinates corresponding to a captured image. As shown in FIG. 23, in this embodiment, a two-dimensional coordinate system (x′y ′ coordinate system) for representing a position in a captured image has a range of the captured image of −1 ≦ x ′ ≦ 1, − 1 ≦ y ′ ≦ 1. The x′y ′ coordinate system captures images when the input device 8 is in a reference posture (an orientation in which the imaging direction of the input device 8 faces the center of the marker unit 6 and the button surface of the controller 5 is vertically upward). In the image, it is assumed that the vertically downward direction is the positive direction of the y ′ axis and the right direction is the positive direction of the x ′ axis. Further, point P1 and point P2 shown in FIG. 23 indicate the positions of the marker coordinates, and point P3 is a midpoint between point P1 and point P2. A vector v10 shown in FIG. 23 is a vector having a point P1 as a start point and a point P2 as an end point.

ロール姿勢成分M3rを算出するために、CPU10はまず、マーカ座標データ65を読み出し、当該マーカ座標データ65により示される2つのマーカ座標から上記ベクトルv10を算出する。さらに、ベクトルv10を正規化したベクトル(hx,hy)を算出する。このベクトル(hx,hy)は、入力装置8が上記基準姿勢にある場合にx軸正方向を向き、入力装置8のロール方向の回転に応じて向きが変化する。ベクトル(hx,hy)がロール方向の姿勢に対応しているので、ロール姿勢成分M3rは、このベクトル(hx,hy)に基づいて算出することができる。具体的には、CPU10は、次の式(11)に従ってロール姿勢成分M3rを算出する。

Figure 0005872136
上式(11)によって算出された行列を示すデータは、ロール姿勢成分データ73としてメインメモリに記憶される。ステップS42の次にステップS43の処理が実行される。 In order to calculate the roll posture component M3r, the CPU 10 first reads the marker coordinate data 65, and calculates the vector v10 from the two marker coordinates indicated by the marker coordinate data 65. Further, a vector (hx, hy) obtained by normalizing the vector v10 is calculated. The vector (hx, hy) is directed in the positive x-axis direction when the input device 8 is in the reference posture, and the direction changes according to the rotation of the input device 8 in the roll direction. Since the vector (hx, hy) corresponds to the posture in the roll direction, the roll posture component M3r can be calculated based on the vector (hx, hy). Specifically, the CPU 10 calculates the roll posture component M3r according to the following equation (11).
Figure 0005872136
Data indicating the matrix calculated by the above equation (11) is stored in the main memory as roll posture component data 73. Following step S42, the process of step S43 is executed.

ステップS43において、CPU10は、マーカ座標データに基づいてヨー姿勢成分M3yを算出する。ヨー姿勢成分M3yは、撮像画像内でのマーカ部6の向きおよび位置に基づいて算出される。以下、図23を参照して、ヨー姿勢成分M3yの算出方法の例を説明する。   In step S43, the CPU 10 calculates a yaw posture component M3y based on the marker coordinate data. The yaw posture component M3y is calculated based on the orientation and position of the marker unit 6 in the captured image. Hereinafter, an example of a method for calculating the yaw posture component M3y will be described with reference to FIG.

まず、CPU10は、マーカ座標データ65を読み出し、当該マーカ座標データ65により示される2つのマーカ座標の中点を算出する。本実施形態では、マーカ部6の位置として当該中点の位置を用いる。さらに、CPU10は、算出された中点の座標を、x’y’座標系の原点を中心として、入力装置8のロール方向に関する回転角度だけ(入力装置8の回転方向とは逆方向に)回転させた座標(px,py)を算出する。換言すれば、中点の座標は、原点を中心として、上記ベクトル(hx,hy)がx軸正方向を向くように回転される。入力装置8が水平方向(x軸方向)に関してマーカ部6と同じ位置(すなわち、マーカ部6の正面の位置)にあるとすれば、上記のようにして得られた回転後の座標(px,py)から、ヨー方向に関する姿勢を算出することができる。   First, the CPU 10 reads the marker coordinate data 65 and calculates the midpoint between the two marker coordinates indicated by the marker coordinate data 65. In the present embodiment, the position of the middle point is used as the position of the marker unit 6. Further, the CPU 10 rotates the calculated midpoint coordinates by the rotation angle related to the roll direction of the input device 8 (in the direction opposite to the rotation direction of the input device 8) around the origin of the x′y ′ coordinate system. Calculated coordinates (px, py) are calculated. In other words, the coordinates of the midpoint are rotated around the origin so that the vector (hx, hy) faces the positive x-axis direction. If the input device 8 is at the same position as the marker unit 6 in the horizontal direction (x-axis direction) (that is, the front position of the marker unit 6), the coordinates (px, py) can be used to calculate the attitude related to the yaw direction.

次に、CPU10は、上記中点の回転後の座標(px,py)と、マーカ部6がx’軸方向の端に位置する場合のヨー方向の角度(限界角度)θy’とに基づいて、ヨー方向に関する回転角度θyを算出する。ここで、上記限界角度θy’と、上記限界角度θy1となる場合における上記中点の回転後のx座標値px’とは予め求めておくことができる。したがって、pxとpx’との比が、θyとθy’との比に等しくなることを用いて、ヨー方向に関する回転角度θyを算出することができる。具体的には、ヨー方向に関する回転角度θyは、次の式(12)によって算出することができる。
θy=px×θy’/px’ …(12)
なお、マーカ部6の水平方向の長さを無視する場合、上記限界角度θy’は、コントローラ5の画角の1/2とし、上記px’の値は“1”とすることができる。
Next, the CPU 10 based on the coordinates (px, py) after the rotation of the midpoint and the angle (limit angle) θy ′ in the yaw direction when the marker unit 6 is located at the end in the x′-axis direction. Then, the rotation angle θy related to the yaw direction is calculated. Here, the limit angle θy ′ and the x-coordinate value px ′ after the rotation of the midpoint when the limit angle θy1 is reached can be obtained in advance. Therefore, the rotation angle θy related to the yaw direction can be calculated using the fact that the ratio between px and px ′ is equal to the ratio between θy and θy ′. Specifically, the rotation angle θy related to the yaw direction can be calculated by the following equation (12).
θy = px × θy ′ / px ′ (12)
When the horizontal length of the marker unit 6 is ignored, the limit angle θy ′ can be set to ½ of the angle of view of the controller 5 and the value of px ′ can be set to “1”.

最後に、CPU10は、上式(12)により算出された角度θyの回転を行う回転行列をヨー姿勢成分M3yとして算出する。具体的には、ヨー姿勢成分M3yは次の式(13)によって算出される。

Figure 0005872136
上式(13)によって算出された行列を示すデータが、ヨー姿勢成分データ74としてメインメモリに記憶される。以上のステップS43の次にステップS44の処理が実行される。 Finally, the CPU 10 calculates a rotation matrix that rotates the angle θy calculated by the above equation (12) as the yaw attitude component M3y. Specifically, the yaw posture component M3y is calculated by the following equation (13).
Figure 0005872136
Data indicating the matrix calculated by the above equation (13) is stored in the main memory as yaw attitude component data 74. Following step S43, the process of step S44 is executed.

ステップS44において、CPU10は、ロール姿勢成分M3rとヨー姿勢成分M3yとを合成する。すなわち、メインメモリからロール姿勢成分データ73およびヨー姿勢成分データ74を読み出し、各データ73および74により示されるロール姿勢成分M3rとヨー姿勢成分M3yとを積算する。ステップS44の次にステップS45の処理が実行される。   In step S44, the CPU 10 combines the roll posture component M3r and the yaw posture component M3y. That is, the roll attitude component data 73 and the yaw attitude component data 74 are read from the main memory, and the roll attitude component M3r and the yaw attitude component M3y indicated by the data 73 and 74 are integrated. Following step S44, the process of step S45 is executed.

ステップS45において、CPU10は、第1の姿勢に基づいてピッチ姿勢成分M3pを算出する。なお、本実施形態の処理とは異なるが、ピッチ姿勢成分M3pについても、ヨー姿勢成分M3yと同様の方法で、上記座標(px,py)のy座標値に基づいて算出することが可能である。ただし、上記座標(px,py)を用いてヨー方向(ピッチ方向)の姿勢を算出する方法は、入力装置8が水平方向(ピッチ方向の場合は鉛直方向)に関してマーカ部6と同じ位置にあることを前提として成り立つ方法である。本実施形態のゲームシステム1においては、プレイヤは、水平方向に関してマーカ部6(テレビ2)のほぼ正面の位置で入力装置8を操作すると考えられるので、「入力装置8が水平方向に関してマーカ部6と同じ位置にある」ことを前提して、上記ステップS43の方法によってヨー方向の姿勢を算出することが可能である。一方、プレイヤは、立って入力装置8を操作することも座って入力装置8を操作することも考えられ、また、マーカ部6の位置もテレビ2の画面の上側に配置されることも下側に配置されることも考えられる。そのため、本実施形態のゲームシステム1においては、「入力装置8が鉛直方向に関してマーカ部6と同じ位置にある」ことを必ずしも前提にできないため、上記座標(px,py)を用いてピッチ方向の姿勢を算出することを行わないようにしてもよい。   In step S45, the CPU 10 calculates a pitch posture component M3p based on the first posture. Although different from the processing of the present embodiment, the pitch attitude component M3p can also be calculated based on the y coordinate value of the coordinates (px, py) in the same manner as the yaw attitude component M3y. . However, in the method of calculating the attitude in the yaw direction (pitch direction) using the coordinates (px, py), the input device 8 is at the same position as the marker unit 6 in the horizontal direction (vertical direction in the case of the pitch direction). This method is based on the assumption. In the game system 1 of the present embodiment, it is considered that the player operates the input device 8 at a position substantially in front of the marker unit 6 (TV 2) in the horizontal direction. It is possible to calculate the attitude in the yaw direction by the method of step S43 on the assumption that “they are at the same position”. On the other hand, it is conceivable that the player stands and operates the input device 8 or sits down and operates the input device 8, and the position of the marker unit 6 is also arranged on the upper side of the screen of the television 2. It is also possible to arrange them in For this reason, in the game system 1 of the present embodiment, it is not necessarily assumed that “the input device 8 is in the same position as the marker unit 6 in the vertical direction”. The posture may not be calculated.

そこで、本実施形態においては、ピッチ姿勢成分M3pについては、第1の姿勢をそのまま用いることとする(したがって、第2補正処理においては、ピッチ方向に関しては補正が行われない)。具体的には、CPU10は、メインメモリから第1姿勢データ68を読み出す。そして、第1姿勢データ68により示される第1姿勢行列M1の各要素を用いて、ピッチ方向に関する回転角度θpを、次の式(14)に従って算出する。
cos(θp)=(Zx×Zx+Zz×Zz)1/2
sin(θp)=Zy …(14)
上式(14)における変数Zx,Zy,Zzは、上式(1)において示した第1姿勢行列M1の要素である。なお、ここで用いられる第1姿勢行列M1は、今回の処理ループにおいて第1補正処理が行われた後の第1姿勢行列M1である。さらに、CPU10は、上式(14)で算出したcos(θp)およびsin(θp)を用いて、次の式(15)に従ってピッチ姿勢成分M3pの行列を算出する。

Figure 0005872136
上式(15)によって算出された行列を示すデータが、ピッチ姿勢成分データ75としてメインメモリに記憶される。以上のステップS45の次にステップS46の処理が実行される。 Therefore, in the present embodiment, the first posture is used as it is for the pitch posture component M3p (thus, in the second correction process, the pitch direction is not corrected). Specifically, the CPU 10 reads the first attitude data 68 from the main memory. Then, using each element of the first posture matrix M1 indicated by the first posture data 68, the rotation angle θp with respect to the pitch direction is calculated according to the following equation (14).
cos (θp) = (Zx × Zx + Zz × Zz) 1/2
sin (θp) = Zy (14)
Variables Zx, Zy, and Zz in the above equation (14) are elements of the first posture matrix M1 shown in the above equation (1). The first posture matrix M1 used here is the first posture matrix M1 after the first correction processing is performed in the current processing loop. Further, the CPU 10 calculates a matrix of the pitch posture component M3p according to the following equation (15) using cos (θp) and sin (θp) calculated by the above equation (14).
Figure 0005872136
Data indicating the matrix calculated by the above equation (15) is stored in the main memory as pitch attitude component data 75. Following step S45, the process of step S46 is executed.

ステップS46において、CPU10は、ロール方向、ヨー方向、およびピッチ方向の各姿勢成分に基づいて第3の姿勢を算出する。第3の姿勢は、ロール姿勢成分M3rとヨー姿勢成分M3yとの合成結果に、ピッチ姿勢成分M3pをさらに合成することによって得られる。具体的には、CPU10は、メインメモリからピッチ姿勢成分データ75を読み出し、当該ピッチ姿勢成分データ75により示されるピッチ姿勢成分M3pを、ステップS44で算出された行列に積算する。算出された行列を示すデータは、第3姿勢データ76としてメインメモリに記憶される。ステップS46の次にステップS47の処理が実行される。   In step S46, the CPU 10 calculates a third posture based on the posture components in the roll direction, the yaw direction, and the pitch direction. The third attitude is obtained by further synthesizing the pitch attitude component M3p with the synthesis result of the roll attitude component M3r and the yaw attitude component M3y. Specifically, the CPU 10 reads the pitch attitude component data 75 from the main memory, and integrates the pitch attitude component M3p indicated by the pitch attitude component data 75 in the matrix calculated in step S44. Data indicating the calculated matrix is stored in the main memory as third attitude data 76. Following step S46, the process of step S47 is executed.

ステップS47において、CPU10は、第3の姿勢を用いて第1の姿勢を補正する。ステップS47における補正は、第1姿勢行列M1を第3姿勢行列M3に所定の割合(下記の定数C2)で近づけることによって行われる。CPU10は、メインメモリから第1姿勢データ68および第3姿勢データ76を読み出す。そして、第1姿勢データ68により示される第1姿勢行列M1と、第3姿勢データ76により示される第3姿勢行列M3とを用いて、次の式(16)に従って補正を行う。
M1=(M3−M1’)×C2+M1’ …(16)
上式(16)において、変数M1’は補正前の第1姿勢行列である。また、定数C2は、0<C2≦1の範囲で予め設定され、例えば0.1に設定される。上式(16)によって算出された補正後の第1姿勢行列M1を示すデータが、新たな第1姿勢データ68としてメインメモリに記憶される。上記ステップS47の後、CPU10は第2補正処理を終了する。
In step S47, the CPU 10 corrects the first posture using the third posture. The correction in step S47 is performed by bringing the first posture matrix M1 closer to the third posture matrix M3 at a predetermined ratio (constant C2 below). The CPU 10 reads the first attitude data 68 and the third attitude data 76 from the main memory. Then, using the first attitude matrix M1 indicated by the first attitude data 68 and the third attitude matrix M3 indicated by the third attitude data 76, correction is performed according to the following equation (16).
M1 = (M3-M1 ′) × C2 + M1 ′ (16)
In the above equation (16), the variable M1 ′ is the first posture matrix before correction. The constant C2 is preset in the range of 0 <C2 ≦ 1, and is set to 0.1, for example. Data indicating the corrected first posture matrix M1 calculated by the above equation (16) is stored in the main memory as new first posture data 68. After step S47, the CPU 10 ends the second correction process.

以上のように、第2補正処理においては、撮像画像(マーカ座標)から第3の姿勢を算出し、第1の姿勢を第3の姿勢に近づけるように補正することとした。この補正によって、より正確な値となるように第1の姿勢を補正することができる。なお、本実施形態においては、ロール方向およびヨー方向の姿勢についてのみ撮像画像から第3の姿勢を算出したが、上述のように、ピッチ方向についても撮像画像から第3の姿勢を算出することは可能であり、他の実施形態においては、ロール方向、ヨー方向、およびピッチ方向について撮像画像から第3の姿勢を算出してもよい。また、第2補正処理においては、ロール方向、ヨー方向、およびピッチ方向のうち少なくとも1方向について第3の姿勢を算出すればよい。特に、第1補正処理(ステップS7)において第2の処理例を採用する場合には、第2補正処理においては、ロール方向のみについて第3の姿勢を算出し、ロール方向にのみ第1の姿勢を補正(回転)するようにしてもよい。つまり、ヨー方向およびピッチ方向について補正を行うと、Z軸の向きが変化し、補正前後でのZ軸の向きの変化が大きくなってしまう可能性があるので、Z軸の向きをあまり変化させない目的で第2の処理例を採用する場合には、ロールに関する補正のみ行えばよい。   As described above, in the second correction process, the third posture is calculated from the captured image (marker coordinates), and the first posture is corrected so as to approach the third posture. By this correction, the first posture can be corrected so as to have a more accurate value. In the present embodiment, the third posture is calculated from the captured image only for the posture in the roll direction and the yaw direction. However, as described above, the third posture is calculated from the captured image also in the pitch direction. In other embodiments, the third orientation may be calculated from the captured image in the roll direction, the yaw direction, and the pitch direction. In the second correction process, the third posture may be calculated in at least one of the roll direction, the yaw direction, and the pitch direction. In particular, when the second processing example is adopted in the first correction process (step S7), the second correction process calculates the third posture only in the roll direction, and the first posture only in the roll direction. May be corrected (rotated). In other words, if the correction is made in the yaw direction and the pitch direction, the direction of the Z axis changes, and the change in the direction of the Z axis before and after the correction may become large, so the direction of the Z axis does not change much. When the second processing example is adopted for the purpose, only the correction relating to the roll may be performed.

図14の説明に戻り、ステップS6の次のステップS7において、CPU10は、補正後の第1の姿勢を用いたゲーム処理を実行する。このゲーム処理は、補正後の第1の姿勢を表す第1姿勢行列M1を入力値としてゲーム結果に反映させる処理であればどのような処理であってもよい。例えば、仮想のゲーム空間内のオブジェクトを、第1姿勢行列M1により示される姿勢となるように制御して表示する処理であってもよいし、第1姿勢行列M1により示される姿勢と所定の姿勢との角度に応じた速度で上記オブジェクトを移動させるように制御して表示する処理であってもよい。ステップS7の次にステップS8の処理が実行される。   Returning to the description of FIG. 14, in step S <b> 7 following step S <b> 6, the CPU 10 executes a game process using the corrected first posture. This game process may be any process as long as the process reflects the first attitude matrix M1 representing the corrected first attitude as an input value in the game result. For example, it may be a process of controlling and displaying an object in the virtual game space so as to have the posture indicated by the first posture matrix M1, or the posture indicated by the first posture matrix M1 and a predetermined posture. It may be a process of controlling and displaying the object so as to move at a speed according to the angle. Following step S7, the process of step S8 is executed.

ステップS8において、CPU10は、ゲームを終了するか否かを判定する。ステップS8の判定は、例えば、ゲームがクリアされたか否か、ゲームオーバーとなったか否か、プレイヤがゲームを中止する指示を行ったか否か等によって行われる。ステップS8の判定結果が否定である場合、ステップS3の処理が再度実行される。以降、ステップS8でゲームを終了すると判定されるまで、ステップS3〜S8の処理ループが繰り返し実行される。一方、ステップS8の判定結果が肯定である場合、CPU10は、図14に示すゲーム処理を終了する。以上で、ゲーム処理の説明を終了する。   In step S8, the CPU 10 determines whether or not to end the game. The determination in step S8 is made based on, for example, whether or not the game has been cleared, whether or not the game is over, and whether or not the player has given an instruction to stop the game. If the determination result of step S8 is negative, the process of step S3 is executed again. Thereafter, the processing loop of steps S3 to S8 is repeatedly executed until it is determined in step S8 that the game is to be ended. On the other hand, if the determination result of step S8 is affirmative, the CPU 10 ends the game process shown in FIG. This is the end of the description of the game process.

以上のように、本実施形態においては、ジャイロセンサ55および56によって検出された角速度から入力装置8の第1の姿勢を算出し(ステップS4)、第1の姿勢を第1補正処理(S5)および第2補正処理(S6)によって補正した。そして、補正後の第1の姿勢を用いてゲーム処理を実行する(ステップS7)ので、CPU10は、入力装置8の正確な姿勢に基づいたゲーム処理を実行することができる。これによれば、例えば、入力装置8の姿勢をゲーム空間内のオブジェクトの姿勢に対して正確に反映させることができるので、ゲーム操作の操作性を向上することができる。   As described above, in the present embodiment, the first posture of the input device 8 is calculated from the angular velocities detected by the gyro sensors 55 and 56 (step S4), and the first posture is subjected to the first correction process (S5). And it corrected by the 2nd correction process (S6). Since the game process is executed using the corrected first attitude (step S7), the CPU 10 can execute the game process based on the accurate attitude of the input device 8. According to this, for example, the posture of the input device 8 can be accurately reflected on the posture of the object in the game space, so that the operability of the game operation can be improved.

[変形例]
なお、上記実施形態においては、3軸回りの角速度を検出するジャイロセンサを用いて、3次元の姿勢を算出する場合を例として説明したが、図8〜図12にも示したように、2次元平面上における姿勢(回転角度)を算出する場合においても本発明を適用することが可能である。なお、2次元平面上における姿勢は、2軸回りの角速度を2軸ジャイロセンサで検出することによって算出してもよいし、所定の1軸回りの角速度を1軸ジャイロセンサで検出することによって算出してもよい。
[Modification]
In the above embodiment, the case where a three-dimensional posture is calculated using a gyro sensor that detects angular velocities around three axes has been described as an example. However, as illustrated in FIGS. The present invention can also be applied when calculating a posture (rotation angle) on a two-dimensional plane. The posture on the two-dimensional plane may be calculated by detecting an angular velocity about two axes with a two-axis gyro sensor, or calculated by detecting an angular velocity about a predetermined axis with a one-axis gyro sensor. May be.

また、他の実施形態においては、第2補正処理は、入力装置8がマーカ部6を撮像していると推測される場合にのみ、実行されるようにしてもよい。具体的には、CPU10は、第2補正処理を実行する前に、入力装置8(撮像手段)がマーカ部6を撮像可能な向きを向いているか否かを判定する。この判定は、第1の姿勢あるいは第2の姿勢を用いて行うことができる。例えば、第1の姿勢(または第2の姿勢)が、入力装置8の撮像方向が入力装置8からマーカ部6への向きに対して同じ向きかそれとも逆向きかを判定するようにしてもよい。また、上記の判定に用いられる第1の姿勢は、前回の処理ループにおいて第1および第2補正処理が行われた第1の姿勢であってもよいし、今回の処理ループにおいて算出されて第1補正処理が行われた第1の姿勢であってもよい。   In another embodiment, the second correction process may be executed only when it is estimated that the input device 8 is imaging the marker unit 6. Specifically, before executing the second correction process, the CPU 10 determines whether or not the input device 8 (imaging unit) faces a direction in which the marker unit 6 can be imaged. This determination can be performed using the first posture or the second posture. For example, the first posture (or the second posture) may be determined as to whether the imaging direction of the input device 8 is the same or opposite to the direction from the input device 8 to the marker unit 6. In addition, the first posture used for the above determination may be the first posture in which the first and second correction processes are performed in the previous processing loop, or may be calculated in the current processing loop. The first posture in which one correction process is performed may be used.

上記の判定の結果、CPU10は、入力装置8がマーカ部6を撮像可能な向きを向いていると判定される場合、第2補正処理を実行し、マーカ部6を撮像可能な向きを向いていないと判定される場合、第2補正処理をスキップする。なお、マーカ部6でない物(例えば、部屋の電灯や窓の外の太陽光等)がマーカ部6と誤検出されることがあり、誤検出によって得られたマーカ座標を用いて第3の姿勢が算出される場合、かかる第3の姿勢を用いて第2補正処理を行っても正確に補正を行うことができない。これに対して、上記の判定処理を行うことにより、誤検出によって得られたマーカ座標から算出される第3の姿勢を用いて第2補正処理が行われることを防止することができる。これによって、第2補正処理をより正確に行うことができる。   As a result of the above determination, when it is determined that the input device 8 faces the direction in which the marker unit 6 can be imaged, the CPU 10 performs the second correction process and faces the direction in which the marker unit 6 can be imaged. If it is determined that there is not, the second correction process is skipped. Note that an object that is not the marker unit 6 (for example, an electric lamp in a room or sunlight outside a window) may be erroneously detected as the marker unit 6, and the third posture is obtained using the marker coordinates obtained by the erroneous detection. When is calculated, correct correction cannot be performed even if the second correction process is performed using the third posture. On the other hand, by performing the above determination process, it is possible to prevent the second correction process from being performed using the third posture calculated from the marker coordinates obtained by the erroneous detection. As a result, the second correction process can be performed more accurately.

以上のように、本発明は、ジャイロセンサを用いて入力装置の姿勢を正確に算出すること等を目的として、例えば入力装置の姿勢に応じたゲーム処理を行うゲーム装置またはゲームプログラム等として利用することが可能である。   As described above, the present invention is used, for example, as a game device or a game program for performing game processing according to the posture of the input device, for example, for accurately calculating the posture of the input device using a gyro sensor. It is possible.

1 ゲームシステム
2 テレビ
3 ゲーム装置
4 光ディスク
5 コントローラ
6 マーカ部
7 ジャイロセンサユニット
8 入力装置
10 CPU
11c GPU
11e 内部メインメモリ
12 外部メインメモリ
63 角速度データ
64 加速度データ
65 マーカ座標データ
68 第1姿勢データ
76 第3姿勢データ
DESCRIPTION OF SYMBOLS 1 Game system 2 Television 3 Game device 4 Optical disk 5 Controller 6 Marker part 7 Gyro sensor unit 8 Input device 10 CPU
11c GPU
11e Internal main memory 12 External main memory 63 Angular velocity data 64 Acceleration data 65 Marker coordinate data 68 First attitude data 76 Third attitude data

Claims (18)

角速度センサと、加速度センサとを少なくとも備えた入力装置からデータを取得し、3次元の空間における当該入力装置の姿勢を算出する姿勢算出装置であって、
前記角速度センサが検出する角速度を取得し、前回の姿勢を当該取得された角速度に応じて回転させることによって新たな姿勢を算出する姿勢算出手段と、
前記加速度センサからの加速度データに基づいて前記入力装置の加速度を示す加速度ベクトルを算出する加速度ベクトル算出手段と、
前記空間における前記加速度ベクトルの方向と前記空間における鉛直下方向とを近づけるまたは一致させるように、加速度ベクトルの方向の変化に対応させて前記入力装置の姿勢を補正する第1補正手段とを備え、
前記第1補正手段は、前記入力装置の姿勢に関して、当該入力装置に対して設定され、当該入力装置の姿勢に対応する所定軸の補正前の向きと補正後の向きとの変化が最も小さくなるように、前記入力装置の姿勢を補正する、姿勢算出装置。
An attitude calculation apparatus that acquires data from an input device including at least an angular velocity sensor and an acceleration sensor, and calculates an attitude of the input device in a three-dimensional space,
Posture calculating means for acquiring an angular velocity detected by the angular velocity sensor and calculating a new posture by rotating the previous posture in accordance with the acquired angular velocity ;
Acceleration vector calculating means for calculating an acceleration vector indicating the acceleration of the input device based on acceleration data from the acceleration sensor;
First correction means for correcting the orientation of the input device in response to a change in the direction of the acceleration vector so that the direction of the acceleration vector in the space and the vertical downward direction in the space are brought close to or coincide with each other;
Wherein the first correction means, with respect to the posture of the input device, is set for the input device, the change in the uncorrected orientation as the corrected orientation of the predetermined axis you correspond to the attitude of the input device are most An attitude calculation device that corrects the attitude of the input device so as to be smaller.
前記第1補正手段は、前記所定軸に垂直な平面に前記加速度ベクトルを投影した方向と、当該平面に前記鉛直下方向を投影した方向とを近づけるように前記所定軸回りの回転を行う第1の変換と、前記第1の変換が行われた前記加速度ベクトルの方向と前記鉛直下方向とを近づける回転を行う第2の変換とからなる変換によって前記入力装置の姿勢を補正する、請求項1に記載の姿勢算出装置。   The first correction means performs a rotation around the predetermined axis so that a direction in which the acceleration vector is projected onto a plane perpendicular to the predetermined axis is close to a direction in which the vertical downward direction is projected onto the plane. 2. The attitude of the input device is corrected by a conversion comprising: a second conversion that performs a rotation that brings the direction of the acceleration vector subjected to the first conversion and the vertical downward direction closer to each other. The posture calculation device described in 1. 前記第1補正手段は、前記加速度ベクトルの方向と前記鉛直下方向とが一致するように前記入力装置の姿勢を補正する、請求項1または請求項2に記載の姿勢算出装置。   The posture calculation apparatus according to claim 1, wherein the first correction unit corrects the posture of the input device so that a direction of the acceleration vector coincides with a vertically downward direction. 前記第1補正手段は、前記加速度ベクトルの大きさが重力加速度の大きさに近いほど、前記加速度ベクトルの方向と前記空間における鉛直下方向とが近づくように、前記入力装置の姿勢の補正量を大きくする、請求項1または請求項2に記載の姿勢算出装置。 The first correction means adjusts the amount of correction of the attitude of the input device so that the direction of the acceleration vector and the vertical downward direction in the space are closer as the acceleration vector is closer to the gravitational acceleration. The posture calculation apparatus according to claim 1, wherein the posture calculation device is increased . 前記第1補正手段は、前記加速度ベクトルの大きさと重力加速度の大きさとの差が所定の基準より小さい場合にのみ前記入力装置の姿勢を補正する、請求項1から請求項4のいずれか1項に記載の姿勢算出装置。   The said 1st correction | amendment means correct | amends the attitude | position of the said input device, only when the difference between the magnitude | size of the said acceleration vector and the magnitude | size of gravitational acceleration is smaller than predetermined | prescribed reference | standard. The posture calculation device described in 1. 前記入力装置は、撮像手段をさらに備え、
前記撮像手段が撮像する所定の撮像対象の画像に基づいて、前記入力装置の姿勢をさらに補正する第2補正手段をさらに備える、請求項1から請求項5のいずれか1項に記載の姿勢算出装置。
The input device further includes an imaging unit,
6. The posture calculation according to claim 1, further comprising: a second correction unit that further corrects the posture of the input device based on an image of a predetermined imaging target captured by the imaging unit. apparatus.
前記第2補正手段は、前記入力装置の姿勢に前記所定軸回りの回転を加えることによって前記入力装置の姿勢を補正する、請求項6に記載の姿勢算出装置。   The posture calculation device according to claim 6, wherein the second correction unit corrects the posture of the input device by adding rotation about the predetermined axis to the posture of the input device. 請求項1から請求項7のいずれか1項に記載の姿勢算出装置によって補正された姿勢を前記入力装置の姿勢として用いてゲーム処理を行うゲーム装置。   A game device that performs game processing using the posture corrected by the posture calculation device according to claim 1 as the posture of the input device. 角速度センサと、加速度センサとを少なくとも備えた入力装置からデータを取得し、3次元の空間における当該入力装置の姿勢を算出する姿勢算出装置のコンピュータで実行される姿勢算出プログラムあって、
前記角速度センサが検出する角速度を取得し、前回の姿勢を当該取得された角速度に応じて回転させることによって新たな姿勢を算出する姿勢算出手段と、
前記加速度センサからの加速度データに基づいて前記入力装置の加速度を示す加速度ベクトルを算出する加速度ベクトル算出手段と、
前記空間における前記加速度ベクトルの方向と前記空間における鉛直下方向とを近づけるまたは一致させるように、加速度ベクトルの方向の変化に対応させて前記入力装置の姿勢を補正する第1補正手段として前記コンピュータを機能させ、
前記第1補正手段は、前記入力装置の姿勢に関して、当該入力装置に対して設定され、当該入力装置の姿勢に対応する所定軸の補正前の向きと補正後の向きとの変化が最も小さくなるように、前記入力装置の姿勢を補正する、姿勢算出プログラム。
An attitude calculation program executed by a computer of an attitude calculation device that acquires data from an input device including at least an angular velocity sensor and an acceleration sensor and calculates an attitude of the input device in a three-dimensional space,
Posture calculating means for acquiring an angular velocity detected by the angular velocity sensor and calculating a new posture by rotating the previous posture in accordance with the acquired angular velocity ;
Acceleration vector calculating means for calculating an acceleration vector indicating the acceleration of the input device based on acceleration data from the acceleration sensor;
The computer is used as first correction means for correcting the orientation of the input device in accordance with a change in the direction of the acceleration vector so that the direction of the acceleration vector in the space and the vertical downward direction in the space are brought close to or coincide with each other. Make it work
Wherein the first correction means, with respect to the posture of the input device, is set for the input device, the change in the uncorrected orientation as the corrected orientation of the predetermined axis you correspond to the attitude of the input device are most A posture calculation program for correcting the posture of the input device so as to be small.
前記第1補正手段は、前記所定軸に垂直な平面に前記加速度ベクトルを投影した方向と、当該平面に前記鉛直下方向を投影した方向とを近づけるように前記所定軸回りの回転を行う第1の変換と、前記第1の変換が行われた前記加速度ベクトルの方向と前記鉛直下方向とを近づける回転を行う第2の変換とからなる変換によって前記入力装置の姿勢を補正する、請求項9に記載の姿勢算出プログラム。   The first correction means performs a rotation around the predetermined axis so that a direction in which the acceleration vector is projected onto a plane perpendicular to the predetermined axis is close to a direction in which the vertical downward direction is projected onto the plane. The posture of the input device is corrected by a conversion comprising: a second conversion that performs a rotation to bring the direction of the acceleration vector subjected to the first conversion and the vertical downward direction closer to each other. The attitude calculation program described in 1. 前記第1補正手段は、前記加速度ベクトルの方向と前記鉛直下方向とが一致するように前記入力装置の姿勢を補正する、請求項9または請求項10に記載の姿勢算出プログラム。   The attitude calculation program according to claim 9 or 10, wherein the first correction unit corrects the attitude of the input device so that a direction of the acceleration vector coincides with a vertically downward direction. 前記第1補正手段は、前記加速度ベクトルの大きさが重力加速度の大きさに近いほど、前記加速度ベクトルの方向と前記空間における鉛直下方向とが近づくように、前記入力装置の姿勢の補正量を大きくする、請求項9または請求項10に記載の姿勢算出プログラム。 The first correction means adjusts the amount of correction of the attitude of the input device so that the direction of the acceleration vector and the vertical downward direction in the space are closer as the acceleration vector is closer to the gravitational acceleration. The posture calculation program according to claim 9 or 10, wherein the posture calculation program is increased . 前記第1補正手段は、前記加速度ベクトルの大きさと重力加速度の大きさとの差が所定の基準より小さい場合にのみ前記入力装置の姿勢を補正する、請求項9から請求項12のいずれか1項に記載の姿勢算出プログラム。   The said 1st correction | amendment means correct | amends the attitude | position of the said input device, only when the difference between the magnitude | size of the said acceleration vector and the magnitude | size of gravitational acceleration is smaller than predetermined | prescribed reference | standard. The attitude calculation program described in 1. 前記入力装置は、撮像手段をさらに備え、
前記撮像手段が撮像する所定の撮像対象の画像に基づいて、前記入力装置の姿勢をさらに補正する第2補正手段として前記コンピュータをさらに機能させる、請求項9から請求項13のいずれか1項に記載の姿勢算出プログラム。
The input device further includes an imaging unit,
The computer according to any one of claims 9 to 13, further causing the computer to function as a second correction unit that further corrects an attitude of the input device based on an image of a predetermined imaging target captured by the imaging unit. The attitude calculation program described.
前記第2補正手段は、前記入力装置の姿勢に前記所定軸回りの回転を加えることによって前記入力装置の姿勢を補正する、請求項14記載の姿勢算出プログラム。   The attitude calculation program according to claim 14, wherein the second correction unit corrects the attitude of the input device by adding rotation about the predetermined axis to the attitude of the input device. 請求項9から請求項15のいずれか1項に記載の姿勢算出プログラムによって補正された姿勢を前記入力装置の姿勢として用いてゲーム処理を行うゲームプログラム。   A game program for performing a game process using the posture corrected by the posture calculation program according to any one of claims 9 to 15 as the posture of the input device. 角速度センサと、加速度センサとを少なくとも備えた入力装置からデータを取得し、3次元の空間における当該入力装置の姿勢を算出する姿勢算出システムであって、
前記角速度センサが検出する角速度を取得し、前回の姿勢を当該取得された角速度に応じて回転させることによって新たな姿勢を算出する姿勢算出手段と、
前記加速度センサからの加速度データに基づいて前記入力装置の加速度を示す加速度ベクトルを算出する加速度ベクトル算出手段と、
前記空間における前記加速度ベクトルの方向と前記空間における鉛直下方向とを近づけるまたは一致させるように、加速度ベクトルの方向の変化に対応させて前記入力装置の姿勢を補正する第1補正手段とを備え、
前記第1補正手段は、前記入力装置の姿勢に関して、当該入力装置に対して設定され、当該入力装置の姿勢に対応する所定軸の補正前の向きと補正後の向きとの変化が最も小さくなるように、前記入力装置の姿勢を補正する、姿勢算出システム。
An attitude calculation system that acquires data from an input device including at least an angular velocity sensor and an acceleration sensor, and calculates an attitude of the input device in a three-dimensional space,
Posture calculating means for acquiring an angular velocity detected by the angular velocity sensor and calculating a new posture by rotating the previous posture in accordance with the acquired angular velocity ;
Acceleration vector calculating means for calculating an acceleration vector indicating the acceleration of the input device based on acceleration data from the acceleration sensor;
First correction means for correcting the orientation of the input device in response to a change in the direction of the acceleration vector so that the direction of the acceleration vector in the space and the vertical downward direction in the space are brought close to or coincide with each other;
Wherein the first correction means, with respect to the posture of the input device, is set for the input device, the change in the uncorrected orientation as the corrected orientation of the predetermined axis you correspond to the attitude of the input device are most An attitude calculation system for correcting the attitude of the input device so as to be smaller.
角速度センサと、加速度センサとを少なくとも備えた入力装置からデータを取得し、3次元の空間における当該入力装置の姿勢を算出する姿勢算出装置において実行される姿勢算出方法であって、
前記角速度センサが検出する角速度を取得し、前回の姿勢を当該取得された角速度に応じて回転させることによって新たな姿勢を算出する姿勢算出ステップと、
前記加速度センサからの加速度データに基づいて前記入力装置の加速度を示す加速度ベクトルを算出する加速度ベクトル算出ステップと、
前記空間における前記加速度ベクトルの方向と前記空間における鉛直下方向とを近づけるまたは一致させるように、加速度ベクトルの方向の変化に対応させて前記入力装置の姿勢を補正する第1補正ステップとを備え、
前記第1補正ステップにおいて、前記姿勢算出装置は、前記入力装置の姿勢に関して、当該入力装置に対して設定され、当該入力装置の姿勢に対応する所定軸の補正前の向きと補正後の向きとの変化が最も小さくなるように、前記入力装置の姿勢を補正する、姿勢算出方法。
An attitude calculation method executed in an attitude calculation device that acquires data from an input device including at least an angular velocity sensor and an acceleration sensor and calculates the attitude of the input device in a three-dimensional space,
An attitude calculation step of acquiring an angular velocity detected by the angular velocity sensor and calculating a new attitude by rotating the previous attitude according to the acquired angular velocity ;
An acceleration vector calculating step of calculating an acceleration vector indicating the acceleration of the input device based on acceleration data from the acceleration sensor;
A first correction step of correcting the orientation of the input device in response to a change in the direction of the acceleration vector so that the direction of the acceleration vector in the space and the vertical downward direction in the space are brought close to or coincide with each other;
In the first correction step, the orientation calculation unit, with respect to the posture of the input device, is set for the input device, before correction of the predetermined axis you correspond to the attitude of the input device orientation and the corrected An attitude calculation method for correcting the attitude of the input device so that a change in orientation is minimized.
JP2009054956A 2008-06-30 2009-03-09 Posture calculation device, posture calculation program, game device, game program, posture calculation system, and posture calculation method Active JP5872136B2 (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP2009054956A JP5872136B2 (en) 2009-03-09 2009-03-09 Posture calculation device, posture calculation program, game device, game program, posture calculation system, and posture calculation method
EP09160277.1A EP2140915B1 (en) 2008-06-30 2009-05-14 Orientation calculation apparatus, storage medium having orientation calculation program stored therein, game apparatus, and storage medium having game program stored therein
US12/472,628 US8405611B2 (en) 2008-06-30 2009-05-27 Orientation calculation apparatus, storage medium having orientation calculation program stored therein, game apparatus, and storage medium having game program stored therein
US13/768,315 US8749490B2 (en) 2008-06-30 2013-02-15 Orientation calculation apparatus, storage medium having orientation calculation program stored therein, game apparatus, and storage medium having game program stored therein

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009054956A JP5872136B2 (en) 2009-03-09 2009-03-09 Posture calculation device, posture calculation program, game device, game program, posture calculation system, and posture calculation method

Publications (2)

Publication Number Publication Date
JP2010207331A JP2010207331A (en) 2010-09-24
JP5872136B2 true JP5872136B2 (en) 2016-03-01

Family

ID=42968183

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009054956A Active JP5872136B2 (en) 2008-06-30 2009-03-09 Posture calculation device, posture calculation program, game device, game program, posture calculation system, and posture calculation method

Country Status (1)

Country Link
JP (1) JP5872136B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5689014B2 (en) * 2011-04-07 2015-03-25 任天堂株式会社 Input system, information processing apparatus, information processing program, and three-dimensional position calculation method
KR101605088B1 (en) 2014-05-28 2016-03-22 주식회사 자세과학 System for correcting posture
WO2024071733A1 (en) * 2022-09-29 2024-04-04 네이버랩스 주식회사 Method and apparatus for identifier recognition-based location determination

Also Published As

Publication number Publication date
JP2010207331A (en) 2010-09-24

Similar Documents

Publication Publication Date Title
EP2140915B1 (en) Orientation calculation apparatus, storage medium having orientation calculation program stored therein, game apparatus, and storage medium having game program stored therein
JP4265814B1 (en) Posture calculation device, posture calculation program, game device, and game program
EP2140918B1 (en) Orientation calculation apparatus, storage medium having orientation calculation program stored therein, game apparatus, and storage medium having game program stored therein
JP5060798B2 (en) Information processing program and information processing apparatus
US8041536B2 (en) Inclination calculation apparatus and inclination calculation program, and game apparatus and game program
JP4918376B2 (en) Information processing program and information processing apparatus
EP2140916B1 (en) Coordinate calculation apparatus and storage medium having coordinate calculation program stored therein
EP2140919B1 (en) Orientation calculation apparatus, storage medium having orientation calculation program stored therein, game apparatus, and storage medium having game program stored therein
JP5630969B2 (en) Posture calculation apparatus, posture calculation program, posture calculation system, and posture calculation method
JP5005627B2 (en) Information processing program and information processing apparatus
JP5525177B2 (en) Information processing program and information processing apparatus
JP2010207329A (en) Coordinate calculation device and coordinate calculation program
JP5872136B2 (en) Posture calculation device, posture calculation program, game device, game program, posture calculation system, and posture calculation method
JP5541851B2 (en) Posture calculation device, posture calculation program, game device, and game program
JP5455191B2 (en) Posture calculation apparatus, posture calculation program, posture calculation system, and posture calculation method
JP5669294B2 (en) Coordinate calculation apparatus and coordinate calculation program
JP6042394B2 (en) Coordinate calculation apparatus and coordinate calculation program
JP5424400B2 (en) Information processing apparatus, information processing program, information processing system, and display range control method
JP5872135B2 (en) Posture calculation device, posture calculation program, game device, game program, posture calculation system, and posture calculation method

Legal Events

Date Code Title Description
RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20111019

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20111104

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120124

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20131003

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20131202

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20140902

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20141125

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20141202

A912 Re-examination (zenchi) completed and case transferred to appeal board

Free format text: JAPANESE INTERMEDIATE CODE: A912

Effective date: 20150306

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20151125

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20160113

R150 Certificate of patent or registration of utility model

Ref document number: 5872136

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250