質問するログイン新規登録

質問編集履歴

1

情報の追加

2017/08/16 11:04

投稿

nyanyako
nyanyako

スコア13

title CHANGED
File without changes
body CHANGED
@@ -1,18 +1,48 @@
1
1
  今、Unityの勉強をしています。
2
2
  現在のオブジェクトを回転させるプログラムを作成し、回転しているオブジェクトのRotationをエクセルに出力させています。
3
3
  下記のコードでは、z座標しかエクセルに出力できていません。xとy座標も出力させたいのですが、カンマ区切りで一緒に出力させる方法がわかりません。
4
- また、下記のコードではUnityのCubeのinspectorに表示されているRotation Zとエクセルに出力されている値が異なります。これはなぜでしょうか?
5
4
 
5
+ また、下記のコードではUnityのCubeのinspectorに表示されているRotation Zとエクセルに出力されている値が異なります。
6
+ inspectorには1秒ごとに0、5、10…のように5刻みの値が表示されます。
7
+ エクセルファイルには
8
+ 0.043619
9
+ 0.087156
10
+ 0.130526
11
+ 0.173648
12
+ 0.21644
13
+ 0.258819
14
+ 0.300706
15
+ 0.34202
16
+ のように値が入ります。
17
+ inspectorに表示されている値をエクセルファイルに出力させたいのですが、なぜかがわかりません。
18
+
6
19
  よろしくお願いします。
7
20
 
8
21
  ```C#
22
+ using System.Collections;
23
+ using System.Collections.Generic;
9
24
  using UnityEngine;
10
- using System.Collections;
11
25
 
12
- public class RotateCube : MonoBehaviour {
26
+ public class Rotatecube : MonoBehaviour {
27
+ private float timeleft;
28
+ // Use this for initialization
29
+ void Start () {
30
+
31
+ }
13
32
 
33
+ // Update is called once per frame
14
- void Update () {
34
+ void Update()
35
+ {
36
+
37
+ //だいたい1秒ごとに処理を行う
38
+ timeleft -= Time.deltaTime;
39
+ if (timeleft <= 0.0) {
40
+ timeleft = 1.0f;
41
+
42
+ //ここに処理
15
- transform.Rotate(new Vector3(0, 0, 5));
43
+ transform.Rotate(new Vector3(0, 0, 5));
44
+ }
45
+
16
46
  }
17
47
  }
18
48
  ```
@@ -23,7 +53,7 @@
23
53
  using System.IO;
24
54
 
25
55
  public class log : MonoBehaviour
26
- { // float timex;
56
+ {
27
57
  // Use this for initialization
28
58
  void Start()
29
59
  {