Everything else???
This commit is contained in:
@@ -24,10 +24,10 @@ public class FirstPersonController : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
Debug.Log("Starting game");
|
||||
|
||||
|
||||
// FORCE NORMAL TIME (in case something external changed it)
|
||||
Time.timeScale = 1f;
|
||||
|
||||
|
||||
controller = GetComponent<CharacterController>();
|
||||
|
||||
if (controller == null)
|
||||
@@ -56,9 +56,9 @@ public class FirstPersonController : MonoBehaviour
|
||||
float moveX = 0f;
|
||||
float moveZ = 0f;
|
||||
|
||||
if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow)) moveZ += 1f;
|
||||
if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow)) moveZ -= 1f;
|
||||
if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow)) moveX -= 1f;
|
||||
if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow)) moveZ += 1f;
|
||||
if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow)) moveZ -= 1f;
|
||||
if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow)) moveX -= 1f;
|
||||
if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow)) moveX += 1f;
|
||||
|
||||
// DEBUG: Log once when W is first pressed
|
||||
@@ -74,19 +74,19 @@ public class FirstPersonController : MonoBehaviour
|
||||
move.Normalize();
|
||||
|
||||
float currentSpeed = Input.GetKey(KeyCode.LeftShift) ? runSpeed : walkSpeed;
|
||||
|
||||
|
||||
Vector3 posBefore = transform.position;
|
||||
controller.Move(move * currentSpeed * Time.deltaTime);
|
||||
|
||||
|
||||
// DEBUG: Log if we tried to move but didn't
|
||||
if (move.magnitude > 0f && Input.GetKeyDown(KeyCode.W))
|
||||
{
|
||||
Vector3 posAfter = transform.position;
|
||||
Debug.Log($"[FPC DEBUG] Move attempt: delta={move * currentSpeed * Time.deltaTime} | actualDelta={(posAfter - posBefore)} | controller.height={controller.height} | controller.radius={controller.radius}");
|
||||
|
||||
//Debug.Log($"[FPC DEBUG] Move attempt: delta={move * currentSpeed * Time.deltaTime} | actualDelta={(posAfter - posBefore)} | controller.height={controller.height} | controller.radius={controller.radius}");
|
||||
|
||||
// Check what we're colliding with
|
||||
Collider[] nearbyColliders = Physics.OverlapSphere(transform.position, controller.radius + 0.5f);
|
||||
Debug.Log($"[FPC DEBUG] Found {nearbyColliders.Length} colliders near player");
|
||||
//Debug.Log($"[FPC DEBUG] Found {nearbyColliders.Length} colliders near player");
|
||||
foreach (Collider col in nearbyColliders)
|
||||
{
|
||||
if (col != controller && !(col is CharacterController))
|
||||
|
||||
Reference in New Issue
Block a user