/// <summary> /// Creates identical copy of specified RobotModel. /// </summary> /// <param name="robotToCopy">RobotModel to copy.</param> /// <returns>Copy of specified RobotModel.</returns> private RobotModel CopyRobotModel(RobotModel robotToCopy) { GameObject robotModelGameObject = Instantiate(robotToCopy.RobotModelGameObject); robotModelGameObject.transform.parent = transform; robotModelGameObject.transform.localPosition = Vector3.zero; robotModelGameObject.transform.localEulerAngles = Vector3.zero; RobotModel robot = new RobotModel(robotToCopy.RobotType, robotModelGameObject); robot.LoadLinks(copyOfRobotModel: true); robot.RobotLoaded = true; return(robot); }
/// <summary> /// Imports URDF based on a given filename. Filename has to contain a full path. /// <param name="filename">Filename including path to the urdf file.</param> /// <param name="robotType">Type of the robot.</param> /// </summary> private void ImportUrdfObject(string filename, string robotType) { UrdfRobot urdfRobot = UrdfRobotExtensionsRuntime.Create(filename, useColliderInVisuals: true, useUrdfMaterials: true); urdfRobot.transform.parent = transform; urdfRobot.transform.localPosition = Vector3.zero; urdfRobot.transform.localEulerAngles = Vector3.zero; urdfRobot.SetRigidbodiesIsKinematic(true); RobotModel robot = new RobotModel(robotType, urdfRobot.gameObject); robot.LoadLinks(); RobotModels[robotType].Add(robot); //Debug.Log("URDF: robot created (without models yet)"); }