public void TogglePhysics() { rope.usePhysics = !rope.usePhysics; buttonText.text = "Press To " + ((rope.usePhysics) ? "Stop Physics" : "Play Physics"); playButton.colors = new ColorBlock() { normalColor = (rope.usePhysics) ? playingColor : stoppedColor, highlightedColor = (rope.usePhysics) ? playingColor : stoppedColor, pressedColor = (rope.usePhysics) ? playingColor : stoppedColor, colorMultiplier = 1, fadeDuration = 0.2f }; rope.defaultColliderSettings.radius = rRender.Radius * 0.5f; rope.Generate(); }
void Awake() { rope = GetComponent <QuickRope>(); if (rope.Spline.IsLooped) { enabled = false; return; } rope.minLinkCount = minJointCount; if (!rope.canResize) { rope.maxLinkCount = rope.Links.Length + 1; rope.canResize = true; rope.Generate(); } rope.Links[rope.Links.Length - 1].Rigidbody.isKinematic = true; }