feat: OctoPlayer sensitivity settings for mouse & controller
This commit is contained in:
@@ -326,14 +326,17 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 320cde26f18d40b40a31c85e85ee4e59, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Unheimlich.World.CameraSystem.LostFootageRig
|
||||
_isActive: 1
|
||||
_masterIntensityInspector: 1
|
||||
_stressLevel: 0
|
||||
_stressAmplitudeMul: 2.5
|
||||
_stressSpeedMul: 1.8
|
||||
_idleAmplitude: 0.25
|
||||
_idleNoiseSpeed: 0.6
|
||||
_walkAmplitude: 0.8
|
||||
_walkNoiseSpeed: 1.4
|
||||
_runAmplitude: 1.8
|
||||
_runNoiseSpeed: 2.5
|
||||
_stressAmplitudeMul: 2.5
|
||||
_stressSpeedMul: 1.8
|
||||
_moveTSmoothSpeed: 4
|
||||
_idleJoltAmplitude: 0.5
|
||||
_idleJoltIntervalRange: {x: 2, y: 4}
|
||||
@@ -348,9 +351,13 @@ MonoBehaviour:
|
||||
_inertiaStrength: 4
|
||||
_inertiaDamping: 6
|
||||
_inertiaMaxAngle: 8
|
||||
_spinMaxYAngle: 6
|
||||
_spinMaxZAngle: 2.5
|
||||
_spinNoiseSpeed: 0.08
|
||||
_spinDamping: 2
|
||||
_fadeDuration: 0.6
|
||||
_debugSustainStress: 0
|
||||
_debugStressValue: 0
|
||||
_debugOverrideStress: 0
|
||||
_debugStressOverride: 0
|
||||
--- !u!1 &4625798697874999476
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -533,8 +540,8 @@ MonoBehaviour:
|
||||
JumpAction: -1877919292
|
||||
_firstPerson:
|
||||
Camera: {fileID: 3666612565151794712}
|
||||
SensitivityX: 0.1
|
||||
SensitivityY: 0.1
|
||||
MouseSensitivity: {x: 0.1, y: 0.1}
|
||||
GamepadSensitivity: {x: 140, y: 140}
|
||||
MinPitch: -80
|
||||
MaxPitch: 80
|
||||
ReferenceYaw: 0
|
||||
|
||||
@@ -82,11 +82,11 @@ namespace OctoCore.Components
|
||||
|
||||
[Header("Settings")]
|
||||
|
||||
[Tooltip("Horizontal sensitivity (Yaw).")]
|
||||
public float SensitivityX = 0.1f;
|
||||
[Tooltip("Mouse sensitivity (Yaw & Pitch).")]
|
||||
public Vector2 MouseSensitivity = new Vector2(.1f, .1f);
|
||||
|
||||
[Tooltip("Vertical sensitivity (Pitch).")]
|
||||
public float SensitivityY = 0.1f;
|
||||
[Tooltip("Controller sensitivity (Yaw & Pitch).")]
|
||||
public Vector2 ControllerSensitivity = new Vector2(140, 140);
|
||||
|
||||
[Tooltip("Minimum pitch (looking down).")]
|
||||
public float MinPitch = -80f;
|
||||
@@ -350,16 +350,18 @@ namespace OctoCore.Components
|
||||
|
||||
if (_settings.AllowLook)
|
||||
{
|
||||
float mouseX = delta.x * _firstPerson.SensitivityX;
|
||||
float mouseY = delta.y * _firstPerson.SensitivityY * -1;
|
||||
bool isController = OctoCore.Instance.Platform.Controller;
|
||||
Vector2 sensitivity = isController ? _firstPerson.ControllerSensitivity * Time.deltaTime : _firstPerson.MouseSensitivity;
|
||||
|
||||
_state.Yaw += mouseX;
|
||||
Vector2 look = delta * new Vector2(sensitivity.x, sensitivity.y * -1);
|
||||
|
||||
_state.Yaw += look.x;
|
||||
float halfRange = _firstPerson.RangeYaw * 0.5f;
|
||||
float deltaYaw = Mathf.DeltaAngle(_firstPerson.ReferenceYaw, _state.Yaw);
|
||||
deltaYaw = Mathf.Clamp(deltaYaw, -halfRange, halfRange);
|
||||
_state.Yaw = _firstPerson.ReferenceYaw + deltaYaw;
|
||||
|
||||
_state.Pitch = Mathf.Clamp(_state.Pitch + mouseY, _firstPerson.MinPitch, _firstPerson.MaxPitch);
|
||||
_state.Pitch = Mathf.Clamp(_state.Pitch + look.y, _firstPerson.MinPitch, _firstPerson.MaxPitch);
|
||||
}
|
||||
|
||||
if (_state.Driver)
|
||||
|
||||
@@ -227,11 +227,13 @@ namespace OctoCore.Inputs
|
||||
{
|
||||
var actionInfo = kvp.Value;
|
||||
|
||||
Vector2 value = actionInfo.Reference.action.ReadValue<Vector2>();
|
||||
|
||||
// Only poll enabled actions with callbacks
|
||||
if (actionInfo.Enabled &&
|
||||
actionInfo.Reference != null &&
|
||||
(actionInfo.CallbacksList.Count > 0 || actionInfo.CallbacksVector2List.Count > 0) &&
|
||||
actionInfo.Reference.action.IsPressed())
|
||||
value.sqrMagnitude > .0001f)
|
||||
{
|
||||
// Call Action callbacks
|
||||
foreach (var callback in actionInfo.CallbacksList.ToArray())
|
||||
@@ -242,7 +244,6 @@ namespace OctoCore.Inputs
|
||||
// Call Vector2 callbacks
|
||||
foreach (var callback in actionInfo.CallbacksVector2List.ToArray())
|
||||
{
|
||||
Vector2 value = actionInfo.Reference.action.ReadValue<Vector2>();
|
||||
callback?.Invoke(value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user