toggle for motors
This commit is contained in:
parent
78f48aa63c
commit
13303c9742
2 changed files with 12 additions and 3 deletions
|
@ -25,11 +25,11 @@ public static class CableJointsAlgorithm {
|
|||
|
||||
totalDist += dist.distance;
|
||||
|
||||
Debug.Log(go.name+": l: +"+left+" r: -"+right);
|
||||
//Debug.Log(go.name+": l: +"+left+" r: -"+right);
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("Total distance for cable: "+totalDist);
|
||||
//Debug.Log("Total distance for cable: "+totalDist);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public static class CableJointsAlgorithm {
|
|||
|
||||
var dist = circumference * delta;
|
||||
|
||||
Debug.Log(c.name+": angle1: "+angle1+" angle2: "+angle2+" -> delta: "+delta+" circumferecne: "+circumference+" dist: "+dist);
|
||||
//Debug.Log(c.name+": angle1: "+angle1+" angle2: "+angle2+" -> delta: "+delta+" circumferecne: "+circumference+" dist: "+dist);
|
||||
return (float) dist;
|
||||
}
|
||||
}
|
|
@ -126,6 +126,15 @@ public class Controller : MonoBehaviour {
|
|||
private float waitedFrames = 0;
|
||||
// Update is called once per frame
|
||||
void Update() {
|
||||
if (Input.GetKeyDown(KeyCode.T)) {
|
||||
foreach (var go in FindObjectsByType<GameObject>(FindObjectsInactive.Exclude, FindObjectsSortMode.None)) {
|
||||
if (go.GetComponent<RollerProperties>() != null && go.GetComponent<RollerProperties>().movement == RollerProperties.RotationType.Powered) {
|
||||
go.GetComponent<HingeJoint2D>().useMotor = !go.GetComponent<HingeJoint2D>().useMotor;
|
||||
Debug.Log("TOGGLED ALL MOTORS");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (waitedFrames++ > -1) {
|
||||
CableJointsAlgorithm.TimeStep(cables);
|
||||
waitedFrames = 0;
|
||||
|
|
Loading…
Reference in a new issue