###前提・実現したいこと
すでに配置されている、回転した4つのCubeの座標を取得したいです
###発生している問題・エラーメッセージ
明らかに異なる座標が取得されてしまいます
###該当のソースコード
Javascript
1 2//functionの一部になります 3 var Unit : GameObject;//CubeをInspectorバーで設定しています 4 var theta : float; 5 var Cx : float; 6 var Cz : float; 7 var Coordinatex = new float[16]; 8 var Coordinatez = new float[16]; 9 10 for(var i = 0; i <4 ; i++) 11 { 12 Unit = Units[i]; 13 theta = -Unit.transform.eulerAngles.y* Mathf.Deg2Rad; 14 Cx = Unit.transform.position.x; 15 Cz = Unit.transform.position.z; 16 17 Coordinatex[i*4] = Mathf.Cos(theta)-Mathf.Sin(theta)+Cx; //URx 18 Coordinatex[i*4+1] = -Mathf.Cos(theta)-Mathf.Sin(theta)+Cx; //ULx 19 Coordinatex[i*4+2] = -Mathf.Cos(theta)+Mathf.Sin(theta)+Cx; //LLx 20 Coordinatex[i*4+3] = Mathf.Cos(theta)+Mathf.Sin(theta)+Cx; //LRx 21 22 Coordinatez[i*4] = Mathf.Sin(theta)+Mathf.Cos(theta)+Cz; 23 Coordinatez[i*4+1] = -Mathf.Sin(theta)+Mathf.Cos(theta)+Cz; 24 Coordinatez[i*4+2] = -Mathf.Sin(theta)-Mathf.Cos(theta)+Cz; 25 Coordinatez[i*4+3] = Mathf.Sin(theta)-Mathf.Cos(theta)+Cz; 26 27 }
###試したこと
meshも試しましたがいまいち書き方がわかりません
###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
回答1件
あなたの回答
tips
プレビュー