示例#1
0
        public static UrdfCollision Create(Transform parent, Link.Collision collision)
        {
            GameObject collisionObject = new GameObject("unnamed");

            collisionObject.transform.SetParentAndAlign(parent);
            UrdfCollision urdfCollision = collisionObject.AddComponent <UrdfCollision>();

            urdfCollision.geometryType = UrdfGeometry.GetGeometryType(collision.geometry);
            UrdfGeometryCollision.Create(collisionObject.transform, urdfCollision.geometryType, collision.geometry);
            UrdfOrigin.ImportOriginData(collisionObject.transform, collision.origin);
            return(urdfCollision);
        }
示例#2
0
        /// <summary>
        /// Compares colliison information of two links
        /// </summary>
        /// <param name="source">First links's collision information to be compared</param>
        /// <param name="exported">Second link's collision information to be compared</param>
        /// <param name="indent">Indent level in the log file</param>
        /// <returns></returns>
        private bool CompareCollisions(Link.Collision source, Link.Collision exported, int indent)
        {
            bool colliisonNameEqual = (source.name == exported.name);

            linkLog.AppendLine(String.Format("{0}Collision Name", Indent(indent)));
            linkLog.AppendLine(String.Format("{0}Equal: {1,6}", Indent(indent), colliisonNameEqual));
            linkLog.AppendLine(String.Format("{0}Name: Source: {1,12}", Indent(indent), source.name));
            linkLog.AppendLine(String.Format("{0}Exported: {1,12}", Indent(indent), exported.name));

            if (!colliisonNameEqual)
            {
                return(false);
            }

            if (!CompareOrigin(source.origin, exported.origin, indent))
            {
                return(false);
            }
            if (!CompareGeometry(source.geometry, exported.geometry, indent))
            {
                return(false);
            }
            return(true);
        }