What you’re missing is the import of System.Linq. Please add this somewhere next to existing usings:
using System.Linq;
The FirstOrDefault is an extension method that’s defined in the Linq namespace. We forgot to mention this in the example. I’ll make sure this gets fixed.
Also does this example cover rotation reconciliation or just position? If not how would you add that?
I believe the approach would be identical to position - you’ll want to find the “rotation” binding (make sure it is bound via CoherenceSync configuration first) and subscribe to its sample receive event. Then in the callback you can calculate the difference in angle between predicted and received values and make a correction if needed.
Hi AceGames. Apparently the sample on that page is a bit outdated, as the Action you’re listening to has a new signature. (as you can see from the error message you’re getting)
Instead of:
private void DetectMisprediction(object sampleData, long simulationFrame)
try:
private void DetectMisprediction(object sampleData, bool stopped, long simulationFrame)
(you can ignore that incoming stopped parameter for now).
And I’ll fixI fixed the docs, so we don’t get this issue again… sorry for the inconvenience!