feat: player movement
This commit is contained in:
8
Assets/Code/Scripts/Player.meta
Normal file
8
Assets/Code/Scripts/Player.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35fd21e5cd1e88f45ac493add1565094
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
38
Assets/Code/Scripts/Player/InputSystem.inputsettings.asset
Normal file
38
Assets/Code/Scripts/Player/InputSystem.inputsettings.asset
Normal file
@@ -0,0 +1,38 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c46f07b5ed07e4e92aa78254188d3d10, type: 3}
|
||||
m_Name: InputSystem.inputsettings
|
||||
m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.InputSettings
|
||||
m_SupportedDevices: []
|
||||
m_UpdateMode: 1
|
||||
m_ScrollDeltaBehavior: 0
|
||||
m_MaxEventBytesPerUpdate: 5242880
|
||||
m_MaxQueuedEventsPerUpdate: 1000
|
||||
m_CompensateForScreenOrientation: 1
|
||||
m_BackgroundBehavior: 0
|
||||
m_EditorInputBehaviorInPlayMode: 0
|
||||
m_InputActionPropertyDrawerMode: 0
|
||||
m_DefaultDeadzoneMin: 0.125
|
||||
m_DefaultDeadzoneMax: 0.925
|
||||
m_DefaultButtonPressPoint: 0.5
|
||||
m_ButtonReleaseThreshold: 0.75
|
||||
m_DefaultTapTime: 0.2
|
||||
m_DefaultSlowTapTime: 0.5
|
||||
m_DefaultHoldTime: 0.4
|
||||
m_TapRadius: 5
|
||||
m_MultiTapDelayTime: 0.75
|
||||
m_DisableRedundantEventsMerging: 0
|
||||
m_ShortcutKeysConsumeInputs: 0
|
||||
m_iOSSettings:
|
||||
m_MotionUsage:
|
||||
m_Enabled: 0
|
||||
m_Description:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23cbff887a25b3802a937fef9deab3ec
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1118
Assets/Code/Scripts/Player/InputSystem_Actions.inputactions
Normal file
1118
Assets/Code/Scripts/Player/InputSystem_Actions.inputactions
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b319948d6750538498f201a24c05aef3
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
|
||||
generateWrapperCode: 0
|
||||
wrapperCodePath:
|
||||
wrapperClassName:
|
||||
wrapperCodeNamespace:
|
||||
6
Assets/Code/Scripts/Player/PlayerAnimation.cs
Normal file
6
Assets/Code/Scripts/Player/PlayerAnimation.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerAnimation
|
||||
{
|
||||
|
||||
}
|
||||
2
Assets/Code/Scripts/Player/PlayerAnimation.cs.meta
Normal file
2
Assets/Code/Scripts/Player/PlayerAnimation.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c207b98ba2f6229b84db151dd7b4255
|
||||
97
Assets/Code/Scripts/Player/PlayerHeadControll.cs
Normal file
97
Assets/Code/Scripts/Player/PlayerHeadControll.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerHeadController : MonoBehaviour
|
||||
{
|
||||
public Transform Head;
|
||||
public Transform CameraTransform;
|
||||
|
||||
public float ThrowForce = 10f;
|
||||
public float PickupDistance = 3f;
|
||||
|
||||
public bool isHoldingHead = true;
|
||||
|
||||
private Rigidbody m_headRigidbody;
|
||||
|
||||
private Vector3 m_headInitialLocalPos;
|
||||
private Quaternion m_headInitialLocalRot;
|
||||
|
||||
private Animator animator;
|
||||
private PlayerInputController input;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
input = GetComponent<PlayerInputController>();
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
|
||||
m_headInitialLocalPos = Head.localPosition;
|
||||
m_headInitialLocalRot = Head.localRotation;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (input.ThrowPressed)
|
||||
{
|
||||
ThrowHead();
|
||||
}
|
||||
|
||||
if (input.PickupPressed)
|
||||
{
|
||||
TryPickupHead();
|
||||
}
|
||||
}
|
||||
|
||||
private void ThrowHead()
|
||||
{
|
||||
if (!isHoldingHead)
|
||||
return;
|
||||
|
||||
animator.SetTrigger("Throw");
|
||||
|
||||
isHoldingHead = false;
|
||||
|
||||
Head.SetParent(null);
|
||||
|
||||
m_headRigidbody = Head.gameObject.AddComponent<Rigidbody>();
|
||||
m_headRigidbody.mass = 1f;
|
||||
|
||||
m_headRigidbody.constraints =
|
||||
RigidbodyConstraints.FreezeRotationX |
|
||||
RigidbodyConstraints.FreezeRotationZ |
|
||||
RigidbodyConstraints.FreezeRotationY;
|
||||
|
||||
m_headRigidbody.AddForce(CameraTransform.forward * ThrowForce, ForceMode.Impulse);
|
||||
}
|
||||
|
||||
private void TryPickupHead()
|
||||
{
|
||||
if (isHoldingHead)
|
||||
return;
|
||||
|
||||
float distance = Vector3.Distance(transform.position, Head.position);
|
||||
|
||||
if (distance <= PickupDistance)
|
||||
{
|
||||
PickupHead();
|
||||
}
|
||||
}
|
||||
|
||||
private void PickupHead()
|
||||
{
|
||||
isHoldingHead = true;
|
||||
|
||||
if (m_headRigidbody != null)
|
||||
{
|
||||
Destroy(m_headRigidbody);
|
||||
}
|
||||
|
||||
Head.SetParent(transform);
|
||||
|
||||
Head.localPosition = m_headInitialLocalPos;
|
||||
Head.localRotation = m_headInitialLocalRot;
|
||||
}
|
||||
}
|
||||
2
Assets/Code/Scripts/Player/PlayerHeadControll.cs.meta
Normal file
2
Assets/Code/Scripts/Player/PlayerHeadControll.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2da51dfecccc45b469912e3bb3f1953b
|
||||
56
Assets/Code/Scripts/Player/PlayerInputHandler.cs
Normal file
56
Assets/Code/Scripts/Player/PlayerInputHandler.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.Windows;
|
||||
|
||||
public class PlayerInputController : MonoBehaviour
|
||||
{
|
||||
public InputActionAsset InputActions;
|
||||
|
||||
private InputAction m_moveAction;
|
||||
private InputAction m_lookAction;
|
||||
private InputAction m_jumpAction;
|
||||
private InputAction m_throwAction;
|
||||
private InputAction m_pickupAction;
|
||||
private InputAction m_shiftAction;
|
||||
|
||||
public Vector2 MoveAmount { get; private set; }
|
||||
public Vector2 LookAmount { get; private set; }
|
||||
|
||||
public bool JumpPressed { get; private set; }
|
||||
public bool ShiftPressed { get; private set; }
|
||||
public bool ThrowPressed { get; private set; }
|
||||
public bool PickupPressed { get; private set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
var map = InputActions.FindActionMap("Player");
|
||||
|
||||
m_moveAction = map.FindAction("Move");
|
||||
m_lookAction = map.FindAction("Look");
|
||||
m_jumpAction = map.FindAction("Jump");
|
||||
m_shiftAction = map.FindAction("Shift");
|
||||
m_throwAction = map.FindAction("Throw");
|
||||
m_pickupAction = map.FindAction("Pickup");
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
InputActions.FindActionMap("Player").Enable();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
InputActions.FindActionMap("Player").Disable();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
MoveAmount = m_moveAction.ReadValue<Vector2>();
|
||||
LookAmount = m_lookAction.ReadValue<Vector2>();
|
||||
|
||||
ShiftPressed = m_shiftAction.IsPressed();
|
||||
JumpPressed = m_jumpAction.WasPressedThisFrame();
|
||||
ThrowPressed = m_throwAction.WasPressedThisFrame();
|
||||
PickupPressed = m_pickupAction.WasPressedThisFrame();
|
||||
}
|
||||
}
|
||||
2
Assets/Code/Scripts/Player/PlayerInputHandler.cs.meta
Normal file
2
Assets/Code/Scripts/Player/PlayerInputHandler.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d8f349ed7dc088a4a6e2690ee87094a
|
||||
34
Assets/Code/Scripts/Player/PlayerJump.cs
Normal file
34
Assets/Code/Scripts/Player/PlayerJump.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerJump : MonoBehaviour
|
||||
{
|
||||
public float JumpForce = 5;
|
||||
|
||||
public Transform GroundCheck;
|
||||
public float GroundCheckRadius = 0.2f;
|
||||
|
||||
private Rigidbody m_rigidbody;
|
||||
private PlayerInputController input;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_rigidbody = GetComponent<Rigidbody>();
|
||||
input = GetComponent<PlayerInputController>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (input.JumpPressed)
|
||||
{
|
||||
Jump();
|
||||
}
|
||||
}
|
||||
|
||||
public void Jump()
|
||||
{
|
||||
if (Physics.CheckSphere(GroundCheck.position, GroundCheckRadius, LayerMask.GetMask("Ground")))
|
||||
{
|
||||
m_rigidbody.AddForce(Vector3.up * JumpForce, ForceMode.Impulse);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Code/Scripts/Player/PlayerJump.cs.meta
Normal file
2
Assets/Code/Scripts/Player/PlayerJump.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c524d12bc1668e42a00cbd8050107f6
|
||||
57
Assets/Code/Scripts/Player/PlayerLook.cs
Normal file
57
Assets/Code/Scripts/Player/PlayerLook.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerLook : MonoBehaviour
|
||||
{
|
||||
public Transform CameraTransform;
|
||||
public Transform Head;
|
||||
|
||||
public float RotateSpeed = 5;
|
||||
public float MaxLookAngle = 90f;
|
||||
|
||||
private float m_verticalRotation = 0f;
|
||||
|
||||
private Rigidbody m_rigidbody;
|
||||
private PlayerInputController input;
|
||||
private PlayerHeadController headController;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_rigidbody = GetComponent<Rigidbody>();
|
||||
input = GetComponent<PlayerInputController>();
|
||||
headController = GetComponent<PlayerHeadController>();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
Vector2 m_lookAmt = input.LookAmount;
|
||||
|
||||
if (m_lookAmt.magnitude <= 0.01f)
|
||||
return;
|
||||
|
||||
if (!headController.isHoldingHead || input.ShiftPressed && headController.isHoldingHead)
|
||||
{
|
||||
float headRotation = m_lookAmt.x * RotateSpeed * Time.deltaTime;
|
||||
Head.Rotate(0, headRotation, 0);
|
||||
|
||||
if (CameraTransform != null)
|
||||
{
|
||||
m_verticalRotation -= m_lookAmt.y * RotateSpeed * Time.deltaTime;
|
||||
m_verticalRotation = Mathf.Clamp(m_verticalRotation, -MaxLookAngle, MaxLookAngle);
|
||||
CameraTransform.localRotation = Quaternion.Euler(m_verticalRotation, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float horizontalRotation = m_lookAmt.x * RotateSpeed * Time.deltaTime;
|
||||
Quaternion deltaRotation = Quaternion.Euler(0, horizontalRotation, 0);
|
||||
m_rigidbody.MoveRotation(m_rigidbody.rotation * deltaRotation);
|
||||
|
||||
if (CameraTransform != null)
|
||||
{
|
||||
m_verticalRotation -= m_lookAmt.y * RotateSpeed * Time.deltaTime;
|
||||
m_verticalRotation = Mathf.Clamp(m_verticalRotation, -MaxLookAngle, MaxLookAngle);
|
||||
CameraTransform.localRotation = Quaternion.Euler(m_verticalRotation, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Code/Scripts/Player/PlayerLook.cs.meta
Normal file
2
Assets/Code/Scripts/Player/PlayerLook.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c1ddada0161b8c4783806ef6775348a
|
||||
74
Assets/Code/Scripts/Player/PlayerMovement.cs
Normal file
74
Assets/Code/Scripts/Player/PlayerMovement.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerMovement : MonoBehaviour
|
||||
{
|
||||
public float WalkSpeed = 10;
|
||||
public float rotationSpeed = 10f;
|
||||
|
||||
public Animator animator;
|
||||
public Transform cameraTransform;
|
||||
|
||||
private Rigidbody m_rigidbody;
|
||||
private PlayerInputController input;
|
||||
private PlayerHeadController headController;
|
||||
|
||||
private Vector3 moveDirection;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_rigidbody = GetComponent<Rigidbody>();
|
||||
input = GetComponent<PlayerInputController>();
|
||||
animator = GetComponent<Animator>();
|
||||
headController = GetComponent<PlayerHeadController>();
|
||||
|
||||
if (m_rigidbody != null)
|
||||
{
|
||||
m_rigidbody.freezeRotation = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
Vector2 m_moveAmt = input.MoveAmount;
|
||||
|
||||
float horizontal = m_moveAmt.x;
|
||||
float vertical = m_moveAmt.y;
|
||||
|
||||
Vector3 cameraForward = cameraTransform.forward;
|
||||
Vector3 cameraRight = cameraTransform.right;
|
||||
|
||||
cameraForward.y = 0f;
|
||||
cameraRight.y = 0f;
|
||||
|
||||
cameraForward.Normalize();
|
||||
cameraRight.Normalize();
|
||||
|
||||
moveDirection = (cameraForward * vertical + cameraRight * horizontal).normalized;
|
||||
|
||||
if (headController.isHoldingHead)
|
||||
{
|
||||
m_rigidbody.MovePosition(
|
||||
m_rigidbody.position + Time.deltaTime * WalkSpeed * moveDirection
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (moveDirection.magnitude >= 0.1f)
|
||||
{
|
||||
m_rigidbody.MovePosition(
|
||||
m_rigidbody.position + Time.deltaTime * WalkSpeed * moveDirection
|
||||
);
|
||||
|
||||
Quaternion targetRotation = Quaternion.LookRotation(moveDirection);
|
||||
transform.rotation = Quaternion.Slerp(
|
||||
transform.rotation,
|
||||
targetRotation,
|
||||
rotationSpeed * Time.deltaTime
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
bool isMoving = m_moveAmt.magnitude > 0.1f;
|
||||
animator.SetBool("isWalking", isMoving);
|
||||
}
|
||||
}
|
||||
2
Assets/Code/Scripts/Player/PlayerMovement.cs.meta
Normal file
2
Assets/Code/Scripts/Player/PlayerMovement.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f91586e8c2742341aa8f6925e597bf1
|
||||
216
Assets/Code/Scripts/Player/test.cs
Normal file
216
Assets/Code/Scripts/Player/test.cs
Normal file
@@ -0,0 +1,216 @@
|
||||
//using TMPro;
|
||||
//using UnityEngine;
|
||||
//using UnityEngine.InputSystem;
|
||||
|
||||
//public class PlayerMovement : MonoBehaviour
|
||||
//{
|
||||
// public InputActionAsset InputActions;
|
||||
|
||||
// private InputAction m_moveAction;
|
||||
// private InputAction m_lookAction;
|
||||
// private InputAction m_jumpAction;
|
||||
// private InputAction m_throwAction;
|
||||
// private InputAction m_pickupAction;
|
||||
|
||||
// private Vector2 m_moveAmt;
|
||||
// private Vector2 m_lookAmt;
|
||||
|
||||
// private Rigidbody m_rigidbody;
|
||||
|
||||
// [Header("Camera/Head")]
|
||||
// public Transform CameraTransform;
|
||||
// public float MaxLookAngle = 90f;
|
||||
|
||||
// private float m_verticalRotation = 0f;
|
||||
|
||||
// public float WalkSpeed = 10;
|
||||
// public float RotateSpeed = 5;
|
||||
// public float JumpForce = 5;
|
||||
|
||||
// public Transform GroundCheck;
|
||||
// public float GroundCheckRadius = 0.2f;
|
||||
|
||||
// public Animator animator;
|
||||
|
||||
// [Header("Head Settings")]
|
||||
// public Transform Head;
|
||||
// public float ThrowForce = 10f;
|
||||
// public float PickupDistance = 3f;
|
||||
|
||||
// private bool m_isHeadThrown = false;
|
||||
// private Rigidbody m_headRigidbody;
|
||||
|
||||
// private Vector3 m_headInitialLocalPos;
|
||||
// private Quaternion m_headInitialLocalRot;
|
||||
|
||||
// private void Awake()
|
||||
// {
|
||||
// var map = InputActions.FindActionMap("Player");
|
||||
|
||||
// m_moveAction = map.FindAction("Move");
|
||||
// m_lookAction = map.FindAction("Look");
|
||||
// m_jumpAction = map.FindAction("Jump");
|
||||
// m_throwAction = map.FindAction("Throw");
|
||||
// m_pickupAction = map.FindAction("Pickup");
|
||||
|
||||
// m_rigidbody = GetComponent<Rigidbody>();
|
||||
// animator = GetComponent<Animator>();
|
||||
// }
|
||||
|
||||
// private void OnEnable()
|
||||
// {
|
||||
// InputActions.FindActionMap("Player").Enable();
|
||||
// }
|
||||
|
||||
// private void OnDisable()
|
||||
// {
|
||||
// InputActions.FindActionMap("Player").Disable();
|
||||
// }
|
||||
|
||||
// void Start()
|
||||
// {
|
||||
// Cursor.lockState = CursorLockMode.Locked;
|
||||
// m_headInitialLocalPos = Head.localPosition;
|
||||
// m_headInitialLocalRot = Head.localRotation;
|
||||
// }
|
||||
|
||||
// private void Update()
|
||||
// {
|
||||
// m_moveAmt = m_moveAction.ReadValue<Vector2>();
|
||||
// m_lookAmt = m_lookAction.ReadValue<Vector2>();
|
||||
|
||||
// if (m_jumpAction.WasPressedThisFrame())
|
||||
// {
|
||||
// Jump();
|
||||
// }
|
||||
|
||||
// if (m_throwAction.WasPressedThisFrame())
|
||||
// {
|
||||
// ThrowHead();
|
||||
// }
|
||||
|
||||
// if (m_pickupAction.WasPressedThisFrame())
|
||||
// {
|
||||
// TryPickupHead();
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// private void FixedUpdate()
|
||||
// {
|
||||
// Walking();
|
||||
// Rotating();
|
||||
// }
|
||||
|
||||
// private void Walking()
|
||||
// {
|
||||
// Vector3 move =
|
||||
// transform.forward * m_moveAmt.y +
|
||||
// transform.right * m_moveAmt.x;
|
||||
|
||||
// m_rigidbody.MovePosition(
|
||||
// m_rigidbody.position + move * WalkSpeed * Time.deltaTime
|
||||
// );
|
||||
|
||||
// bool isMoving = m_moveAmt.magnitude > 0.1f;
|
||||
// animator.SetBool("isWalking", isMoving);
|
||||
// }
|
||||
|
||||
|
||||
// private void Rotating()
|
||||
// {
|
||||
// if (m_lookAmt.magnitude <= 0.01f)
|
||||
// return;
|
||||
|
||||
// if (!m_isHeadThrown)
|
||||
// {
|
||||
// NORMAL BODY ROTATION
|
||||
// float horizontalRotation = m_lookAmt.x * RotateSpeed * Time.deltaTime;
|
||||
// Quaternion deltaRotation = Quaternion.Euler(0, horizontalRotation, 0);
|
||||
// m_rigidbody.MoveRotation(m_rigidbody.rotation * deltaRotation);
|
||||
|
||||
// if (CameraTransform != null)
|
||||
// {
|
||||
// m_verticalRotation -= m_lookAmt.y * RotateSpeed * Time.deltaTime;
|
||||
// m_verticalRotation = Mathf.Clamp(m_verticalRotation, -MaxLookAngle, MaxLookAngle);
|
||||
// CameraTransform.localRotation = Quaternion.Euler(m_verticalRotation, 0, 0);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// HEAD ROTATION ON GROUND
|
||||
// float headRotation = m_lookAmt.x * RotateSpeed * Time.deltaTime;
|
||||
// Head.Rotate(0, headRotation, 0);
|
||||
|
||||
// Add vertical camera rotation when head is on ground
|
||||
// if (CameraTransform != null)
|
||||
// {
|
||||
// m_verticalRotation -= m_lookAmt.y * RotateSpeed * Time.deltaTime;
|
||||
// m_verticalRotation = Mathf.Clamp(m_verticalRotation, -MaxLookAngle, MaxLookAngle);
|
||||
// CameraTransform.localRotation = Quaternion.Euler(m_verticalRotation, 0, 0);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// public void Jump()
|
||||
// {
|
||||
// if (Physics.CheckSphere(GroundCheck.position, GroundCheckRadius, LayerMask.GetMask("Ground")))
|
||||
// {
|
||||
// m_rigidbody.AddForce(Vector3.up * JumpForce, ForceMode.Impulse);
|
||||
// }
|
||||
// }
|
||||
|
||||
// private void ThrowHead()
|
||||
// {
|
||||
// if (m_isHeadThrown)
|
||||
// return;
|
||||
|
||||
// animator.SetTrigger("Throw");
|
||||
|
||||
// m_isHeadThrown = true;
|
||||
|
||||
// Head.SetParent(null);
|
||||
|
||||
// m_headRigidbody = Head.gameObject.AddComponent<Rigidbody>();
|
||||
// m_headRigidbody.mass = 1f;
|
||||
|
||||
// m_headRigidbody.constraints =
|
||||
// RigidbodyConstraints.FreezeRotationX |
|
||||
// RigidbodyConstraints.FreezeRotationZ;
|
||||
|
||||
// m_headRigidbody.AddForce(CameraTransform.forward * ThrowForce, ForceMode.Impulse);
|
||||
// }
|
||||
|
||||
// private void TryPickupHead()
|
||||
// {
|
||||
// if (!m_isHeadThrown)
|
||||
// return;
|
||||
|
||||
// float distance = Vector3.Distance(transform.position, Head.position);
|
||||
|
||||
// if (distance <= PickupDistance)
|
||||
// {
|
||||
// PickupHead();
|
||||
// }
|
||||
// }
|
||||
|
||||
// private void PickupHead()
|
||||
// {
|
||||
// m_isHeadThrown = false;
|
||||
|
||||
// Remove Rigidbody
|
||||
// if (m_headRigidbody != null)
|
||||
// {
|
||||
// Destroy(m_headRigidbody);
|
||||
// }
|
||||
|
||||
// Reattach to player
|
||||
// Head.SetParent(transform);
|
||||
|
||||
// Reset position & rotation
|
||||
// Head.localPosition = m_headInitialLocalPos;
|
||||
// Head.localRotation = m_headInitialLocalRot;
|
||||
// }
|
||||
|
||||
|
||||
//}
|
||||
2
Assets/Code/Scripts/Player/test.cs.meta
Normal file
2
Assets/Code/Scripts/Player/test.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85fce5e45a2682243a133de9ba0a4324
|
||||
Reference in New Issue
Block a user