Small changes to the QR code demo, uses the warning-less version of FromSpatialNode now.
@@ -64,7 +64,9 @@ class DemoQRCode : ITest
public static QRData FromCode(QRCode qr)
{
QRData result = new QRData();
- result.pose = World.FromSpatialNode(qr.SpatialGraphNodeId);
+ // It's not unusual for this to fail to find a pose, especially on
+ // the first frame it's been seen.
+ World.FromSpatialNode(qr.SpatialGraphNodeId, out result.pose);
result.size = qr.PhysicalSideLength;
result.text = qr.Data == null ? "" : qr.Data;
return result;
@@ -124,12 +126,12 @@ class DemoQRCode : ITest
Lines.AddAxis(d.pose, d.size);
Text .Add(
d.text,
- Matrix.TR(
- d.pose.position + d.pose.Forward*d.size*0.1f,
- Quat.FromAngles(0, 0, 180)*d.pose.orientation),
+ d.pose.ToMatrix(),
Vec2.One * d.size,
TextFit.Squeeze,
- TextAlign.XLeft | TextAlign.YTop);
+ TextAlign.XLeft | TextAlign.YTop,
+ TextAlign.Center,
+ d.size, d.size);
}
}
/// And that's all there is to it! You can find all this code
