我在 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 会穿过墙壁?我已将此脚本附加到我的 Capsule 刚体。
非常感谢任何帮助或指示。
谢谢