update .gitignore
This commit is contained in:
@@ -7,29 +7,37 @@ using UnityEngine.InputSystem;
|
||||
|
||||
public class InputHandler : MonoBehaviour, IGameComponent
|
||||
{
|
||||
enum Axis
|
||||
{
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
w
|
||||
}
|
||||
|
||||
private Controls inputSystem;
|
||||
private Transform cameraTransform;
|
||||
|
||||
private float X0;
|
||||
private float P0;
|
||||
private readonly float F = 1;
|
||||
private readonly float Q = 2;
|
||||
private readonly float Q = 6;
|
||||
private readonly float H = 1;
|
||||
private readonly float R = 15;
|
||||
|
||||
private float Covariance = .1f;
|
||||
private float state = 0;
|
||||
private float[] state = new float[4];
|
||||
|
||||
float GetValueAfterFilter(float value)
|
||||
float GetValueAfterFilter(float value, Axis axis)
|
||||
{
|
||||
X0 = F * state;
|
||||
X0 = F * state[(int)axis];
|
||||
P0 = F * Covariance * F + Q;
|
||||
|
||||
var K = H *P0 / (H * P0 * H + R);
|
||||
state = X0 + K * (value - H * X0);
|
||||
state[(int)axis] = X0 + K * (value - H * X0);
|
||||
Covariance = (1 - K * H) * P0;
|
||||
|
||||
return state;
|
||||
return state[(int)axis];
|
||||
}
|
||||
|
||||
void Awake()
|
||||
@@ -61,24 +69,9 @@ public class InputHandler : MonoBehaviour, IGameComponent
|
||||
.Rotation
|
||||
.Gyroscope
|
||||
.ReadValue<Quaternion>();
|
||||
|
||||
cameraTransform.rotation = phoneRotation;
|
||||
|
||||
// phoneRotation = new Quaternion
|
||||
// (
|
||||
// GetValueAfterFilter(phoneRotation.x),
|
||||
// GetValueAfterFilter(phoneRotation.y),
|
||||
// GetValueAfterFilter(phoneRotation.z),
|
||||
// GetValueAfterFilter(phoneRotation.w)
|
||||
// );
|
||||
|
||||
Quaternion filtredRotation = new Quaternion
|
||||
(
|
||||
GetValueAfterFilter(phoneRotation.x),
|
||||
GetValueAfterFilter(phoneRotation.y),
|
||||
GetValueAfterFilter(phoneRotation.z),
|
||||
GetValueAfterFilter(phoneRotation.w)
|
||||
);
|
||||
|
||||
cameraTransform.rotation = filtredRotation;
|
||||
cameraTransform.Rotate(0, 0, 180, Space.Self);
|
||||
cameraTransform.Rotate(90, 180, 0, Space.World);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
[RequireComponent(typeof(CanvasGroup))]
|
||||
public class LogoHandler : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private CanvasGroup logo;
|
||||
private CanvasGroup canvasGroup;
|
||||
|
||||
IEnumerator Start()
|
||||
{
|
||||
DontDestroyOnLoad(gameObject);
|
||||
|
||||
canvasGroup = GetComponent<CanvasGroup>();
|
||||
|
||||
var sceneLoading = SceneManager.LoadSceneAsync(1, LoadSceneMode.Single);
|
||||
while(!sceneLoading.isDone)
|
||||
yield return null;
|
||||
|
||||
yield return new WaitForSeconds(2);
|
||||
|
||||
logo.DOFade(0, .4f)
|
||||
.OnComplete(() => canvasGroup
|
||||
.DOFade(0, .8f)
|
||||
.OnComplete(() => Destroy(this.gameObject)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1108ef3d2c569ea479a6d9778b2209a3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user