using System; using Obi; using UnityEngine; public static class ObiBlueprintGenerator { public static void GenerateObiRope(int points, float thickness, float spaceBeetweenPoints) { if (points < 2) { Debug.LogError("Rope line Must have more than two points"); return; } ObiRopeBlueprint obiRopeBlueprint = ScriptableObject.CreateInstance(); _ = $"Assets/Blueprints/ObiRopeBlueprint_{DateTime.Now:yyyyMMdd_HHmmss}.asset"; int filter = ObiUtils.MakeFilter(65535, 0); float num = spaceBeetweenPoints / (float)points; for (int i = 0; i <= points; i++) { int num2 = Mathf.Clamp(i + 1, 0, points); string name = $"p{i}"; if (i == 0) { name = "start"; } if (i == points) { name = "end"; } Vector3 vector = new Vector3(0f, (float)i * (0f - num), 0f); _ = (new Vector3(0f, (float)num2 * (0f - num), 0f) - vector).normalized / num; obiRopeBlueprint.path.AddControlPoint(vector, Vector3.zero, Vector3.zero, Vector3.down, 0.001f, 0.01f, thickness, filter, Color.white, name); } obiRopeBlueprint.pooledParticles = 200; obiRopeBlueprint.GenerateImmediate(); obiRopeBlueprint.path.FlushEvents(); } }