Unity3D で RigidBody を作成し、Tango Motion Control を介してボディの動きを制御するコントローラー スクリプトをアタッチしました。しかし、問題は、何らかの理由で、リジボディが側面にある壁と衝突しないことです。それを通り抜けるだけです。
Update() のコード スニペットは次のとおりです。
void Update()
{
Debug.Log("Tango update: " + m_tangoPosition + " " + m_tangoRotation);
PoseProvider.GetMouseEmulation(ref m_tangoPosition, ref m_tangoRotation);
transform.position = m_tangoPosition + m_startPosition;
transform.rotation = m_tangoRotation;
}
OnPoseAvailable コールバックを介して TangoPose データを取得します
// Project Tango からのポーズ コールバック
public void OnTangoPoseAvailable(Tango.TangoPoseData pose)
{
// Do nothing if we don't get a pose
if (pose == null)
{
Debug.Log("TangoPoseData is null.");
return;
}
// The callback pose is for device with respect to start of service pose.
if (pose.framePair.baseFrame == TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_START_OF_SERVICE &&
pose.framePair.targetFrame == TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_DEVICE)
{
if (pose.status_code == TangoEnums.TangoPoseStatusType.TANGO_POSE_VALID)
{
// Cache the position and rotation to be set in the update function.
m_tangoPosition = new Vector3((float)pose.translation [0],
(float)pose.translation [1],
(float)pose.translation [2]);
m_tangoRotation = new Quaternion((float)pose.orientation [0],
(float)pose.orientation [1],
(float)pose.orientation [2],
(float)pose.orientation [3]);
// Debug.Log("Tango VALID pose: " + m_tangoPosition + " " + m_tangoRotation);
}
}
}
ここで何か不足していますか?RigidBody が壁を突き抜けるのはなぜですか? このスクリプトをカプセル リジッドボディにアタッチしました。
どんな助けや指針も大歓迎です。
ありがとう