Adjust JumpPad jumpForce and PlayerController movement settings for improved gameplay dynamics
This commit is contained in:
@@ -127,5 +127,5 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 5de94b384aac49a7baa41967735126b0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Infrastructure.Unity.JumpPadAdapter
|
||||
jumpForce: 18
|
||||
jumpForce: 20
|
||||
jumpVfx: {fileID: 0}
|
||||
|
||||
@@ -157,8 +157,9 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Infrastructure.Unity.PlayerController
|
||||
moveSpeed: 8
|
||||
acceleration: 50
|
||||
maxVelocityChange: 10
|
||||
snapForce: 15
|
||||
useCameraRelativeMovement: 0
|
||||
tileLayer:
|
||||
serializedVersion: 2
|
||||
m_Bits: 8
|
||||
|
||||
@@ -1543,19 +1543,19 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1533471106989954094, guid: 9870f813a82bf15d5b6ac59102c82546, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.89239913
|
||||
value: 0.89559084
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1533471106989954094, guid: 9870f813a82bf15d5b6ac59102c82546, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0.23911765
|
||||
value: 0.23997289
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1533471106989954094, guid: 9870f813a82bf15d5b6ac59102c82546, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0.3696438
|
||||
value: 0.36184213
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1533471106989954094, guid: 9870f813a82bf15d5b6ac59102c82546, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0.09904577
|
||||
value: -0.09695532
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1533471106989954094, guid: 9870f813a82bf15d5b6ac59102c82546, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
@@ -1563,7 +1563,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1533471106989954094, guid: 9870f813a82bf15d5b6ac59102c82546, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 45
|
||||
value: 44
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1533471106989954094, guid: 9870f813a82bf15d5b6ac59102c82546, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
|
||||
@@ -15,6 +15,9 @@ namespace Infrastructure.Unity
|
||||
[SerializeField] private float maxVelocityChange = 10f;
|
||||
[SerializeField] private float snapForce = 15f;
|
||||
|
||||
[Header("Controls")]
|
||||
[SerializeField] private bool useCameraRelativeMovement = true;
|
||||
|
||||
[Header("Interaction")]
|
||||
[SerializeField] private LayerMask tileLayer;
|
||||
[SerializeField] private float groundCheckDistance = 1.5f;
|
||||
@@ -23,6 +26,7 @@ namespace Infrastructure.Unity
|
||||
|
||||
private InputSystem_Actions _actions;
|
||||
private Vector2 _moveInput;
|
||||
private Transform _camTransform;
|
||||
|
||||
public Rigidbody Rigidbody => rb;
|
||||
public StatusManager Status { get; private set; }
|
||||
@@ -48,6 +52,11 @@ namespace Infrastructure.Unity
|
||||
_actions = new InputSystem_Actions();
|
||||
Status = new StatusManager();
|
||||
|
||||
if (Camera.main)
|
||||
{
|
||||
_camTransform = Camera.main.transform;
|
||||
}
|
||||
|
||||
rb.freezeRotation = true;
|
||||
rb.useGravity = true;
|
||||
}
|
||||
@@ -66,20 +75,42 @@ namespace Infrastructure.Unity
|
||||
private void HandleMovement()
|
||||
{
|
||||
var currentSpeed = moveSpeed * Status.CurrentCapabilities.SpeedMultiplier;
|
||||
|
||||
var targetVelocity = Vector3.zero;
|
||||
var snapAxis = Vector3.zero;
|
||||
|
||||
if (_moveInput.sqrMagnitude > 0.1f)
|
||||
Vector3 desiredDirection;
|
||||
|
||||
if (_moveInput.sqrMagnitude < 0.01f)
|
||||
{
|
||||
if (Mathf.Abs(_moveInput.x) > Mathf.Abs(_moveInput.y))
|
||||
desiredDirection = Vector3.zero;
|
||||
}
|
||||
else if (useCameraRelativeMovement && _camTransform)
|
||||
{
|
||||
targetVelocity = new Vector3(_moveInput.x > 0 ? currentSpeed : -currentSpeed, 0, 0);
|
||||
var camForward = _camTransform.forward;
|
||||
var camRight = _camTransform.right;
|
||||
camForward.y = 0;
|
||||
camRight.y = 0;
|
||||
camForward.Normalize();
|
||||
camRight.Normalize();
|
||||
|
||||
desiredDirection = (camForward * _moveInput.y + camRight * _moveInput.x).normalized;
|
||||
}
|
||||
else
|
||||
{
|
||||
desiredDirection = new Vector3(_moveInput.x, 0, _moveInput.y).normalized;
|
||||
}
|
||||
|
||||
|
||||
if (desiredDirection.sqrMagnitude > 0.01f)
|
||||
{
|
||||
if (Mathf.Abs(desiredDirection.x) > Mathf.Abs(desiredDirection.z))
|
||||
{
|
||||
targetVelocity = new Vector3(Mathf.Sign(desiredDirection.x) * currentSpeed, 0, 0);
|
||||
snapAxis = Vector3.forward;
|
||||
}
|
||||
else
|
||||
{
|
||||
targetVelocity = new Vector3(0, 0, _moveInput.y > 0 ? currentSpeed : -currentSpeed);
|
||||
targetVelocity = new Vector3(0, 0, Mathf.Sign(desiredDirection.z) * currentSpeed);
|
||||
snapAxis = Vector3.right;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user