質問編集履歴
1
lookオブジェクトのアニメーションの変化を操作するスクリプトの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
### 該当のソースコード
|
18
18
|
|
19
|
-
|
19
|
+
lookオブジェクトの向きを読み取るスクリプト
|
20
20
|
|
21
21
|
```C#
|
22
22
|
|
@@ -120,6 +120,78 @@
|
|
120
120
|
|
121
121
|
|
122
122
|
|
123
|
+
lookオブジェクトのアニメーション操作のスクリプト
|
124
|
+
|
125
|
+
```C#
|
126
|
+
|
127
|
+
using System.Collections;
|
128
|
+
|
129
|
+
using System.Collections.Generic;
|
130
|
+
|
131
|
+
using UnityEngine;
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
public class AimController : MonoBehaviour {
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
private Animator Aim;
|
140
|
+
|
141
|
+
private GameObject Player;
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
public float h;
|
146
|
+
|
147
|
+
public float v;
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
void Start () {
|
152
|
+
|
153
|
+
Aim = GetComponent<Animator>();
|
154
|
+
|
155
|
+
}
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
// Update is called once per frame
|
160
|
+
|
161
|
+
void Update () {
|
162
|
+
|
163
|
+
Player = GameObject.Find("Player1");
|
164
|
+
|
165
|
+
gameObject.transform.position = Player.transform.position;
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
// 右スティックの入力取得
|
170
|
+
|
171
|
+
h = Input.GetAxis("Horizontal2");
|
172
|
+
|
173
|
+
v = Input.GetAxis ("Vertical2");
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
//モーション判定用のパラメータ
|
178
|
+
|
179
|
+
Aim.SetFloat("Direction_x", h);
|
180
|
+
|
181
|
+
Aim.SetFloat("Direction_y", v);
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
}
|
186
|
+
|
187
|
+
```
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
123
195
|
### 補足情報(FW/ツールのバージョンなど)
|
124
196
|
|
125
197
|
|