2011-06-01から1ヶ月間の記事一覧

mqo blender importer インポート

http://d.hatena.ne.jp/ousttrue/searchdiary?word=%2A%5BBlender%5D からの http://sourceforge.jp/projects/meshio/wiki/FrontPage で meshio-blender25 (pymeshio-1.8.6.zip) をDLして配置。 Readmeを見てチェックを入れたらImportできた。 テクスチャの…

unity3d movie mp4 ムービー

Movie Playback is only possible with Unity Pro.だってさー! ;_;

orthographic view camera 'final fantasy tactics', 'tactics ogre', シミュレーションゲーム 平行投影

平行投影のゲームも作れる! 右上のギズモをShift+クリックでIso Viewになる。 タクティクスオウガのように、遠いキャラも同じ大きさに見えるようになる。 ゲームのProjectionをそのようにしたければ、 カメラのProjectionをOrthographicにすればよい。

AI プレイヤーが近い時だけ敵AIを動かす

赤い球に入った敵AIだけを有効にする工夫。 カメラに見えないオブジェクトをunableにするOnBecameVisibleもあるけれど、 http://www.cis.sojo-u.ac.jp/~izumi/Unity_Documentation_jp/Documentation/ScriptReference/index.Performance_Optimization.html 背…

別のスクリプトにアクセス

//from ScriptB scriptA = GetComponent("ScriptA");

別のオブジェクト 他のオブジェクト 探す Find

■子や親を探す 子や親のオブジェクトをゲームオブジェクトのTransformコンポーネントから探せる // Find the child "Hand" ofthe game object // we attached the script to transform.Find("Hand").Translate(0,1, 0); ■関数 transformを階層から発見したら…

関数の追加

function Update () { otherScript = GetComponent(OtherScript); otherScript.DoSomething(); } 次のスクリプトとOtherScriptを、同じゲームオブジェクトに付加してくださいこうやって必要な関数だけをオブジェクトに追加していける! http://www.cis.sojo-…

【ゲーム開発】小さい入力の時はあまり動かないようにするための工夫

レースゲームとかに使えるね! 昔のアーケードレースゲームの時点で、 ハンドルを少しだけ切ったら微妙に動いて、 ハンドルを大きく切ったら大きく動く工夫がされていました。 入力と、物体を動かす力が線形ではなく、二次関数の方がよい。 ヒント:方向ベク…

BeamBox raycast line renderer ビーム 光線 他のオブジェクト 関数呼び出し

回転する箱からビームが出ていて、Player(YOU)がジャンプでよけるゲーム。 ビームに当たるとYOUは血(パーティクル)を吐く。 ビームと同じ方向にRayを発射することでヒットを取っている。 Playerのスクリプト(血パーティクルは事前にPrefabにしてから登録) va…

GUI

