Wii Remote APIの超訳 http://www.ark-web.jp/sandbox/wiki/226.html

Wii Remote APIの超訳

 The Wii Remote API - Opera Developer Community
 http://dev.opera.com/articles/view/the-wii-remote-api/

の超訳です。

ざっくり確認する時は、こちらを見た方がわかりやすいと思います。

 インターネットチャンネル向けのウェブページを作りたいのですが…。 : Q&A - Wii
 http://www.nintendo.co.jp/wii/q_and_a/093.html#category05

一Wiiユーザーとして、面白いものを作ろうとしてくれる方が細かい仕様について確認する時にでもお役に立てれば…(立てるかな ^^;)

[edit]

導入

Introduction
導入

With the Internet Channel on Wii, a Web page is able to monitor the cursor and Wii Remote buttons using traditional JavaScript event detection (described in the article "Making Wii-friendly pages").
Wiiのインターネットチャンネルで、Webページは伝統的JavaScriptイベントボタンを使ってWiiリモコンのボタンとカーソルのイベントを検出できます。

In addition, it is able to to access motion sensitivity information about the Wii Remote that is being used to browse the Web page. This is exposed through the Wii Remote API.
加えて、Wiiリモコンのモーションセンシティビティの情報にもアクセスすることができます。
これがWii リモコンAPIです。

The Wii Remote API also allows the Web page to detect all Wii Remotes that are connected to the Wii;
WiiリモコンAPIは、Wiiに接続しているすべてのWiiリモコンを検出することができます。
up to four at a time.
一度に4つまで。(4人まで)

This makes it possible to make Web pages interact with up to four users at the same time,
これは、同時に4人のユーザーが相互作用するWebページを作成することができます。

a concept not normally possible with traditional JavaScript event detection.
コンセプトは伝統的JavaScriptイベント検出から一般的に利用できません。 (イベント駆動ではないってこと??)

The API is available to JavaScript running on the Web page.
APIは、Webページ上で走るJavaScriptから利用できます。

[edit]

Motion sensitivity

Motion sensitivity
モーションセンシティビティ

The API gives information about the current status of the Wii Remotes.
APIは、Wiiリモコンの現在の状態についての情報を与えます。

This includes their roll, cursor position, distance from the screen, and what buttons are pressed.
これは、それらの回転、カーソルの位置、スクリーンからの距離、ボタンが押されているかどうかを含みます。

It does not give access to acceleration information.
加速の情報へのアクセスは与えません。

Even when it appears perfectly still, resting on a flat surface, the Wii Remote is constantly sensing motion.
完全に表示されるまで、平らな表面上でリセットし(???)、Wiiリモコンは絶えず動きを感知します。

In fact, it never stops sensing motion.
実際、動きの感知を決してやめません。

As a result, it is not possible to use events to detect when it moves,
結果として、それが動く時を検知するためにイベントを利用することはできません。

because the events would never stop firing,
なぜならイベントは決して放射をやめないからです。

and it would not be possible for a script to keep up.
そして、スクリプトが動き続けることは不可能でしょう。

As a result, the API offers a method to update the data on demand,
結果として、APIは、必要に応じて、データを更新するためのメソッドを提供します。

to obtain the instantaneous values.
即時の値を取得するための。

Typical use would involve polling for this data at required intervals.
特に、要求される間隔で、このデータのポーリングが利用されるでしょう。

<b>Polling the status of a remote</b>
リモコンの状態のポーリング

The Wii Remote data is accessed through the opera.wiiremote object.
Wii リモコンのデータは「opera.wiiremote」オブジェクトを通してアクセスされます。

This object offers a single method opera.wiiremote.update(n) which is used to obtain the status of an individual Wii Remote.
このオブジェクトは、単一のメソッド「opera.wiiremote.update(n)」を提供します。
これは、個々のWiiリモコンの状態を取得するのに利用されます。

The method expects a single parameter;
メソッドは一つのパラメータを受け取ります。

the Wii Remote number.
それは、Wiiリモコン番号。

The number is zero-based, so it starts at 0 for the first remote, and ends at 3 for the fourth remote.
その数字は最初のリモコンが「0」で始まり4つ目のリモコンは「3」で終わります。

The method returns a KpadStatus object,
そのメソッドは「KpadStatus」オブジェクトを返します。

which has several properties that give information about the remote.
これは、いくつかのプロパティをもっていて、それは、リモコンについての状態を与えます。

This update method can be called as often as is needed to obtain a fluid response,
このアップデートメソッドは流動的(?)レスポンスを得る必要があるたびに呼ばれることができます。

but note that the Wii is not as powerful as most desktop computers,
しかし、Wiiは、デスクトップコンピュータのようにパワフルではないことに注意してください。

so it is important to make sure that it is polled only as often as the script that uses that data can process it.
なので、スクリプトがデータを処理することができる程度の頻度で、ポーリングをすることが重要です。

For example, if a script uses the Wii Remote status to update the display of a canvas element,
たとえば、もしスクリプトがキャンバス要素の表示を更新するためにWiiリモコンの状態を利用するなら、

and that update will take perhaps 50 ms to update in Opera on a desktop computer,
デスクトップコンピュータ上のオペラでは、50ミリ秒間隔で更新を取得するが、

it may take over 100 ms on a Wii.
Wiiなら10ミリ秒0以上かもしれません。

Attempting to use a polling interval of less than 100 ms will cause the response to appear very sluggish.
100ミリ秒より短い間隔でオーリングを利用する場合は、レスポンスがかなり遅くなる原因になるでしょう。

Note that the opera.wiiremote object only exists in Opera on Wii,
「opera.wiiremote」オブジェクトはWiiのOperaでのみ存在することに注意してください。

so it is important to check for its existence,as well as the existence of the opera object, before attempting to use it.
ですので、それを利用する前に、operaオブジェクトの存在のチェックと同様に、その存在をチェックすることは重要です。

The KpadStatus object
KpadStatusオブジェクト

The KpadStatus object gives data for Wii Remotes and Nunchuk buttons only.
KpadStatusオブジェクトはWiiリモコンとヌンチャクのボタンだけのデータを与えます。

It does not give information for Classic Controllers.
クラシックコントローラの情報は与えられません。

It is important to note that Wii Remotes can be switched off,
wiiリモコンはスィッチオフになることができることに注意することは重要です。

be disconnected, or can be out of range.
切断や、範囲外に出ることができます。

If they remain inactive for too long, they will automatically switch off, even if they are connected.
あまりにも長くインアクティブな状態がつづくと、それが接続されていても自動的にスィッチがオフになるでしょう。

This means that even if a Wii may have 4 remotes connected to it, it is possible that only remote 3 is currently active.
これは、もし、Wiiが4つのリモコンの接続をもっていても、現在は3つだけがアクティブということが可能であることを意味します。

It is also possible that none are active.
一つもアクティブではない、ということも同様に可能です。

For this reason, it is important to check that the remote is enabled before attempting to use its data values.
この理由で、データの値を利用する前に、リモコンが利用できるかをチェックすることは重要です。

It is also important not to assume that if a remote is disabled, that no further remotes will be enabled.
リモコンが利用できないならもはやそのリモコンは利用できないとは仮定できないことも重要です。

If a Wii Remote is enabled, the KpadStatus.isEnabled property for that remote will be 1 for that remote.
もし、Wiiリモコンが利用できるなら、そのリモコンのKpadStatus.isEnableプロパティは、1になります。

If the remote is not enabled,
そのリモコンが利用できないなら、

the KpadStatus.isEnabled property will be 0 for that remote, and none of the other properties will be defined at all.
そのリモコンのKpadStatus.isEnabledプロパティは「0」になります。
そして、そのほかのプロパティはすべて定義されていません。

To check if a remote is enabled, simply use the following:
リモコンが利用できるかどうかをチェックするためには、単純に下記を利用します。

  if( theKpadStatusObject.isEnabled ) { ... }

Another important point is that the data is only valid if the remote is able to see the Sensor Bar.
別の重要なポイントは、もしリモコンがセンサーバーをみることができるなら、そのデータはvalidである、ということです。

In other words, it must be pointing approximately towards the screen.
言い換えると、おおよそスクリーンに向かってポイントされていなければなりません。

The actual area that it can see is approximately 1.75 times the width of the screen, and 1.15 times the height, though these will vary significantly depending on how close the user is to the screen.
実際のエリアはスクリーンの横幅のおおよそ1.75倍で、高さは1.15倍で、ユーザーがスクリーンにどれくらい近づいているかによります。

The Wii Remote must also be within the detectable distance from the sensor bar,
Wiiリモコンは、センサーバーから距離を検出できる距離の中になければなりません。

between approximately 0.55 and 3 metres away.
だいたい0.55〜3mの間。

If the remote is not within this detectable distance, and pointing within this visible area,
もし、リモコンが検出可能な距離になかったり、表示可能なエリアの中をポイントしていない場合は、

then all relevant properties retain the last value they had, and will no longer update.
すべてのそれらが持っていた最後の適切なプロパティを保持し、更新されません。

Properties like hold will still continue to update, as they do not relate to motion sensitivity.
プロパティは、更新され続けるまで保持され、モーションセンシティビティと関連づけられません。(???)

The KpadStatus.dpdValidity property can help identify when the remote cannot see the Sensor Bar.
「KpadStatus.dpdValidity」プロパティは、リモコンがセンサーバーを見ることができないときを識別することを助けることができます。

Available KpadStatus properties
利用できるKpadStatusプロパティ

以下、いくつかピックアップ

dpdScreenX, dpdScreenY
 event.pageXや、event.pageY と同じ

dpdX
 カーソルの水平位置。一番左が「-1」で一番右が「1」。
 -1.75から1.75 がとりうるらしい。

dpdY
 カーソルの垂直位置。一番上が「-1」で一番下が「1」。ユーザーがセンサーバーに近いかどうかによって-1.15から1.15がとりうるらしい。

hold
 リモコンのボタンのどれが押されているか。

dpdRollX
 正の値だとリモコンは上、負だと下を向いていることを意味する。
 実際の角度を取得するには次のようにするらしい。

   Math.atan2(KpadStatus.dpdRollY,KpadStatus.dpdRollX)

dpdRollY
 正の値だとリモコンは右、負だと左を向いていることを意味する。
 実際の角度を取得するには次のようにするらしい。

   Math.atan2(KpadStatus.dpdRollY,KpadStatus.dpdRollX)

dpdDistance
 Wiiリモコンとセンサーバーの距離のメートル。0.55〜3。

以下サンプルコードなどがつづく...

以上です。
おかしな訳が多々あると思いますが、出さないよりはましかと思いさらして見ました。
こんなものでお役に立てれば幸いです。フィードバックがありましたら是非ください。

僕も是非Wiiリモコンの特性を生かしたアプリを作ってみたいと思います!

投稿者志田 | パーマリンク

| append.gif

tag: JavaScript, Wii


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2007-08-07 (火) 12:35:58 (6069d)

アークウェブのサービスやソリューションはこちら