[英]Why does my fixed hologram not scale with head movement?
我正在使用固定参照系放置Direct X球体。 当我移动头部时,球形全息图会保持在原位。 但是它没有规模。 当我第一次使用PositionHologramAtGaze()放置它时,它会缩放(基于示例代码)。
在C ++ / Direct X中,我是否必须处理缩放?
//下面的代码基于或与示例代码相同...
SpatialPointerPose^ pointerPoseStationary =
SpatialPointerPose::TryGetAtTimestamp(m_stationaryReferenceFrame-
>CoordinateSystem, prediction->Timestamp);
m_Sphere->PositionHologramAtGaze(pointerPoseStationary, 2.5f);
球体绘制得很好,并保持在固定的世界位置,但是当我将头/ hololens移到更远时,它不会缩放。
例如,在此图像中,我们有一个看着全息球的人穿着一个全息透镜的人看着全息球
现在,使用hololens硬件的用户向后退了几米:
他们应该看到的是一个较小的球体: 较小的球体
我还在这里的Microsoft示例中观察到了这一点:
https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/BasicHologram
当我向后移动时,立方体旋转但不会改变大小。
我找到了自己的答案。
HolographicFaceTracking示例使用相对于眼镜的坐标系。 第281行:SpatialCoordinateSystem ^ currentCoordinateSystem = m_referenceFrame-
GetStationaryCoordinateSystemAtTimestamp(prediction->时间戳);
我误解了此方法为“固定”坐标,即“世界”坐标系。 但是“固定”在这种情况下没有这个含义。
它并不能完全解释为什么多维数据集不会更改大小或进行反向缩放,但是一旦我从BasicHologram示例中切换为使用此代码,就可以了:
// The simplest way to render world-locked holograms is to create a
stationary reference frame
// based on a SpatialLocator. This is roughly analogous to creating a "world"
coordinate system
// with the origin placed at the device's position as the app is launched.
m_stationaryReferenceFrame = m_spatialLocator-
>CreateStationaryFrameOfReferenceAtCurrentLocation();
接着
pose = SpatialPointerPose::TryGetAtTimestamp(m_stationaryReferenceFrame-
>CoordinateSystem, prediction->Timestamp);
切换到使用CreateStationaryFrameOfReferenceAtCurrentLocation()
给我“世界锁定”的坐标系。
我认为,在我的辩护中,“ >>),到处都是” stationary“一词的重载有点令人困惑,需要谨慎。 我正在更改自己的代码,以确保使用“世界”和“耳机”来引用坐标系,以帮助避免混淆。
希望我在这里的回答会对其他人有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.