Test追加
This commit is contained in:
@@ -148,6 +148,9 @@ MonoBehaviour:
|
||||
highQualityFiltering:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
filter:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
downscale:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
|
||||
2097
Assets/Scenes/Test.unity
Normal file
2097
Assets/Scenes/Test.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/Test.unity.meta
Normal file
7
Assets/Scenes/Test.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef443f0333a244a26b06718135d3c98f
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts.meta
Normal file
8
Assets/Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad75f0386e7324b2a933f1102e309c8d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
39
Assets/Scripts/PlayerMove.cs
Normal file
39
Assets/Scripts/PlayerMove.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerMove : MonoBehaviour
|
||||
{
|
||||
// パラメータ
|
||||
public float moveSpeed = 5f; // 移動速度
|
||||
public float gravity = -9.8f; // 重力加速度
|
||||
public CharacterController controller; // 移動に使うCharacterController
|
||||
|
||||
// 演算用変数
|
||||
private Vector3 velocity; // 加速度を保持する変数
|
||||
private bool isGrounded; // 地面に着地しているかどうかのフラグ変数
|
||||
|
||||
// ゲーム中実行されるUpdate関数
|
||||
void Update()
|
||||
{
|
||||
// 着地状態のチェック
|
||||
isGrounded = controller.isGrounded;
|
||||
|
||||
// 着地している場合は落下速度をリセット
|
||||
if (isGrounded && velocity.y < 0)
|
||||
{
|
||||
velocity.y = -2f; // 地面に着いた場合、速度をリセット
|
||||
}
|
||||
|
||||
// 入力の取得
|
||||
float h = Input.GetAxis("Horizontal");
|
||||
float v = Input.GetAxis("Vertical");
|
||||
|
||||
// ローカル座標をワールド座標に変換して移動方向を計算
|
||||
Vector3 moveDirection = transform.TransformDirection(new Vector3(h, 0, v)) * moveSpeed;
|
||||
|
||||
// 重力を加算
|
||||
velocity.y += gravity * Time.deltaTime;
|
||||
|
||||
// 移動と重力を一度のcontroller.Moveで処理
|
||||
controller.Move((moveDirection + velocity) * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/PlayerMove.cs.meta
Normal file
2
Assets/Scripts/PlayerMove.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c101f16cf16d4195ba45ae89a7f14d8
|
||||
37
Assets/Scripts/PlayerPOV.cs
Normal file
37
Assets/Scripts/PlayerPOV.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerPOV : MonoBehaviour
|
||||
{
|
||||
// パラメータ
|
||||
public Transform neck; // プレイヤーの首のTransformを指定
|
||||
public float sensitivity = 2.0f; // マウス感度(視点の移動の速さを調整)
|
||||
public float minVertical = -90.0f; // 視点の最小角度(縦の回転制限)
|
||||
public float maxVertical = 90.0f; // 視点の最大角度(縦の回転制限)
|
||||
|
||||
// 演算用変数
|
||||
private float rotationX = 0f; // 縦方向の回転角度(首の回転)
|
||||
|
||||
// ゲーム開始時に呼ばれる
|
||||
void Start()
|
||||
{
|
||||
// カーソルを非表示&ロック
|
||||
Cursor.lockState = CursorLockMode.Locked; // カーソルを画面中央に固定
|
||||
Cursor.visible = false; // カーソルを非表示にする
|
||||
}
|
||||
|
||||
// 毎フレーム実行される
|
||||
void Update()
|
||||
{
|
||||
// マウス入力の取得
|
||||
float mouseX = Input.GetAxis("Mouse X") * sensitivity; // 横のマウス移動量を取得し、感度で調整
|
||||
float mouseY = Input.GetAxis("Mouse Y") * sensitivity; // 縦のマウス移動量を取得し、感度で調整
|
||||
|
||||
// Player(体)の回転(左右)
|
||||
transform.Rotate(0, mouseX, 0); // プレイヤー(体)の左右の回転をマウスX方向の入力に合わせて行う
|
||||
|
||||
// Neck(首)の回転(上下)
|
||||
rotationX -= mouseY; // マウスY方向の入力によって縦方向の回転を更新
|
||||
rotationX = Mathf.Clamp(rotationX, minVertical, maxVertical); // 回転角度を指定された範囲に制限
|
||||
neck.localRotation = Quaternion.Euler(rotationX, 0, 0); // 首の回転を設定。縦方向のみ回転させる
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/PlayerPOV.cs.meta
Normal file
2
Assets/Scripts/PlayerPOV.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20e0bce59a58a401ca841697d32fb339
|
||||
@@ -12,8 +12,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3}
|
||||
m_Name: Quality URP Config
|
||||
m_EditorClassIdentifier:
|
||||
k_AssetVersion: 12
|
||||
k_AssetPreviousVersion: 12
|
||||
k_AssetVersion: 13
|
||||
k_AssetPreviousVersion: 13
|
||||
m_RendererType: 1
|
||||
m_RendererData: {fileID: 0}
|
||||
m_RendererDataList:
|
||||
@@ -53,6 +53,7 @@ MonoBehaviour:
|
||||
m_AdditionalLightsShadowResolutionTierHigh: 1024
|
||||
m_ReflectionProbeBlending: 0
|
||||
m_ReflectionProbeBoxProjection: 0
|
||||
m_ReflectionProbeAtlas: 1
|
||||
m_ShadowDistance: 10
|
||||
m_ShadowCascadeCount: 1
|
||||
m_Cascade2Split: 0.095
|
||||
@@ -127,8 +128,14 @@ MonoBehaviour:
|
||||
m_PrefilterSoftShadowsQualityHigh: 1
|
||||
m_PrefilterSoftShadows: 1
|
||||
m_PrefilterScreenCoord: 1
|
||||
m_PrefilterScreenSpaceIrradiance: 0
|
||||
m_PrefilterNativeRenderPass: 1
|
||||
m_PrefilterUseLegacyLightmaps: 0
|
||||
m_PrefilterBicubicLightmapSampling: 0
|
||||
m_PrefilterReflectionProbeRotation: 0
|
||||
m_PrefilterReflectionProbeBlending: 0
|
||||
m_PrefilterReflectionProbeBoxProjection: 0
|
||||
m_PrefilterReflectionProbeAtlas: 0
|
||||
m_ShaderVariantLogLevel: 0
|
||||
m_ShadowCascades: 0
|
||||
m_Textures:
|
||||
|
||||
Reference in New Issue
Block a user