質問編集履歴

3

改善

2018/02/20 20:32

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -35,6 +35,8 @@
35
35
 
36
36
 
37
37
  全文
38
+
39
+ ```
38
40
 
39
41
  using System.Collections;
40
42
 
@@ -85,3 +87,5 @@
85
87
  }
86
88
 
87
89
  }
90
+
91
+ ```

2

全文追加

2018/02/20 20:31

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -29,3 +29,59 @@
29
29
  public HingeJoint hinge;
30
30
 
31
31
  ```
32
+
33
+
34
+
35
+
36
+
37
+ 全文
38
+
39
+ using System.Collections;
40
+
41
+ using System.Collections.Generic;
42
+
43
+ using UnityEngine;
44
+
45
+
46
+
47
+ public class MotorEditor : MonoBehaviour {
48
+
49
+
50
+
51
+ public HingeJoint hinge;
52
+
53
+ int mt = 0;
54
+
55
+ // Use this for initialization
56
+
57
+ void Start () {
58
+
59
+ JointMotor motor = hinge.motor;
60
+
61
+
62
+
63
+
64
+
65
+ }
66
+
67
+
68
+
69
+ // Update is called once per frame
70
+
71
+ void Update () {
72
+
73
+ motor.targetVelocity = mt + 100;
74
+
75
+ motor.force = mt + 500;
76
+
77
+
78
+
79
+ hinge.useMotor = true;
80
+
81
+ hinge.motor = motor;
82
+
83
+ mt++;
84
+
85
+ }
86
+
87
+ }

1

HingeJoint型です

2018/02/20 20:31

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- [Unity]motorが取得できません
1
+ [Unity]HingeJointのmotorがC#で取得できません
test CHANGED
@@ -21,3 +21,11 @@
21
21
  一番上のコードはUnity公式マニュアルからそのまま取ってきたものなので、信頼できるはずだが・・
22
22
 
23
23
  なお、HingeJointはpublicを使って取得。
24
+
25
+
26
+
27
+ ```
28
+
29
+ public HingeJoint hinge;
30
+
31
+ ```