// HELPERS static void UpdateRotationState(RotationDirection direction, GameObject robotPart) { ArticulationJointController jointController = robotPart.GetComponent <ArticulationJointController>(); if (jointController != null) { jointController.rotationState = direction; } }
public void ForceJointsToRotations(float[] rotations) { for (int i = 0; i < rotations.Length; i++) { Joint joint = joints[i]; ArticulationJointController jointController = joint.robotPart.GetComponent <ArticulationJointController>(); jointController.ForceToRotation(0.0f); //jointController.ForceToRotation(rotations[i]); } }
// READ public float[] GetCurrentJointRotations() { float[] list = new float[joints.Length]; for (int i = 0; i < joints.Length; i++) { Joint joint = joints[i]; ArticulationJointController jointController = joint.robotPart.GetComponent <ArticulationJointController>(); float currentRotation = jointController.CurrentPrimaryAxisRotation(); list[i] = currentRotation; } return(list); }