完成捏住鱼线逻辑
This commit is contained in:
@@ -2302,10 +2302,11 @@ Animator:
|
||||
'pinky_01_l'\n\tTransform 'pinky_03_l'\n\tTransform 'lowerarm_r'\n\tTransform
|
||||
'ring_02_l'\n\tTransform 'index_metacarpal_r'\n\tTransform 'root'\n\tTransform
|
||||
'spine_04'\n\tTransform 'ring_metacarpal_r'\n\tand more ...\n\tFrom animation
|
||||
clip 'FACS_001'\n\tFrom animation clip 'FACS_002'\n\tFrom animation clip 'FACS_003'\n\tFrom
|
||||
animation clip 'FACS_004'\n\tFrom animation clip 'FACS_005'\n\tFrom animation
|
||||
clip 'FACS_006'\n\tFrom animation clip 'FACS_007'\n\tFrom animation clip 'FACS_008'\n\tFrom
|
||||
animation clip 'FACS_009'\n\tFrom animation clip 'FACS_010'\n\tand more ..."
|
||||
clip 'eyeLookDownLeft'\n\tFrom animation clip 'eyeLookUpLeft'\n\tFrom animation
|
||||
clip 'eyeBlinkRight'\n\tFrom animation clip 'eyeWideRight'\n\tFrom animation
|
||||
clip 'jawForward'\n\tFrom animation clip 'jawLeft'\n\tFrom animation clip 'jawRight'\n\tFrom
|
||||
animation clip 'jawOpen'\n\tFrom animation clip 'mouthFunnel'\n\tFrom animation
|
||||
clip 'mouthPucker'\n\tand more ..."
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorStateOnDisable: 0
|
||||
|
||||
@@ -9,8 +9,6 @@ namespace NBF
|
||||
[SerializeField] private float moveSpeed = 5f;
|
||||
[SerializeField] private float snapDistance = 0.1f;
|
||||
|
||||
// 组件引用
|
||||
private ConfigurableJoint originalSpringJoint;
|
||||
private FixedJoint pinchJoint;
|
||||
private Rigidbody rb;
|
||||
|
||||
@@ -22,15 +20,13 @@ namespace NBF
|
||||
|
||||
|
||||
public bool isPinched { get; private set; }
|
||||
|
||||
|
||||
|
||||
private bool moveToTargetDone;
|
||||
private float _speed;
|
||||
|
||||
void Start()
|
||||
{
|
||||
rb = GetComponent<Rigidbody>();
|
||||
originalSpringJoint = GetComponent<ConfigurableJoint>();
|
||||
}
|
||||
|
||||
void FixedUpdate()
|
||||
@@ -38,21 +34,22 @@ namespace NBF
|
||||
if (isPinched && !moveToTargetDone && targetTransform != null)
|
||||
{
|
||||
pinchElapsedTime += Time.fixedDeltaTime;
|
||||
// transform.position =
|
||||
// Vector3.MoveTowards(transform.position, targetTransform.position, Time.deltaTime * _speed);
|
||||
rb.MovePosition(Vector3.MoveTowards(transform.position, targetTransform.position,
|
||||
Time.deltaTime * _speed));
|
||||
transform.position =
|
||||
Vector3.MoveTowards(transform.position, targetTransform.position, Time.deltaTime * _speed);
|
||||
if (Vector3.Distance(transform.position, targetTransform.position) < 0.1f ||
|
||||
pinchElapsedTime >= maxCatchupDuration)
|
||||
{
|
||||
moveToTargetDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
SyncPosition();
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
// SyncPosition();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
SyncPosition();
|
||||
}
|
||||
@@ -61,7 +58,7 @@ namespace NBF
|
||||
{
|
||||
if (!isPinched) return;
|
||||
if (!moveToTargetDone) return;
|
||||
rb.MovePosition(targetTransform.position);
|
||||
transform.position = targetTransform.position;
|
||||
}
|
||||
|
||||
// 外部调用:开始捏住流程
|
||||
|
||||
@@ -79,6 +79,7 @@ namespace NBF
|
||||
if (PlayerItem.StretchRope)
|
||||
{
|
||||
Line.SetTargetLength(PlayerItem.Tension > 0f ? 0f : PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
Line.SetLureLength(PlayerItem.FloatLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user