create main menu
This commit is contained in:
@@ -6,38 +6,8 @@ using UnityEngine;
|
||||
|
||||
public class InputHandler : MonoBehaviour, IGameComponent
|
||||
{
|
||||
enum Axis
|
||||
{
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
w
|
||||
}
|
||||
|
||||
private Transform cameraTransform;
|
||||
|
||||
private float X0;
|
||||
private float P0;
|
||||
private readonly float F = 1;
|
||||
private readonly float Q = 6;
|
||||
private readonly float H = 1;
|
||||
private readonly float R = 15;
|
||||
|
||||
private float Covariance = .1f;
|
||||
private float[] state = new float[4];
|
||||
|
||||
float GetValueAfterFilter(float value, Axis axis)
|
||||
{
|
||||
X0 = F * state[(int)axis];
|
||||
P0 = F * Covariance * F + Q;
|
||||
|
||||
var K = H *P0 / (H * P0 * H + R);
|
||||
state[(int)axis] = X0 + K * (value - H * X0);
|
||||
Covariance = (1 - K * H) * P0;
|
||||
|
||||
return state[(int)axis];
|
||||
}
|
||||
|
||||
void Awake()
|
||||
{
|
||||
cameraTransform = transform;
|
||||
|
||||
Reference in New Issue
Block a user