dithering, close cam, rain
This commit is contained in:
+6
-1
@@ -3160,11 +3160,16 @@ MonoBehaviour:
|
||||
minPitch: 10
|
||||
maxPitch: 60
|
||||
distance: 4
|
||||
heightOffset: -0.5
|
||||
followSpeed: 1000
|
||||
maxDistance: 6
|
||||
minDistance: 1
|
||||
zoomSpeed: 5
|
||||
heightOffset: -0.75
|
||||
collisionRadius: 0.3
|
||||
collisionOffset: 0.2
|
||||
collisionMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 8
|
||||
obstructionMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eaa54bb6b383cee45b061dbca1a69945
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: ParticlesUnlit Variant
|
||||
m_Shader: {fileID: 4800000, guid: 0406db5a14f94604a8c57ccfbc9f3b46, type: 3}
|
||||
m_Parent: {fileID: 2100000, guid: e823cd5b5d27c0f4b8256e7c12ee3e6d, type: 2}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _SURFACE_TYPE_TRANSPARENT
|
||||
m_InvalidKeywords:
|
||||
- _FLIPBOOKBLENDING_OFF
|
||||
- _RECEIVE_SHADOWS_OFF
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap:
|
||||
RenderType: Transparent
|
||||
disabledShaderPasses:
|
||||
- ALWAYS
|
||||
- SHADOWCASTER
|
||||
- DepthOnly
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs: []
|
||||
m_Ints: []
|
||||
m_Floats: []
|
||||
m_Colors: []
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
--- !u!114 &3897461806608698219
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
|
||||
version: 10
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64ca3a2884aa8954cb1fb6d2ce25a60c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -131,7 +131,7 @@ GameObject:
|
||||
- component: {fileID: 12216330}
|
||||
- component: {fileID: 12216329}
|
||||
- component: {fileID: 12216328}
|
||||
m_Layer: 0
|
||||
m_Layer: 3
|
||||
m_Name: Floor (4)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@@ -511,7 +511,7 @@ GameObject:
|
||||
- component: {fileID: 56102396}
|
||||
- component: {fileID: 56102395}
|
||||
- component: {fileID: 56102394}
|
||||
m_Layer: 0
|
||||
m_Layer: 3
|
||||
m_Name: Floor (3)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@@ -4454,53 +4454,13 @@ PrefabInstance:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -2.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 11.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -21
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.979159
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0.1947668
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0.05645799
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0.01123019
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 22.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 6.6
|
||||
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: heightOffset
|
||||
value: -0.75
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: distance
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: zoomSpeed
|
||||
value: 5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: obstructionMask.m_Bits
|
||||
value: 4294967295
|
||||
propertyPath: collisionMask.m_Bits
|
||||
value: 8
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5526037850913171920, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -4542,10 +4502,6 @@ PrefabInstance:
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7814557473141052265, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: orthographic
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9054701043111961555, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Doug
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using static Unity.Cinemachine.CinemachineTargetGroup;
|
||||
using static UnityEngine.GraphicsBuffer;
|
||||
|
||||
@@ -13,21 +14,28 @@ public class CameraController : MonoBehaviour
|
||||
|
||||
private bool isCamRotating = false;
|
||||
|
||||
[Header("Free Cam Settings")]
|
||||
[Header("Rotation")]
|
||||
public float mouseSensitivity = 200f;
|
||||
public float minPitch = -30f;
|
||||
public float maxPitch = 60f;
|
||||
public float distance = 5f;
|
||||
public float heightOffset = -0.5f;
|
||||
private float yaw;
|
||||
private float pitch;
|
||||
|
||||
[Header("Zoom")]
|
||||
public float followSpeed = 10f;
|
||||
public float maxDistance = 6f;
|
||||
public float minDistance = 1f;
|
||||
public float zoomSpeed = 5f;
|
||||
private float yaw;
|
||||
private float pitch;
|
||||
public float heightOffset = -0.5f;
|
||||
private float currentDistance;
|
||||
private float distanceVelocity;
|
||||
|
||||
[Header("Collision")]
|
||||
public float collisionRadius = 0.3f;
|
||||
public float collisionOffset = 0.2f;
|
||||
public LayerMask collisionMask;
|
||||
|
||||
[Header("Occlusion Settings")]
|
||||
public LayerMask obstructionMask;
|
||||
public float fadedAlpha = 0.25f;
|
||||
@@ -51,11 +59,15 @@ private void Update()
|
||||
{
|
||||
HandleFreeCamRotation();
|
||||
}
|
||||
else
|
||||
{
|
||||
CamAvoidCollisions();
|
||||
}
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
Vector3 angles = transform.eulerAngles;
|
||||
Vector3 angles = playerCamHome.transform.eulerAngles;
|
||||
|
||||
yaw = angles.y;
|
||||
pitch = angles.x;
|
||||
@@ -120,10 +132,10 @@ void HandleFreeCamRotation()
|
||||
{
|
||||
if (dougBody == null)
|
||||
{
|
||||
if (GameManager.Instance.PlayerController.DougBody == null)
|
||||
if (GameManager.Instance.PlayerController.DougBody != null)
|
||||
dougBody = GameManager.Instance.PlayerController.DougBody.transform;
|
||||
else
|
||||
return;
|
||||
|
||||
dougBody = GameManager.Instance.PlayerController.DougBody.transform;
|
||||
}
|
||||
|
||||
Vector3 target = new Vector3(dougBody.position.x, dougBody.position.y + heightOffset, dougBody.position.z);
|
||||
@@ -137,6 +149,9 @@ void HandleFreeCamRotation()
|
||||
|
||||
pitch = Mathf.Clamp(pitch, minPitch, maxPitch);
|
||||
|
||||
// Rotation
|
||||
Quaternion rotation = Quaternion.Euler(pitch, yaw, 0);
|
||||
|
||||
// Zoom
|
||||
float scroll = Input.GetAxis("Mouse ScrollWheel");
|
||||
|
||||
@@ -152,13 +167,87 @@ void HandleFreeCamRotation()
|
||||
ref distanceVelocity,
|
||||
0.05f);
|
||||
|
||||
// Rotation
|
||||
Quaternion rotation = Quaternion.Euler(pitch, yaw, 0);
|
||||
float adjustedDistance = currentDistance;
|
||||
|
||||
Vector3 desiredDirection =
|
||||
rotation * Vector3.back;
|
||||
|
||||
// Camera obstruction handling
|
||||
if (Physics.SphereCast(
|
||||
target,
|
||||
collisionRadius,
|
||||
desiredDirection,
|
||||
out RaycastHit hit,
|
||||
currentDistance,
|
||||
collisionMask,
|
||||
QueryTriggerInteraction.Ignore))
|
||||
{
|
||||
adjustedDistance =
|
||||
Mathf.Max(
|
||||
hit.distance - collisionOffset,
|
||||
minDistance);
|
||||
}
|
||||
|
||||
// Desired Position
|
||||
Vector3 offset = rotation * Vector3.forward * -currentDistance;
|
||||
Vector3 offset = rotation * Vector3.forward * -adjustedDistance;
|
||||
Vector3 desiredPosition = target + offset;
|
||||
|
||||
if (desiredPosition.y < dougBody.position.y)
|
||||
{
|
||||
desiredPosition.y = dougBody.position.y;
|
||||
}
|
||||
|
||||
// Smooth Follow
|
||||
playerCamHome.transform.position = Vector3.Lerp(
|
||||
playerCamHome.transform.position,
|
||||
desiredPosition,
|
||||
followSpeed * Time.deltaTime
|
||||
);
|
||||
|
||||
// Look at player
|
||||
playerCamHome.transform.LookAt(target + Vector3.up);
|
||||
}
|
||||
|
||||
void CamAvoidCollisions()
|
||||
{
|
||||
if (dougBody == null)
|
||||
{
|
||||
if (GameManager.Instance.PlayerController.DougBody != null)
|
||||
dougBody = GameManager.Instance.PlayerController.DougBody.transform;
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 target = new Vector3(dougBody.position.x, dougBody.position.y + heightOffset, dougBody.position.z);
|
||||
Quaternion rotation = Quaternion.Euler(pitch, yaw, 0);
|
||||
Vector3 desiredDirection = rotation * Vector3.back;
|
||||
|
||||
float adjustedDistance = currentDistance;
|
||||
|
||||
if (Physics.SphereCast(
|
||||
target,
|
||||
collisionRadius,
|
||||
desiredDirection,
|
||||
out RaycastHit hit,
|
||||
currentDistance,
|
||||
collisionMask,
|
||||
QueryTriggerInteraction.Ignore))
|
||||
{
|
||||
adjustedDistance =
|
||||
Mathf.Max(
|
||||
hit.distance - collisionOffset,
|
||||
minDistance);
|
||||
}
|
||||
|
||||
// Desired Position
|
||||
Vector3 offset = rotation * Vector3.forward * -adjustedDistance;
|
||||
Vector3 desiredPosition = target + offset;
|
||||
|
||||
if (desiredPosition.y < dougBody.position.y)
|
||||
{
|
||||
desiredPosition.y = dougBody.position.y;
|
||||
}
|
||||
|
||||
// Smooth Follow
|
||||
playerCamHome.transform.position = Vector3.Lerp(
|
||||
playerCamHome.transform.position,
|
||||
@@ -174,14 +263,12 @@ void UpdateOcclusion()
|
||||
{
|
||||
if (dougBody == null)
|
||||
{
|
||||
if (GameManager.Instance.PlayerController.DougBody == null)
|
||||
if (GameManager.Instance.PlayerController.DougBody != null)
|
||||
dougBody = GameManager.Instance.PlayerController.DougBody.transform;
|
||||
else
|
||||
return;
|
||||
|
||||
dougBody = GameManager.Instance.PlayerController.DougBody.transform;
|
||||
}
|
||||
|
||||
if (dougBody == null) return;
|
||||
|
||||
// Reset all renderers to visible
|
||||
foreach (Renderer r in new List<Renderer>(targetAlpha.Keys))
|
||||
{
|
||||
|
||||
@@ -106,13 +106,16 @@ private void CheckSprint()
|
||||
/// </summary>
|
||||
private void CheckWeaponChange()
|
||||
{
|
||||
if (Input.mouseScrollDelta.y > 0)
|
||||
if (!Input.GetMouseButton(1))
|
||||
{
|
||||
SwitchTools(true);
|
||||
}
|
||||
else if (Input.mouseScrollDelta.y < 0)
|
||||
{
|
||||
SwitchTools(false);
|
||||
if (Input.mouseScrollDelta.y > 0)
|
||||
{
|
||||
SwitchTools(true);
|
||||
}
|
||||
else if (Input.mouseScrollDelta.y < 0)
|
||||
{
|
||||
SwitchTools(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ TagManager:
|
||||
- Default
|
||||
- TransparentFX
|
||||
- Ignore Raycast
|
||||
-
|
||||
- CameraObstructions
|
||||
- Water
|
||||
- UI
|
||||
-
|
||||
|
||||
Reference in New Issue
Block a user