public static void Create(GameObject linkObject, JointTypes jointType, Joint joint = null) { Rigidbody parentRigidbody = linkObject.transform.parent.gameObject.GetComponent<Rigidbody>(); if (parentRigidbody == null) return; UrdfJoint urdfJoint = AddCorrectJointType(linkObject, jointType); if (joint != null) { urdfJoint.JointName = joint.name; urdfJoint.ImportJointData(joint); } }
public static void Create(GameObject linkObject, JointTypes jointType, Joint joint = null) { #if UNITY_2020_1_OR_NEWER //ArticulationBody parentRigidbody = linkObject.transform.parent.gameObject.GetComponent<ArticulationBody>(); #else Rigidbody parentRigidbody = linkObject.transform.parent.gameObject.GetComponent <Rigidbody>(); if (parentRigidbody == null) { return; } #endif UrdfJoint urdfJoint = AddCorrectJointType(linkObject, jointType); if (joint != null) { urdfJoint.jointName = joint.name; urdfJoint.ImportJointData(joint); } }