修改捏线逻辑

This commit is contained in:
2026-03-29 17:51:51 +08:00
parent 3c66c316d0
commit bd8918ffe0
5 changed files with 54 additions and 25 deletions

View File

@@ -77,6 +77,8 @@ MonoBehaviour:
waterSampleStep: 2
waterInterpolate: 1
waterUpdateEvery: 1
waterLiftStrength: 0.25
keepStartAdjacentNodeFollow: 1
waterPostConstraintIterations: 2
renderSubdivisionsIdle: 6
renderSubdivisionsMoving: 2
@@ -209,7 +211,7 @@ GameObject:
- component: {fileID: 135844594273256032}
- component: {fileID: 1923684598771359451}
- component: {fileID: 2475726686148443307}
m_Layer: 7
m_Layer: 15
m_Name: Lure
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -494,7 +496,7 @@ GameObject:
- component: {fileID: 153691655494134957}
- component: {fileID: 2717383850592950062}
- component: {fileID: 6678694395924494533}
m_Layer: 16
m_Layer: 15
m_Name: Float
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -672,6 +674,9 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::BobberPresentationController
fallbackWaterLevel: 0
waterRenderer: {fileID: 0}
waterCollisionLayer: 1
waterQueryObjectWidth: 0.5
waterProviderBehaviour: {fileID: 114112904742580403}
enterWaterDepth: 0.002
exitWaterDepth: -0.01
@@ -699,10 +704,14 @@ MonoBehaviour:
planarTiltThreshold: 0.3
planarDominanceMultiplier: 1.2
postureHysteresis: 0.04
postureConfirmTime: 0.08
postureSwitchCooldown: 0.1
tiltedAngle: 38
lyingAngle: 88
uprightMaxTiltAngle: 8
planarTiltFactor: 120
planarDirectionDeadZone: 0.01
planarDirectionLerpSpeed: 10
rotationLerpSpeed: 8
debugResetKey: 1
debugTapKey: 1
@@ -710,6 +719,8 @@ MonoBehaviour:
debugLiftKey: 1
debugBlackDriftKey: 1
drawDebug: 1
UseTestPosture: 0
TestPosture: 0
--- !u!1 &1933124697579601
GameObject:
m_ObjectHideFlags: 0
@@ -787,6 +798,8 @@ MonoBehaviour:
waterSampleStep: 2
waterInterpolate: 1
waterUpdateEvery: 1
waterLiftStrength: 0.25
keepStartAdjacentNodeFollow: 1
waterPostConstraintIterations: 2
renderSubdivisionsIdle: 6
renderSubdivisionsMoving: 2

View File

@@ -1,3 +1,4 @@
using System;
using UnityEngine;
namespace NBF
@@ -14,8 +15,11 @@ namespace NBF
private Rigidbody rb;
private float maxCatchupDuration = 0.5f;
private Transform targetTransform;
private float originalSpring;
private float pinchElapsedTime;
public bool isPinched { get; private set; }
@@ -31,27 +35,37 @@ namespace NBF
void FixedUpdate()
{
if (isPinched && targetTransform != null)
if (isPinched && !moveToTargetDone && targetTransform != null)
{
transform.position =
Vector3.MoveTowards(transform.position, targetTransform.position, Time.deltaTime * _speed);
if (!moveToTargetDone)
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));
if (Vector3.Distance(transform.position, targetTransform.position) < 0.1f ||
pinchElapsedTime >= maxCatchupDuration)
{
if (Vector3.Distance(transform.position, targetTransform.position) < 0.1f)
{
moveToTargetDone = true;
}
}
if (moveToTargetDone)
{
transform.position = targetTransform.position;
moveToTargetDone = true;
}
}
SyncPosition();
}
private void LateUpdate()
{
SyncPosition();
}
private void SyncPosition()
{
if (!isPinched) return;
if (!moveToTargetDone) return;
rb.MovePosition(targetTransform.position);
}
// 外部调用:开始捏住流程
public void StartPinch(Transform fingerTransform, float speed = 3)
public void StartPinch(Transform fingerTransform, float speed = 3, float _maxCatchupDuration = 0.3f)
{
_speed = speed;
Rigidbody fingerRb = fingerTransform.GetComponent<Rigidbody>();
@@ -61,6 +75,8 @@ namespace NBF
return;
}
maxCatchupDuration = _maxCatchupDuration;
pinchElapsedTime = 0f;
isPinched = true;
rb.useGravity = false;
rb.isKinematic = true;

View File

@@ -56,7 +56,7 @@ Material:
- _Crest_CausticsDepthOfField: 6
- _Crest_CausticsDistortionScale: 250
- _Crest_CausticsDistortionStrength: 0.16
- _Crest_CausticsEnabled: 0
- _Crest_CausticsEnabled: 1
- _Crest_CausticsFocalDepth: 2
- _Crest_CausticsMotionBlur: 1
- _Crest_CausticsScrollSpeed: 1
@@ -71,7 +71,7 @@ Material:
- _Crest_ShadowsAffectsAmbientFactor: 0.5
- _Crest_SunBoost: 2
m_Colors:
- _Crest_AbsorptionColor: {r: 0, g: 0, b: 0, a: 0.1019608}
- _Crest_Scattering: {r: 0, g: 0, b: 0, a: 1}
- _Crest_AbsorptionColor: {r: 0.34162676, g: 0.6954546, b: 0.85, a: 0.1019608}
- _Crest_Scattering: {r: 0, g: 0.09803919, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -17,7 +17,7 @@ PhysicsManager:
m_EnableAdaptiveForce: 0
m_ClothInterCollisionDistance: 0.1
m_ClothInterCollisionStiffness: 0.2
m_LayerCollisionMatrix: efffffffefffffffefffffffefffffffc020bbffefffffffffffffffffffffffefffffffefffffffefffffffefffffffefffffffffffffffefffffffefffffffffffffffffffffffefffffffffffffffffffffffffffffffefffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix: efffffffefffffffefffffffefffffffc020bbffefffffffffffffffffffffffefffffffefffffffefffffffefffffffefffffffffffffffef7fffffef3ff3ffffffffffffffffffef7fffffff7fffffffffffffffffffffefffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_SimulationMode: 0
m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 1

View File

@@ -33,13 +33,13 @@ TagManager:
-
-
- WaterMask
- PW_VFX
- PW_Object_Small
- PW_Object_Medium
- PW_Object_Large
-
-
-
-
-
- Player
- Interactive
- Gear
-
-
- Boat