# Conflicts:
#	Assets/TextMesh Pro/Fonts/TMP_Assets/CourierPrime-Regular SDF.asset
#	Assets/TextMesh Pro/Fonts/TMP_Assets/CutiveMono-Regular SDF.asset
#	Assets/TextMesh Pro/Fonts/TMP_Assets/Inconsolata-VariableFont_wdth,wght SDF.asset
#	Assets/TextMesh Pro/Fonts/TMP_Assets/OxygenMono-Regular SDF.asset
#	Assets/TextMesh Pro/Fonts/TMP_Assets/ShareTechMono-Regular SDF.asset
#	Assets/TextMesh Pro/Fonts/TMP_Assets/SpecialElite-Regular SDF.asset
#	Assets/_Content/Prefabs/OctoPlayerFP.prefab
#	Packages/OctoCore/Runtime/Scripts/Components/OctoPlayer.cs
This commit is contained in:
Ferlat Thibaud
2026-06-03 13:52:36 +02:00
64 changed files with 6855 additions and 4698 deletions
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 96a0cfdaa6cfe3f4b8336bd77daefaba
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
using UnityEngine;
public class FogAutoQueue : MonoBehaviour
{
[SerializeField] private Renderer[] _renderers;
void Awake()
{
for(int i = 1; i < _renderers.Length; i++)
{
_renderers[i].material.renderQueue = _renderers[0].material.renderQueue + i;
}
}
void Update()
{
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: fab3b088b58554f43bbc16b3f2239f84
@@ -8,25 +8,21 @@ namespace Unheimlich.Features.Player
/// Simulates camera head bobbing motion during player movement and idle states.
/// Smoothly transitions between idle, walk and run bob parameters.
/// Adds a subtle Z-axis roll to the bob and a strafe tilt applied in LateUpdate.
///
/// Sprint bob is automatically disabled when OctoPlayer.CanRun is false,
/// since IsRunning already returns false in that case.
/// Both rolls are combined additively to avoid asymmetric drift.
/// </summary>
public class CameraHeadBob : MonoBehaviour
{
private float _timer = 0f;
private Vector3 _startLocalPos;
// Smoothly interpolated bob parameters to avoid brutal state switches.
private float _currentBobSpeed = 0f;
private float _currentBobAmplitude = 0f;
// Strafe tilt (Z roll applied in LateUpdate, after OctoPlayer sets camera pitch).
private float _currentTilt = 0f;
private float _currentBobRoll = 0f;
private float _currentTilt = 0f;
private CameraEffects.HeadBobMode _overrideMode = CameraEffects.HeadBobMode.Normal;
private bool _hasOverride = false;
private Coroutine _resetCoroutine;
private bool _hasOverride = false;
private Coroutine _resetCoroutine;
private void Start()
{
@@ -46,16 +42,14 @@ namespace Unheimlich.Features.Player
if (currentMode == CameraEffects.HeadBobMode.Disabled)
{
SetBobDirect(settings.idleBobSpeed, 0f);
ApplySmoothedBob(settings.bobRollAmplitude);
_currentBobRoll = ApplySmoothedBob(settings.bobRollAmplitude);
return;
}
bool forceIdle = currentMode == CameraEffects.HeadBobMode.Idle;
if (forceIdle)
if (currentMode == CameraEffects.HeadBobMode.Idle)
{
SetBobDirect(settings.idleBobSpeed, settings.idleBobAmplitude);
ApplySmoothedBob(settings.bobRollAmplitude);
_currentBobRoll = ApplySmoothedBob(settings.bobRollAmplitude);
return;
}
@@ -63,19 +57,16 @@ namespace Unheimlich.Features.Player
if (!isGrounded)
{
SetBobDirect(settings.idleBobSpeed, 0f);
ApplySmoothedBob(settings.bobRollAmplitude);
_currentBobRoll = ApplySmoothedBob(settings.bobRollAmplitude);
return;
}
// Drive bob parameters directly from the actual physics velocity.
float horizontalSpeed = new Vector3(
PlayerController.Instance.CharController.velocity.x,
0f,
PlayerController.Instance.CharController.velocity.z
).magnitude;
// IsRunning already returns false when OctoPlayer.CanRun is off —
// so the bob falls back to walk params automatically.
bool isRunning = OctoCore.Components.OctoPlayer.Instance.State.IsRunning;
const float WalkSpeedMs = 10f / 3.6f;
@@ -88,12 +79,9 @@ namespace Unheimlich.Features.Player
float targetAmplitude = Mathf.Lerp(settings.idleBobAmplitude, isRunning ? settings.runBobAmplitude : settings.walkBobAmplitude, t);
SetBobDirect(targetSpeed, targetAmplitude);
ApplySmoothedBob(settings.bobRollAmplitude);
_currentBobRoll = ApplySmoothedBob(settings.bobRollAmplitude);
}
/// <summary>
/// Applies strafe tilt in LateUpdate so it composites correctly over OctoPlayer's pitch rotation.
/// </summary>
private void LateUpdate()
{
if (PlayerController.Instance == null || PlayerController.Instance.CharController == null)
@@ -102,29 +90,27 @@ namespace Unheimlich.Features.Player
var settings = PlayerController.Instance.CameraEffects?.Settings;
if (settings == null) return;
Vector3 velocity = PlayerController.Instance.CharController.velocity;
float strafeAmount = Vector3.Dot(velocity, PlayerController.Instance.transform.right);
Vector3 velocity = PlayerController.Instance.CharController.velocity;
float strafeAmount = Vector3.Dot(velocity, PlayerController.Instance.transform.right);
float runSpeedMs = PlayerController.Instance.Movement != null ? 20f / 3.6f : 5.5f;
float strafeFactor = Mathf.Clamp(strafeAmount / runSpeedMs, -1f, 1f);
float runSpeedMs = PlayerController.Instance.Movement != null ? 20f / 3.6f : 5.5f;
float strafeFactor = Mathf.Clamp(strafeAmount / runSpeedMs, -1f, 1f);
float targetTilt = -strafeFactor * settings.strafeTiltAngle;
_currentTilt = Mathf.Lerp(_currentTilt, targetTilt, Time.deltaTime * settings.strafeTiltSpeed);
float targetTilt = -strafeFactor * settings.strafeTiltAngle;
_currentTilt = Mathf.Lerp(_currentTilt, targetTilt, Time.deltaTime * settings.strafeTiltSpeed);
Quaternion baseRot = transform.localRotation;
transform.localRotation = baseRot * Quaternion.Euler(0f, 0f, _currentTilt);
// Combine bob roll + strafe tilt additively
transform.localRotation = Quaternion.Euler(0f, 0f, _currentBobRoll + _currentTilt);
}
// ── Public API ────────────────────────────────────────────────────────────
/// <summary>Overrides the head bob mode (Idle, Normal, Disabled).</summary>
public void SetMode(CameraEffects.HeadBobMode mode)
{
_overrideMode = mode;
_hasOverride = true;
}
/// <summary>Clears any active mode override and returns to Normal.</summary>
public void ClearOverride()
{
_hasOverride = false;
@@ -136,7 +122,6 @@ namespace Unheimlich.Features.Player
}
}
/// <summary>Lerps the camera local position back to origin over <paramref name="duration"/> seconds.</summary>
public void LerpToZero(float duration)
{
if (_resetCoroutine != null)
@@ -153,7 +138,11 @@ namespace Unheimlich.Features.Player
_currentBobAmplitude = amplitude;
}
private void ApplySmoothedBob(float rollAmplitude)
/// <summary>
/// Applies bob position and returns the Z roll value (degrees).
/// Rotation is NOT set here — LateUpdate combines it with strafe tilt.
/// </summary>
private float ApplySmoothedBob(float rollAmplitude)
{
_timer += Time.deltaTime * _currentBobSpeed;
@@ -166,7 +155,7 @@ namespace Unheimlich.Features.Player
newPos.y += y;
transform.localPosition = newPos;
transform.localRotation = Quaternion.Euler(0f, 0f, roll);
return roll;
}
private System.Collections.IEnumerator LerpToZeroCoroutine(float duration)
+6 -1
View File
@@ -257,8 +257,13 @@ public class SpiralStaircase : MonoBehaviour
trigger.Triggered = false;
}
}
Vector3 targetPosition = new Vector3(0, _state.Progression * _settings.HalfTurns * -_stairHeight, 0);
Vector3 offset = targetPosition - _references.Stairs.transform.localPosition;
_references.Stairs.transform.localPosition = new Vector3(0, _state.Progression * _settings.HalfTurns * -_stairHeight, 0);
_references.Stairs.transform.localPosition = targetPosition;
if (OctoPlayer.Instance)
OctoPlayer.Instance.Move(offset);
}
private void ManageInside()