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

質問編集履歴

5

書式の改善

2021/06/04 11:57

投稿

mmm1728520
mmm1728520

スコア5

title CHANGED
@@ -1,1 +1,1 @@
1
- 【Unity】Debug.Logにあるかどうかを判定するには
1
+ 【Unity】加速度の大小判定
body CHANGED
@@ -66,5 +66,6 @@
66
66
  {
67
67
  Debug.Log("動いてない");
68
68
  }
69
+ oldaccel=accel;
69
70
  }
70
71
  ```

4

誤字

2021/06/04 11:57

投稿

mmm1728520
mmm1728520

スコア5

title CHANGED
File without changes
body CHANGED
@@ -25,23 +25,23 @@
25
25
 
26
26
  ### 試したこと
27
27
  ```C#
28
- public bool innote;
28
+ public bool innotes;
29
- public bool inbignote;
29
+ public bool inbignotes;
30
30
 
31
31
  Vector3 oldaccel = new Vector3(0,0,0);
32
32
  void Start()
33
33
  {
34
- innote = true;
34
+ innotes = true;
35
- inbignote = true;
35
+ inbignotes = true;
36
36
  }
37
37
 
38
38
  private void OnTriggerStay(Collider c)
39
39
  {
40
40
  var accel = joycon.GetAccel();
41
41
  //大判定・加速度がaccelbigpoint以上なら判定
42
- if (Mathf.Abs(oldaccel.x - accel.x) > accelxbigpoint && inbignote == true && c.gameObject.tag == "judgeline")
42
+ if (Mathf.Abs(oldaccel.x - accel.x) > accelxbigpoint && inbignotes == true && c.gameObject.tag == "judgeline")
43
43
  {
44
- inbignote==false
44
+ inbignotes==false
45
45
  FindObjectOfType<Pointplus>().Addbigpoint();
46
46
  Debug.Log(" 大たてうごいた" + oldaccel + accel);
47
47
  Destroy(this.gameObject);
@@ -52,12 +52,12 @@
52
52
 
53
53
  //小判定・加速度がaccelypoint以上かつaccelxbigpoint以下なら判定
54
54
    if (Mathf.Abs(oldaccel.x - accel.x) > accelxpoint && Mathf.Abs(oldaccel.x - accel.x) < accelxbigpoint 
55
-     && innote == true && c.gameObject.tag == "judgeline")
55
+     && innotes == true && c.gameObject.tag == "judgeline")
56
56
      {
57
- innote==false
57
+ innotes==false
58
58
  FindObjectOfType<Pointplus>().Addsmallpoint();
59
59
  Debug.Log(" 小たてうごいた");
60
-       if(inbignote==true)
60
+       if(inbignotes==true)
61
61
        {
62
62
  Destroy(this.gameObject);
63
63
        }

3

書式の改善

2021/06/04 05:40

投稿

mmm1728520
mmm1728520

スコア5

title CHANGED
File without changes
body CHANGED
@@ -24,12 +24,47 @@
24
24
 
25
25
 
26
26
  ### 試したこと
27
+ ```C#
28
+ public bool innote;
29
+ public bool inbignote;
30
+
31
+ Vector3 oldaccel = new Vector3(0,0,0);
32
+ void Start()
33
+ {
34
+ innote = true;
35
+ inbignote = true;
36
+ }
37
+
38
+ private void OnTriggerStay(Collider c)
39
+ {
40
+ var accel = joycon.GetAccel();
41
+ //大判定・加速度がaccelbigpoint以上なら判定
42
+ if (Mathf.Abs(oldaccel.x - accel.x) > accelxbigpoint && inbignote == true && c.gameObject.tag == "judgeline")
43
+ {
44
+ inbignote==false
45
+ FindObjectOfType<Pointplus>().Addbigpoint();
46
+ Debug.Log(" 大たてうごいた" + oldaccel + accel);
47
+ Destroy(this.gameObject);
48
+
49
+
50
+ }
51
+
52
+
27
53
  //小判定・加速度がaccelypoint以上かつaccelxbigpoint以下なら判定
28
- if (Mathf.Abs(oldaccel.x - accel.x) > accelxpoint && Mathf.Abs(oldaccel.x - accel.x) < accelxbigpoint )
54
+   if (Mathf.Abs(oldaccel.x - accel.x) > accelxpoint && Mathf.Abs(oldaccel.x - accel.x) < accelxbigpoint 
55
+     && innote == true && c.gameObject.tag == "judgeline")
29
- {
56
+     {
30
- point++
57
+ innote==false
58
+ FindObjectOfType<Pointplus>().Addsmallpoint();
31
- Debug.Log(" 小たてうごいた");
59
+ Debug.Log(" 小たてうごいた");
60
+       if(inbignote==true)
61
+       {
32
- Destroy(this.gameObject);
62
+ Destroy(this.gameObject);
63
+       }
64
+
65
+ else
66
+ {
67
+ Debug.Log("動いてない");
68
+ }
33
69
  }
34
-
35
- 上記で判定をしています。
70
+ ```

2

書式の改善

2021/06/04 05:35

投稿

mmm1728520
mmm1728520

スコア5

title CHANGED
@@ -1,1 +1,1 @@
1
- 【Unity】加速度の履歴取得と処理
1
+ 【Unity】Debug.Logにあるかどうかを判定するには
body CHANGED
@@ -9,15 +9,20 @@
9
9
 
10
10
  ### 発生している問題・エラーメッセージ
11
11
 
12
- 加速度を取得して、振られたか振られていないかの判定の仕方は理解し、3~5までは小判定、5以上動けば大判定という風にしようと考えていて
12
+ 加速度を取得して、振られたか振られていないかの判定の仕方は理解し、xが3~5までは小判定、5以上動けば大判定
13
+ それ以外は判定なしという風にしようと考えていて、Debug.Logで表示しているのですが、この判定されたという履歴から
14
+ どのようにして取得すればいいのかがわかりません。
13
15
 
14
- ジョイコンを振ったときの加速度の数フレームの履歴を取り、大の値があれば大の処理、なければ小の処理ということをすれば
15
- 思った通りの動きになってくれるのは何となくわかったのですが、そこの書き方が分からず困っています。
16
16
 
17
+ 小判定を一度通ってから大判定へ行くので、2度判定されてしまうのですがこれをどちらか1回だけにしたいです。
18
+ (小判定から10行以内に大判定があれば大判定になるという感じで)
17
19
 
20
+ そもそもDebug.Logから取得しようとしていることがダメなのかと思い、
21
+ いろいろ調べているのですが解決方法が見つからず助けて頂きたいです。
18
22
 
19
23
 
20
24
 
25
+
21
26
  ### 試したこと
22
27
  //小判定・加速度がaccelypoint以上かつaccelxbigpoint以下なら判定
23
28
  if (Mathf.Abs(oldaccel.x - accel.x) > accelxpoint && Mathf.Abs(oldaccel.x - accel.x) < accelxbigpoint )

1

書式の改善

2021/06/03 14:07

投稿

mmm1728520
mmm1728520

スコア5

title CHANGED
@@ -1,1 +1,1 @@
1
- 【Unity】加速度の大小判定
1
+ 【Unity】加速度の履歴取得と処理
body CHANGED
@@ -1,10 +1,12 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
- UnityでNintendoSwitchのジョイコンを使ってゲームを制作しています。
3
+ UnityでNintendoSwitchのジョイコンを使ってリズムゲームを制作しています。
4
4
 
5
- ジョイコンを振って遊ぶのですが、ジョイコンが大きく振られたか、小さく振られたかを判定したいです。
5
+ ジョイコンを振って遊ぶのですが、ノーツが判定ラインに来た時にジョイコンが大きく振られたか、小さく振られたかを判定したいです。
6
6
 
7
7
 
8
+
9
+
8
10
  ### 発生している問題・エラーメッセージ
9
11
 
10
12
  加速度を取得して、振られたか振られていないかの判定の仕方は理解し、3~5までは小判定、5以上動けば大判定という風にしようと考えていて