File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Packages/ReachySimulator/Scripts Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ public class JointController : MonoBehaviour
8
8
private bool changed ;
9
9
private ArticulationBody articulation ;
10
10
11
+ private bool compliant = false ;
12
+
11
13
void Start ( )
12
14
{
13
15
articulation = GetComponent < ArticulationBody > ( ) ;
@@ -19,6 +21,7 @@ void FixedUpdate()
19
21
{
20
22
var drive = articulation . xDrive ;
21
23
drive . target = targetPosition ;
24
+ drive . stiffness = compliant ? 0 : 1000 ;
22
25
articulation . xDrive = drive ;
23
26
24
27
changed = false ;
@@ -31,6 +34,12 @@ public void RotateTo(float newTargetPosition)
31
34
changed = true ;
32
35
}
33
36
37
+ public void IsCompliant ( bool comp )
38
+ {
39
+ compliant = comp ;
40
+ changed = true ;
41
+ }
42
+
34
43
public float GetPresentPosition ( )
35
44
{
36
45
return Mathf . Rad2Deg * articulation . jointPosition [ 0 ] ;
Original file line number Diff line number Diff line change @@ -162,6 +162,7 @@ void Update()
162
162
{
163
163
JointController joint = m . gameObject . GetComponent < JointController > ( ) ;
164
164
joint . RotateTo ( m . targetPosition ) ;
165
+ joint . IsCompliant ( m . isCompliant ) ;
165
166
166
167
m . presentPosition = joint . GetPresentPosition ( ) ;
167
168
}
You can’t perform that action at this time.
0 commit comments