[過去ログ] 【3Dゲームエンジン】Unity質問スレッド32 (1002レス)
上下前次1-新
抽出解除 レス栞
このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
978(1): 2017/12/20(水)00:44 ID:TUVA4DF6(3/6) AAS
?Vector3.Angleを使用する方法3(Rotateを使用)
transform.Rotate (0, 0, Mathf.Sign(Vector3.Dot(Vector3.forward, Vector3.Cross(transform.right, direction))) *Vector3.Angle(transform.right, direction));
?Mathf.Atan2を使用する方法1(Rotateを使用)
transform.Rotate (0, 0, Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg - transform.rotation.eulerAngles.z);
?Mathf.Atan2を使用する方法2
transform.rotation = Quaternion.AngleAxis(Mathf.Atan2((direction.y, direction.x) * Mathf.Rad2Deg, Vector3.forward);
うーん、どうやっても元よりも長いコードになってしまいます。
省2
980(1): 2017/12/20(水)08:42 ID:XTZUI7pU(1/2) AAS
969です
>>976-979
詳しく解説ありがとうございました!
やっぱり、角度から行こうとすると結構面倒ですね〜
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 1.795s*