void setKinematic() { j = GetComponentInChildren <Jointer>(); c = j.cone; if (c != null) { if (c.GetComponent <Rigidbody>().velocity == Vector3.zero) { c.GetComponent <Rigidbody>().isKinematic = true; } } }
void RobotControls() { if (Input.GetKey(KeyCode.W)) { WheelForce(force); } else if (Input.GetKey(KeyCode.S)) { WheelForce(-force); } else { WheelForce(0); } Vector3 pos = jointee.transform.position; if (Input.GetKey(KeyCode.R)) { if (pos.y <= 2) { pos.y += .01f; print(pos); jointee.transform.position = pos; } } else if (Input.GetKey(KeyCode.F)) { if (pos.y >= 0.1) { pos.y -= .01f; print(pos); jointee.transform.position = pos; } } else if (Input.GetKey(KeyCode.T)) { j = GetComponentInChildren <Jointer>(); c = j.cone; if (c) { c.GetComponent <Rigidbody>().isKinematic = false; c.GetComponent <Rigidbody>().useGravity = true; transform.GetComponentInChildren <Cone>().transform.SetParent(null); j.cone = null; c.transform.parent = null; } } if (Input.GetKey(KeyCode.Q)) { climbingDrum.spinMotor = true; } else { climbingDrum.spinMotor = false; } Rotate(); }