function OnGUI () { if (GUI.Button (Rect (10,10,150,100), "I am a button")) { print ("You clicked the button!"); } create emptyしたものにこのスクリプトをドラッグすれば表示されます。 function OnGUI () { if (GUI.Button (Rect (10,10,100,50), …

update wait ウェイト 一定間隔 インターバル

yield WaitForSeconds(5.0);var spawnOBJ : GameObject; private var busy = false; //プライベート変数はこのスクリプト内でのみ参照できる変数で、インスペクター上でも表示されません function DoSpawn () { if (!busy){ busy = true; yield WaitForSecon…

スクリプト

■Update () ■FixedUpdate() Update 同様ゲーム画面が更新されたときに実行されます。但し、Update と違い、フレーム間の時間は処理の重さにかかわらず常に一定です。 Rigidbodyなど物理演算を使用する命令の場合はこちらを使用することが 一般的です。 ■Awak…

キャメラマン カメラ 移動

function Update () { transform.Translate(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); } これをカメラにセットしたら「カメラが」動く.

keycode キーボード入力 unity

http://unity3d.com/support/documentation/ScriptReference/KeyCode.html

回転 GUI シーン切り替え

var playerObj : GameObject; var aTexture : Texture; function OnGUI () { var pivotPoint : Vector2 = Vector2(35, 35); var angleY : float = playerObj.transform.localEulerAngles.y; GUIUtility.RotateAroundPivot(angleY, pivotPoint); GUI.DrawText…

シーン 切り替え

Application.LoadLevel(“名前”)Outputするときは使用するシーン全てを出力する必要があり、 file>build settingsでシーンを登録。ID=0のものが最初に読み込まれる.

unity hit trigger

衝突して吹っ飛ぶ時 void OnCollisionEnter(Collision other) { ... } void OnCollisionStay(Collision other) { ... } void OnCollisionExit(Collision other) { ... } アイテムなど、フラグだけ取りたい時 void OnTriggerEnter(Collision other) { ... } v…

アニメーション

split animation http://gp-portal.jp/material/refMaterial/2255_Unity_document01.pdf function Awake () { animation.Play("run"); } function Update () { if(Input.GetButtonDown ("Fire2")) //マウス右クリックあるいは ALT キー { SendMessage ("Dida…

衝突してきたオブジェクト名

function OnCollisionEnter(theCollision : Collision){ if(theCollision.gameObject.name == "Floor"){ Debug.Log("床に落ちました"); } } function OnCollisionEnter(coll : Collision) { var obj = coll.gameObject; Debug.Log (obj.name); if (obj.name …

チュートリアル unity3dstudent

Beginner/Essentialsのチュートリアルを見ている。 思い出しやすいように、以下に各章の内容をメモする。 Intermediate I01 – Raycasting function Update () { var up = transform.TransformDirection(Vector3.up); var hit : RaycastHit; Debug.DrawRay(tr…

unity3d destructor デストラクタ

function OnDisable(){ Debug.Log('dtor!'); } OnEnable This function is called when the object becomes enabled and active. OnDisable This function is called when the behaviour becomes disabled () or inactive. http://unity3d.com/support/docum…

unity3d material set マテリアル 動的に変更

var theMaterial : Material; ... renderer.material = theMaterial;

unity3d スケーリング scaling scale

transform.localScale = Vector3(2,2,2);

rigidbody.AddForce

unity2.xのときはrigidbody.AddForce(0,10,0)の形式でしたが、 3.xではベクトルを入力するようです。It works! using UnityEngine; using System.Collections; public class PlayerBehaviour : MonoBehaviour { // Use this for initialization void Start (…

libopencv

macportsでopencvをインストール. opencv1.0のときのlibは消えた. mac opencv2.2で入ったものは以下 mymac:lib fromjpn$ pwd /opt/local/lib mymac:lib fromjpn$ ls libopencv* libopencv_calib3d.2.2.0.dylib libopencv_core.dylib libopencv_gpu.2.2.dylib…

previous frame inner to this frame (gdb could not unwind past this frame) ERROR..

opencv2.2にしてからxcodeで動かないー>< サンプルは動いたんだけどなー あとちょっと #include <stdio.h> #include "cv.h" #include "highgui.h" #include "globalVariable.h" int main(int argc, char** argv){ IplImage* hoge; hoge = cvLoadImage("camera.png",</stdio.h>…

ポケモンBW ふしぎのアメ ものひろい ゴマゾウ

LV41以上のゴマゾウ6匹で200戦。 20個拾った。 期待値は1% * 200 * 6 = 12個なので、 豊作でした♪

file is not of required architecture

mac + opencv1.0 + snow leopard でサンプルを動かそうとしている途中で出たエラー。 途中までは過去の記事を参照。 includeはできているようだったので アーキテクチャの設定がおかしい! プロジェクト→プロジェクト設定→ ビルドタグ→アーキテクチャ→32-bit…

【写真】新宿御苑に行ってきました。

休日に歩き疲れた>< <●>_<●>