【3Dゲームエンジン】Unity質問スレッド37at GAMEDEV【3Dゲームエンジン】Unity質問スレッド37 - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト205:名前は開発中のものです。 18/08/16 22:50:46.67 TI7urZxT.net translate.fowardとかは? 206:名前は開発中のものです。 18/08/16 22:55:37.35 1isuZfzA.net vector3 playerposition; //自機のばしょ vector3 positiondistance; //弾と自機の座標差から取ったベクトル float bulletmovedistance; //破壊判定用の動いた距離 [Selializefiled] float bulletspeed=0.2f; //弾を移動速度 void start() { playerposition=GameObject.Find(player).GetCommpoment〈Transform〉.position; //自機座標の取得 positiondistance=(playerposition-transform.position).Nomraized; //弾と自機の座標差からベクトル取得&正規化 transform.Fromtorotation(vector3.down,positiondistance); //弾を後ろ側を自機に向ける } void update() { Bulletcheck(); } void fixedupdate() { Bulletmove(); } public void Bulletcheck() //弾の破壊判定 { if(bulletmovedistance<5) { GameObject.Dertory(gameobject); } } public void Bulletmove() //弾の移動 { transform.translate(tranform.up*bulletspeed); } こうでした >>202 2dなので正面方向はtransform.upなんですよね… 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch