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
88 private bool changed ;
99 private ArticulationBody articulation ;
1010
11+ private bool compliant = false ;
12+
1113 void Start ( )
1214 {
1315 articulation = GetComponent < ArticulationBody > ( ) ;
@@ -19,6 +21,7 @@ void FixedUpdate()
1921 {
2022 var drive = articulation . xDrive ;
2123 drive . target = targetPosition ;
24+ drive . stiffness = compliant ? 0 : 1000 ;
2225 articulation . xDrive = drive ;
2326
2427 changed = false ;
@@ -31,6 +34,12 @@ public void RotateTo(float newTargetPosition)
3134 changed = true ;
3235 }
3336
37+ public void IsCompliant ( bool comp )
38+ {
39+ compliant = comp ;
40+ changed = true ;
41+ }
42+
3443 public float GetPresentPosition ( )
3544 {
3645 return Mathf . Rad2Deg * articulation . jointPosition [ 0 ] ;
Original file line number Diff line number Diff line change @@ -162,6 +162,7 @@ void Update()
162162 {
163163 JointController joint = m . gameObject . GetComponent < JointController > ( ) ;
164164 joint . RotateTo ( m . targetPosition ) ;
165+ joint . IsCompliant ( m . isCompliant ) ;
165166
166167 m . presentPosition = joint . GetPresentPosition ( ) ;
167168 }
You can’t perform that action at this time.
0 commit comments