修改绳的逻辑
This commit is contained in:
@@ -488,10 +488,18 @@ PrefabInstance:
|
|||||||
propertyPath: startAnchor
|
propertyPath: startAnchor
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 1005026351}
|
objectReference: {fileID: 1005026351}
|
||||||
|
- target: {fileID: 114581403422500557, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3}
|
||||||
|
propertyPath: constrainToWaterSurface
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 420085638995403055, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3}
|
- target: {fileID: 420085638995403055, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3}
|
||||||
propertyPath: Rope
|
propertyPath: Rope
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 410242110}
|
objectReference: {fileID: 410242110}
|
||||||
|
- target: {fileID: 420085638995403055, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3}
|
||||||
|
propertyPath: _rope
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 410242110}
|
||||||
- target: {fileID: 484878994603287356, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3}
|
- target: {fileID: 484878994603287356, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3}
|
||||||
propertyPath: m_Parameters.widthCurve.m_Curve.Array.data[0].value
|
propertyPath: m_Parameters.widthCurve.m_Curve.Array.data[0].value
|
||||||
value: 0.001
|
value: 0.001
|
||||||
@@ -508,6 +516,10 @@ PrefabInstance:
|
|||||||
propertyPath: Rope
|
propertyPath: Rope
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 1092033884}
|
objectReference: {fileID: 1092033884}
|
||||||
|
- target: {fileID: 3199098293373602285, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3}
|
||||||
|
propertyPath: _rope
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 1092033884}
|
||||||
- target: {fileID: 7888891488031969805, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3}
|
- target: {fileID: 7888891488031969805, guid: ea6901d8aa7c41d41987d8ca92b02f6d, type: 3}
|
||||||
propertyPath: anchorTransform
|
propertyPath: anchorTransform
|
||||||
value:
|
value:
|
||||||
@@ -551,7 +563,7 @@ GameObject:
|
|||||||
- component: {fileID: 1181671548}
|
- component: {fileID: 1181671548}
|
||||||
- component: {fileID: 1181671547}
|
- component: {fileID: 1181671547}
|
||||||
- component: {fileID: 1181671546}
|
- component: {fileID: 1181671546}
|
||||||
m_Layer: 0
|
m_Layer: 3
|
||||||
m_Name: Terrain
|
m_Name: Terrain
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ namespace NBF
|
|||||||
set => nodeType = value;
|
set => nodeType = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float Lenght => _joint != null ? _joint.linearLimit.limit : 0f;
|
||||||
|
|
||||||
public Rigidbody Body => body;
|
public Rigidbody Body => body;
|
||||||
|
|
||||||
public MonoBehaviour Interaction => interaction;
|
public MonoBehaviour Interaction => interaction;
|
||||||
@@ -91,6 +93,12 @@ namespace NBF
|
|||||||
|
|
||||||
public void SetLenght(float lenght)
|
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
|
#endregion
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace NBF
|
|||||||
public void SetLenght(float length, int index = 0)
|
public void SetLenght(float length, int index = 0)
|
||||||
{
|
{
|
||||||
ConfigureStartNode();
|
ConfigureStartNode();
|
||||||
var node = logicalNodes[index];
|
var node = logicalNodes[index + 1];
|
||||||
if (node != null)
|
if (node != null)
|
||||||
{
|
{
|
||||||
node.SetLenght(length);
|
node.SetLenght(length);
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ namespace NBF
|
|||||||
targetFirstSegmentLength =
|
targetFirstSegmentLength =
|
||||||
Mathf.Clamp(initialFirstSegmentLength, minFirstSegmentLength, maxFirstSegmentLength);
|
Mathf.Clamp(initialFirstSegmentLength, minFirstSegmentLength, maxFirstSegmentLength);
|
||||||
solver.SetLenght(targetFirstSegmentLength);
|
solver.SetLenght(targetFirstSegmentLength);
|
||||||
|
solver.SetLenght(0.5f, 1);
|
||||||
// solver.BuildLine();
|
// solver.BuildLine();
|
||||||
|
|
||||||
solver.OnLineBreakRequested += OnLineBreakRequested;
|
solver.OnLineBreakRequested += OnLineBreakRequested;
|
||||||
|
|||||||
Reference in New Issue
Block a user