【3Dゲームエンジン】Unity質問スレッド8at GAMEDEV【3Dゲームエンジン】Unity質問スレッド8 - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト512:名前は開発中のものです。 14/04/07 05:09:03.97 iy/YzL23.net transform.LookAtをつかってターゲットの方向にゆっくり向かせる(X,Zだけ)、 というコードを書いてみたんですが、上手くいきません、というか瞬時にターゲットの方向を向いてしまいます。 どなたか添削していただけないでしょうか。 rotateSpeedの値を0.001~10まで変えてみたんですが、結果は同じでした。 wantedRotationX = Mathf.Lerp (transform.position.x, target.position.x, rotateSpeed * Time.deltaTime); wantedRotationZ= Mathf.Lerp (transform.position.z, target.position.z, rotateSpeed * Time.deltaTime); transform.LookAt (new Vector3 (wantedRotationX, transform.position.y, wantedRotationZ)); 513:名前は開発中のものです。 14/04/07 05:44:50.54 XoNxfDTp.net wantedRotationX = Mathf.Lerp (transform.position.x+transform.forward.x, target.position.x, rotateSpeed * Time.deltaTime); wantedRotationZ= Mathf.Lerp (transform.position.z+transform.forward.z target.position.z, rotateSpeed * Time.deltaTime); transform.LookAt (new Vector3 (wantedRotationX, transform.position.y, wantedRotationZ)); とでもしとけば何とかなるかもしれない。 適切な方法かはわからんが。 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch