The next time you’re watching a robot hand someone a cup of coffee, ask someone a simple question or even drive a car, do yourself a favor and don’t be such a critic. Yes, a lot of what so-called intelligent or learning robots are doing is still fairly simple — some of it borders on mundane — but they’re not exactly working with a human brain. The fact of the matter is that machine learning is rea
Unityでダブルクリックを防止したかったので以下のようなコードを書いた。 float beforeClickTime = 0; void OnClick() { // 前回のクリックから一秒以上経過していないクリックは無視 if (1.0f < (Time.time - beforeClickTime)) { // クリック処理 } beforeClickTime = Time.time; } マウスクリックやタッチでオブジェクトを選択したい場合Raycastを使う。 ざっくりしたイメージだとある1点から線を伸ばし、当たったオブジェクトを取得する事が出来る。 void Update () { if (Input.GetMouseButtonDown(0)) { // カメラからタッチした場所まで光線を作成 Ray ray = Camera.main.ScreenPointToRay(In
Quaternionでベクトルを回す Quaternionの加算 Quaternionを求める サンプル その他 Quaternionは回転情報です。transform.rotationに格納されています。 このQuaternion(回転)ですが、Vector3(ベクトル)と合わせると、Vector3を回転させる事ができます。 Quaternionでベクトルを回す 例えば、Unityで「向いている方向のベクトル」を得るには、transform.forward等を使用します。2Dの場合はtransform.up等でしょう。 実はこのtransform.upの値は、以下のコードと一致します。 var dir = transform.rotation * Vector3.up; つまり「Vector3.up(上方向)を基準にtransformの持つQuaternion(回転情報)にを掛けて回転さ
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く