Esempio n. 1
0
        /// <summary>
        /// Create a cable given route, radius, resolution and material.
        /// </summary>
        /// <param name="radius">Radius of the cable.</param>
        /// <param name="resolutionPerUnitLength">Resolution of the cable.</param>
        /// <param name="material">Shape material of the cable.</param>
        /// <returns>Cable component.</returns>
        public static Cable CreateCable(float radius = 0.05f, float resolutionPerUnitLength = 5.0f, ShapeMaterial material = null)
        {
            GameObject go    = new GameObject(CreateName <Cable>());
            Cable      cable = go.AddComponent <Cable>();

            cable.Radius = radius;
            cable.ResolutionPerUnitLength = resolutionPerUnitLength;
            cable.Material = material;

            PrefabUtils.PlaceInCurrentStange(go);

            return(cable);
        }
Esempio n. 2
0
        /// <summary>
        /// Create a wire given route, radius, resolution and material.
        /// </summary>
        /// <param name="radius">Radius if the wire.</param>
        /// <param name="resolutionPerUnitLength">Resolution of the wire.</param>
        /// <param name="material">Shape material of the wire.</param>
        /// <returns>A new game object with a Wire component.</returns>
        public static Wire CreateWire(float radius = 0.02f, float resolutionPerUnitLength = 1.5f, ShapeMaterial material = null)
        {
            GameObject go   = new GameObject(CreateName <Wire>());
            Wire       wire = go.AddComponent <Wire>();

            wire.Radius = radius;
            wire.ResolutionPerUnitLength = resolutionPerUnitLength;
            wire.Material = material;

            PrefabUtils.PlaceInCurrentStange(go);

            return(wire);
        }