dithering, close cam, rain
This commit is contained in:
+6
-1
@@ -3160,11 +3160,16 @@ MonoBehaviour:
|
|||||||
minPitch: 10
|
minPitch: 10
|
||||||
maxPitch: 60
|
maxPitch: 60
|
||||||
distance: 4
|
distance: 4
|
||||||
heightOffset: -0.5
|
|
||||||
followSpeed: 1000
|
followSpeed: 1000
|
||||||
maxDistance: 6
|
maxDistance: 6
|
||||||
minDistance: 1
|
minDistance: 1
|
||||||
zoomSpeed: 5
|
zoomSpeed: 5
|
||||||
|
heightOffset: -0.75
|
||||||
|
collisionRadius: 0.3
|
||||||
|
collisionOffset: 0.2
|
||||||
|
collisionMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 8
|
||||||
obstructionMask:
|
obstructionMask:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 4294967295
|
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: 12216330}
|
||||||
- component: {fileID: 12216329}
|
- component: {fileID: 12216329}
|
||||||
- component: {fileID: 12216328}
|
- component: {fileID: 12216328}
|
||||||
m_Layer: 0
|
m_Layer: 3
|
||||||
m_Name: Floor (4)
|
m_Name: Floor (4)
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
@@ -511,7 +511,7 @@ GameObject:
|
|||||||
- component: {fileID: 56102396}
|
- component: {fileID: 56102396}
|
||||||
- component: {fileID: 56102395}
|
- component: {fileID: 56102395}
|
||||||
- component: {fileID: 56102394}
|
- component: {fileID: 56102394}
|
||||||
m_Layer: 0
|
m_Layer: 3
|
||||||
m_Name: Floor (3)
|
m_Name: Floor (3)
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
@@ -4454,53 +4454,13 @@ PrefabInstance:
|
|||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransformParent: {fileID: 0}
|
m_TransformParent: {fileID: 0}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
- target: {fileID: 2119885955527004040, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: heightOffset
|
||||||
value: -2.5
|
value: -0.75
|
||||||
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
|
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
- target: {fileID: 5478143440182735446, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||||
propertyPath: distance
|
propertyPath: collisionMask.m_Bits
|
||||||
value: 4
|
value: 8
|
||||||
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
|
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5526037850913171920, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
- target: {fileID: 5526037850913171920, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
@@ -4542,10 +4502,6 @@ PrefabInstance:
|
|||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 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}
|
- target: {fileID: 9054701043111961555, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: Doug
|
value: Doug
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.UIElements;
|
||||||
using static Unity.Cinemachine.CinemachineTargetGroup;
|
using static Unity.Cinemachine.CinemachineTargetGroup;
|
||||||
using static UnityEngine.GraphicsBuffer;
|
using static UnityEngine.GraphicsBuffer;
|
||||||
|
|
||||||
@@ -13,21 +14,28 @@ public class CameraController : MonoBehaviour
|
|||||||
|
|
||||||
private bool isCamRotating = false;
|
private bool isCamRotating = false;
|
||||||
|
|
||||||
[Header("Free Cam Settings")]
|
[Header("Rotation")]
|
||||||
public float mouseSensitivity = 200f;
|
public float mouseSensitivity = 200f;
|
||||||
public float minPitch = -30f;
|
public float minPitch = -30f;
|
||||||
public float maxPitch = 60f;
|
public float maxPitch = 60f;
|
||||||
public float distance = 5f;
|
public float distance = 5f;
|
||||||
public float heightOffset = -0.5f;
|
private float yaw;
|
||||||
|
private float pitch;
|
||||||
|
|
||||||
|
[Header("Zoom")]
|
||||||
public float followSpeed = 10f;
|
public float followSpeed = 10f;
|
||||||
public float maxDistance = 6f;
|
public float maxDistance = 6f;
|
||||||
public float minDistance = 1f;
|
public float minDistance = 1f;
|
||||||
public float zoomSpeed = 5f;
|
public float zoomSpeed = 5f;
|
||||||
private float yaw;
|
public float heightOffset = -0.5f;
|
||||||
private float pitch;
|
|
||||||
private float currentDistance;
|
private float currentDistance;
|
||||||
private float distanceVelocity;
|
private float distanceVelocity;
|
||||||
|
|
||||||
|
[Header("Collision")]
|
||||||
|
public float collisionRadius = 0.3f;
|
||||||
|
public float collisionOffset = 0.2f;
|
||||||
|
public LayerMask collisionMask;
|
||||||
|
|
||||||
[Header("Occlusion Settings")]
|
[Header("Occlusion Settings")]
|
||||||
public LayerMask obstructionMask;
|
public LayerMask obstructionMask;
|
||||||
public float fadedAlpha = 0.25f;
|
public float fadedAlpha = 0.25f;
|
||||||
@@ -51,11 +59,15 @@ private void Update()
|
|||||||
{
|
{
|
||||||
HandleFreeCamRotation();
|
HandleFreeCamRotation();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CamAvoidCollisions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
Vector3 angles = transform.eulerAngles;
|
Vector3 angles = playerCamHome.transform.eulerAngles;
|
||||||
|
|
||||||
yaw = angles.y;
|
yaw = angles.y;
|
||||||
pitch = angles.x;
|
pitch = angles.x;
|
||||||
@@ -120,10 +132,10 @@ void HandleFreeCamRotation()
|
|||||||
{
|
{
|
||||||
if (dougBody == null)
|
if (dougBody == null)
|
||||||
{
|
{
|
||||||
if (GameManager.Instance.PlayerController.DougBody == null)
|
if (GameManager.Instance.PlayerController.DougBody != null)
|
||||||
return;
|
|
||||||
|
|
||||||
dougBody = GameManager.Instance.PlayerController.DougBody.transform;
|
dougBody = GameManager.Instance.PlayerController.DougBody.transform;
|
||||||
|
else
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 target = new Vector3(dougBody.position.x, dougBody.position.y + heightOffset, dougBody.position.z);
|
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);
|
pitch = Mathf.Clamp(pitch, minPitch, maxPitch);
|
||||||
|
|
||||||
|
// Rotation
|
||||||
|
Quaternion rotation = Quaternion.Euler(pitch, yaw, 0);
|
||||||
|
|
||||||
// Zoom
|
// Zoom
|
||||||
float scroll = Input.GetAxis("Mouse ScrollWheel");
|
float scroll = Input.GetAxis("Mouse ScrollWheel");
|
||||||
|
|
||||||
@@ -152,13 +167,87 @@ void HandleFreeCamRotation()
|
|||||||
ref distanceVelocity,
|
ref distanceVelocity,
|
||||||
0.05f);
|
0.05f);
|
||||||
|
|
||||||
// Rotation
|
float adjustedDistance = currentDistance;
|
||||||
Quaternion rotation = Quaternion.Euler(pitch, yaw, 0);
|
|
||||||
|
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
|
// Desired Position
|
||||||
Vector3 offset = rotation * Vector3.forward * -currentDistance;
|
Vector3 offset = rotation * Vector3.forward * -adjustedDistance;
|
||||||
Vector3 desiredPosition = target + offset;
|
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
|
// Smooth Follow
|
||||||
playerCamHome.transform.position = Vector3.Lerp(
|
playerCamHome.transform.position = Vector3.Lerp(
|
||||||
playerCamHome.transform.position,
|
playerCamHome.transform.position,
|
||||||
@@ -174,14 +263,12 @@ void UpdateOcclusion()
|
|||||||
{
|
{
|
||||||
if (dougBody == null)
|
if (dougBody == null)
|
||||||
{
|
{
|
||||||
if (GameManager.Instance.PlayerController.DougBody == null)
|
if (GameManager.Instance.PlayerController.DougBody != null)
|
||||||
return;
|
|
||||||
|
|
||||||
dougBody = GameManager.Instance.PlayerController.DougBody.transform;
|
dougBody = GameManager.Instance.PlayerController.DougBody.transform;
|
||||||
|
else
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dougBody == null) return;
|
|
||||||
|
|
||||||
// Reset all renderers to visible
|
// Reset all renderers to visible
|
||||||
foreach (Renderer r in new List<Renderer>(targetAlpha.Keys))
|
foreach (Renderer r in new List<Renderer>(targetAlpha.Keys))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ private void CheckSprint()
|
|||||||
/// Checks if weapon is being switched by scroll wheel
|
/// Checks if weapon is being switched by scroll wheel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void CheckWeaponChange()
|
private void CheckWeaponChange()
|
||||||
|
{
|
||||||
|
if (!Input.GetMouseButton(1))
|
||||||
{
|
{
|
||||||
if (Input.mouseScrollDelta.y > 0)
|
if (Input.mouseScrollDelta.y > 0)
|
||||||
{
|
{
|
||||||
@@ -115,6 +117,7 @@ private void CheckWeaponChange()
|
|||||||
SwitchTools(false);
|
SwitchTools(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Apply walking inputs to moveDir
|
/// Apply walking inputs to moveDir
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ TagManager:
|
|||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
- Ignore Raycast
|
- Ignore Raycast
|
||||||
-
|
- CameraObstructions
|
||||||
- Water
|
- Water
|
||||||
- UI
|
- UI
|
||||||
-
|
-
|
||||||
|
|||||||
Reference in New Issue
Block a user