This commit is contained in:
Oscar 2024-10-19 15:47:54 +03:00
parent de20b3ba8a
commit 6b3ed6a2f4
4 changed files with 22 additions and 13 deletions

View File

@ -9192,7 +9192,7 @@ MeshCollider:
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
m_Enabled: 0
serializedVersion: 5
m_Convex: 0
m_CookingOptions: 30
@ -9356,6 +9356,14 @@ PrefabInstance:
propertyPath: m_Name
value: SinglePlayer
objectReference: {fileID: 0}
- target: {fileID: 8370227802790125322, guid: 22aace1332feb514b823ccbdd87e8439, type: 3}
propertyPath: runSpeed
value: 200
objectReference: {fileID: 0}
- target: {fileID: 8370227802790125322, guid: 22aace1332feb514b823ccbdd87e8439, type: 3}
propertyPath: walkSpeed
value: 200
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@ -10624,7 +10632,7 @@ MeshCollider:
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
m_Enabled: 0
serializedVersion: 5
m_Convex: 0
m_CookingOptions: 30

View File

@ -29,7 +29,7 @@ namespace Player
if (Cursor.lockState == CursorLockMode.Locked)
{
transform.Rotate(Vector3.up * mouseX);
_camera.transform.localRotation = Quaternion.Euler(_xRotation, 0f, 0f);
_cameraTransform.localRotation = Quaternion.Euler(_xRotation, 0f, 0f);
_cameraTransform.rotation = Quaternion.Euler(_xRotation, transform.eulerAngles.y, 0f);
_cameraTransform.position = targetCameraPosition.position;
}

View File

@ -1,14 +1,11 @@
using Mirror;
using Player.States;
using StateMachine;
using UnityEngine;
namespace Player
{
public class Movement : MonoBehaviour
{
public float walkSpeed = 400f;
public float runSpeed = 1200f;
public float walkSpeed;
public float runSpeed;
public float jumpForce = 160f;
public float groundCheckRadius = 0.14f;
public Transform groundCheck;
@ -25,6 +22,7 @@ namespace Player
playerRigidbody = GetComponent<Rigidbody>();
}
private Vector3 _velocity;
void Update()
{
isGrounded = Physics.CheckSphere(groundCheck.position, groundCheckRadius, groundLayer);
@ -34,11 +32,14 @@ namespace Player
playerRigidbody.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
}
Vector3 velocity = moveDirection * (walkSpeed * Time.deltaTime);
_velocity = moveDirection * (walkSpeed * Time.fixedDeltaTime);
}
private void FixedUpdate()
{
if (Cursor.lockState == CursorLockMode.Locked)
{
playerRigidbody.velocity = new Vector3(velocity.x, playerRigidbody.velocity.y, velocity.z);
playerRigidbody.velocity = new Vector3(_velocity.x, playerRigidbody.velocity.y, _velocity.z);
}
}

View File

@ -103,7 +103,7 @@ PlayerSettings:
xboxEnableFitness: 0
visibleInBackground: 1
allowFullscreenSwitch: 1
fullscreenMode: 0
fullscreenMode: 1
xboxSpeechDB: 0
xboxEnableHeadOrientation: 0
xboxEnableGuest: 0