public static QuickRope2 Create(GameObject pointA, GameObject pointB, List <Vector3> curvePoints, BasicRopeTypes ropeType) { QuickRope2 qr = pointA.AddComponent <QuickRope2>(); qr.ropeEnd = pointB; switch (ropeType) { case BasicRopeTypes.NONE: break; case BasicRopeTypes.Line: qr.gameObject.AddComponent <QuickRope2Line>(); break; case BasicRopeTypes.Prefab: qr.gameObject.AddComponent <QuickRope2Prefab>(); break; case BasicRopeTypes.Mesh: qr.gameObject.AddComponent <QuickRope2Mesh>(); break; case BasicRopeTypes.Cloth: qr.gameObject.AddComponent <QuickRope2Cloth>(); break; } qr.ApplyRopeSettings(); return(qr); }
void UpdateRope() { r.jointSpacing = Mathf.Clamp(r.jointSpacing, QuickRope2.MIN_JOINT_SPACING, QuickRope2.MAX_JOINT_SPACING); if (r.jointSpacing >= QuickRope2.MIN_JOINT_SPACING) { r.ApplyRopeSettings(); //r.SetControlPoints(r.ControlPoints); } }
void Start() { rope = QuickRope2.Create(Vector3.zero, new Vector3(0, -10, 0), BasicRopeTypes.Mesh); rope.enablePhysics = true; rope.enableRopeController = true; rope.ApplyRopeSettings(); rope.rigidbody.isKinematic = true; }
void OnEnable() { r = (QuickRope2)target; if (Application.isPlaying) { return; } CleanupObject(); r.ApplyRopeSettings(); //r.SetControlPoints(r.ControlPoints); }
void OnEnable() { r = (QuickRope2)target; if (Application.isPlaying) return; CleanupObject(); r.ApplyRopeSettings(); //r.SetControlPoints(r.ControlPoints); }