建置測試環境和玩家動作
This commit is contained in:
1 parent
50c43661c5
commit
edf490192e
16 files changed
+2310
-463
No files matched your search
@@ -193,7 +193,7 @@
|
||||
{
|
||||
"name": "",
|
||||
"id": "32270217-c493-45d1-8f18-6d7e8d0fb7f3",
|
||||
"path": "<Keyboard>/ctrl",
|
||||
"path": "<Keyboard>/leftShift",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
|
||||
@@ -31,15 +31,17 @@ namespace CharacterMovement
|
||||
return;
|
||||
}
|
||||
|
||||
if (_playerController.IsGrounded())
|
||||
_playerController.Move(Vector3.zero, deltaTime);
|
||||
|
||||
// [Mouse Trail Collector 修改] 原本先 Move(zero) 再切到 MovingState,
|
||||
// 落地時會在 Idle 停留一個物理步並減速,造成「落地卡一下」。改成有移動輸入就直接切換,不減速。
|
||||
if (_playerController.CanMove && _playerController.InputSource.IsMoving && _playerController.IsGrounded())
|
||||
{
|
||||
_playerController.SwitchState(new MovingState(_playerController));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_playerController.IsGrounded())
|
||||
_playerController.Move(Vector3.zero, deltaTime);
|
||||
|
||||
RaycastHit? slopeHit = _playerController.OnSlope();
|
||||
if (!slopeHit.HasValue)
|
||||
return;
|
||||
|
||||
@@ -39,6 +39,16 @@ namespace CharacterMovement
|
||||
return;
|
||||
}
|
||||
|
||||
// [Mouse Trail Collector 修改] 滑鏟中可以跳 (類似 Apex 的滑鏟跳)。
|
||||
// 滑鏟時姿勢其實還是「站著」,只是膠囊暫時變矮,所以先把高度恢復再起跳;
|
||||
// JumpingState 會保留目前的水平速度,滑鏟的速度會帶進空中。
|
||||
if (_playerController.HasBufferedJumpIntent && _playerController.CanStartJump())
|
||||
{
|
||||
_playerController.SetTemporaryCapsuleHeight(_playerController.OriginalCapsuleHeight);
|
||||
if (_playerController.TryConsumeBufferedJump())
|
||||
return;
|
||||
}
|
||||
|
||||
_elapsedTime += deltaTime;
|
||||
float normalized = Mathf.Clamp01(_elapsedTime / Mathf.Max(0.01f, _playerController.SlideDuration));
|
||||
Vector3 inputDirection = _playerController.CalculateMovement();
|
||||
|
||||
@@ -153,6 +153,12 @@ namespace CharacterMovement
|
||||
Vector3 center = rootPosition + GetCapsuleCenterForHeight(targetHeight);
|
||||
Vector3 top = center + Vector3.up * segment;
|
||||
Vector3 bottom = center - Vector3.up * segment;
|
||||
|
||||
// [Mouse Trail Collector 修改] 原本檢查用的膠囊底部剛好貼著地面,角色只要稍微陷進地板
|
||||
// (落地、Ground Stick Force) 就會撞到地板本身,被判定「頭上有東西」而站不起來,卡在蹲姿。
|
||||
// 這裡只是要確認頭頂有沒有空間,所以把底部往上抬一點,不去碰腳下的地板。
|
||||
const float FloorLift = 0.1f;
|
||||
bottom = Vector3.MoveTowards(bottom, top, FloorLift);
|
||||
LayerMask mask = GroundLayerMask | StairsLayerMask;
|
||||
int hitCount = Physics.OverlapCapsuleNonAlloc(
|
||||
bottom,
|
||||
|
||||
Reference in new issue
Block a user