I am reading the gyro and changing the string of a SCNText
geometry to the gyro's yaw value. The change occurs inside the gyro handler that is called every 1/30 seconds. The SCNText
geometry was created with Interface Builder.
I am using this code to retrieve a reference to the text:
SCNNode *textNode = [scene.rootNode childNodeWithName:@"yawText" recursively:YES];
self.text = [textNode geometry];
//self.txt is declared as @property (strong, nonatomic) SCNText *text;
Later on the gyro handle I do this:
CGFloat yaw = convertToDegrees(attitude.yaw);
[weakSelfText setString:[NSString stringWithFormat:@"%.1f", yaw]];
NSLog(@"yaw = %1f", yaw);
// I had to declare weakSelfText outside the gyro handler
// because Xcode was complaining
// weakSelfText is declared like this
// __weak typeof(self.text) weakSelfText = self.text;
NSLog
prints the values correctly but there is no change on the SCNText
.
Yes, I have tried to change the text on the main thread. No change.