diff --git a/Assets/Scenes/RopeTest.unity b/Assets/Scenes/RopeTest.unity index 1f32c0240..f538b78d0 100644 --- a/Assets/Scenes/RopeTest.unity +++ b/Assets/Scenes/RopeTest.unity @@ -488,10 +488,18 @@ PrefabInstance: propertyPath: startAnchor value: objectReference: {fileID: 1005026351} + - target: {fileID: 114581403422500557, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3} + propertyPath: constrainToWaterSurface + value: 0 + objectReference: {fileID: 0} - target: {fileID: 420085638995403055, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3} propertyPath: Rope value: objectReference: {fileID: 410242110} + - target: {fileID: 420085638995403055, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3} + propertyPath: _rope + value: + objectReference: {fileID: 410242110} - target: {fileID: 484878994603287356, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3} propertyPath: m_Parameters.widthCurve.m_Curve.Array.data[0].value value: 0.001 @@ -508,6 +516,10 @@ PrefabInstance: propertyPath: Rope value: objectReference: {fileID: 1092033884} + - target: {fileID: 3199098293373602285, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3} + propertyPath: _rope + value: + objectReference: {fileID: 1092033884} - target: {fileID: 7888891488031969805, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3} propertyPath: anchorTransform value: @@ -551,7 +563,7 @@ GameObject: - component: {fileID: 1181671548} - component: {fileID: 1181671547} - component: {fileID: 1181671546} - m_Layer: 0 + m_Layer: 3 m_Name: Terrain m_TagString: Untagged m_Icon: {fileID: 0} diff --git a/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineNode.cs b/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineNode.cs index 0af5cc8c4..fe2d50ef2 100644 --- a/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineNode.cs +++ b/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineNode.cs @@ -44,6 +44,8 @@ namespace NBF set => nodeType = value; } + public float Lenght => _joint != null ? _joint.linearLimit.limit : 0f; + public Rigidbody Body => body; public MonoBehaviour Interaction => interaction; @@ -91,6 +93,12 @@ namespace NBF public void SetLenght(float lenght) { + if (!_joint) return; + if (!Mathf.Approximately(lenght, _joint.linearLimit.limit)) + { + _joint.linearLimit = new SoftJointLimit() { limit = lenght }; + _rope.SetTargetLength(lenght - 0.1f); + } } #endregion diff --git a/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineSolver.cs b/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineSolver.cs index 9cd53d2e8..4f3dc4543 100644 --- a/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineSolver.cs +++ b/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineSolver.cs @@ -108,7 +108,7 @@ namespace NBF public void SetLenght(float length, int index = 0) { ConfigureStartNode(); - var node = logicalNodes[index]; + var node = logicalNodes[index + 1]; if (node != null) { node.SetLenght(length); diff --git a/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineTestController.cs b/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineTestController.cs index 0ae9e56a7..5211bc17f 100644 --- a/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineTestController.cs +++ b/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineTestController.cs @@ -37,6 +37,7 @@ namespace NBF targetFirstSegmentLength = Mathf.Clamp(initialFirstSegmentLength, minFirstSegmentLength, maxFirstSegmentLength); solver.SetLenght(targetFirstSegmentLength); + solver.SetLenght(0.5f, 1); // solver.BuildLine(); solver.OnLineBreakRequested += OnLineBreakRequested;