Google은 googleVr SDK (1.10)를 최신 버전으로 사용하고 있지만 성 방어와 같은 몇 가지 예제 장면을 테스트 한 결과 휴대 전화를 테이블에 올려 놓으면 화면이 흔들 리기 시작했습니다. 이 드리프트를 프로그래밍 방식으로 방지하는 방법이 있습니까? Unity google cardboard drift
나는 삼성에 자이로 스코프를 해결하기 위해 일부 동영상을 보았다 그러나 나는 몇 가지 코드가되지 않도록하려면이
1
A
답변
1
이 게시물에 설명 된대로 그것은 여전히 비 해결할 문제입니다 :
GvrViewerMain rotates the camera yourself. Unity3D + Google VR
그러나 따라 필요에 따라 다음 해결 방법을 유용하게 사용할 수 있습니다.
아이디어는 델타 회전을 찾아서 너무 작은 경우이를 무시하는 것입니다.
using UnityEngine;
public class GyroCorrector {
public enum Correction
{
NONE,
BEST
}
private Correction m_correction;
public GyroCorrector(Correction a_correction)
{
m_correction = a_correction;
}
private void CorrectValueByThreshold(ref Vector3 a_vDeltaRotation, float a_fXThreshold = 1e-1f, float a_fYThreshold = 1e-2f, float a_fZThreshold = 0.0f)
{
// Debug.Log(a_quatDelta.x + " " + a_quatDelta.y + " " + a_quatDelta.z);
a_vDeltaRotation.x = Mathf.Abs(a_vDeltaRotation.x) < a_fXThreshold ? 0.0f : a_vDeltaRotation.x + a_fXThreshold;
a_vDeltaRotation.y = Mathf.Abs(a_vDeltaRotation.y) < a_fYThreshold ? 0.0f : a_vDeltaRotation.y + a_fYThreshold;
a_vDeltaRotation.z = Mathf.Abs(a_vDeltaRotation.z) < a_fZThreshold ? 0.0f : 0.0f;//We just ignore the z rotation
}
public Vector3 Reset()
{
return m_v3Init;
}
public Vector3 Get(Vector3 a_v3Init)
{
if (!m_bInit)
{
m_bInit = true;
m_v3Init = a_v3Init;
}
Vector3 v = Input.gyro.rotationRateUnbiased;
if (m_correction == Correction.NONE)
return a_v3Init + v;
CorrectValueByThreshold(ref v);
return a_v3Init - v;
}
}
... 그리고는 "GvrHead"에서 "UpdateHead"방법이 같은 것을 사용 :
GvrViewer.Instance.UpdateState();
if (trackRotation)
{
var rot = Input.gyro.attitude;//GvrViewer.Instance.HeadPose.Orientation;
if(Input.GetMouseButtonDown(0))
{
transform.eulerAngles = m_gyroCorrector.Reset();
}
else
{
transform.eulerAngles = m_gyroCorrector.Get(transform.eulerAngles);//where m_gyroCorrector is an instance of the previous class
}
}
당신은 몇 가지 문제를 찾을 수 있습니다. 주로하지만 배타적이지 :이 운동
당신은 imprecisions와 함께 상대적 위치 다루고을 감지하는 오프셋이 있기 때문에 머리를 이동할 때
는숨어 있음에 문제가있을 수 있습니다. 따라서 반대 이동을 할 때 동일한 위치를 찾기 위해 100 % 확신하지 못합니다. .
쿼터니언 대신에 오일러 표현을 사용하고 있으며 정확도가 떨어집니다.
당신은 또한 필드에 대해 말하기 이러한 링크에 관심이있을 수 :
http://scholarworks.uvm.edu/cgi/viewcontent.cgi?article=1449&context=graddis
Gyroscope drift on mobile phones
코드의 조각 : https://github.com/asus4/UnityIMU
가 도울 수있는 희망 ,