Posts

Post not yet marked as solved
0 Replies
580 Views
I am working on an app that shows Sun's orbit path around the current locations. Followed these steps. Get current location with CLLocationManager Get Azimuth and Elevation details of Sun with respect to current date time and location details Covert Azimuth and Elevation spherical coordinates to Cartesian XYZ coordinates to show on ARKit. Show final coordinates on Arkit and draw the path I have verified the Azimuth and Elevation angle details with the reference app and coming perfectly. But after converting it to Cartesian coordinate, it never shows to correct place in ARKit. Conversion code: public Vector3 PerformCalculations(BRSunSphericalPosition sphericalPosition) { Vector3 vector = new Vector3(); vector.X = (float)(radius * Math.Cos(DegreeToRadians(sphericalPosition.Elevation)) * Math.Cos(DegreeToRadians(sphericalPosition.Azimuth))); vector.Y = (float)(radius * Math.Cos(DegreeToRadians(sphericalPosition.Elevation)) * Math.Sin(DegreeToRadians(sphericalPosition.Azimuth))); vector.Z = (float)(radius * Math.Sin(DegreeToRadians(sphericalPosition.Elevation))); return vector; } And showing on ARKit: System.Numerics.Vector3 sunPosition = coordinateCalculator.PerformCalculations(position); var sphereNode = new SCNNode(); sphereNode.Geometry = SCNSphere.Create(0.05f); sphereNode.Geometry.FirstMaterial.Diffuse.Contents = TimeView(time); sphereNode.Position = new SCNVector3(sunPosition.X, sunPosition.Y, sunPosition.Z); arSCNView.Scene.RootNode.AddChildNode(sphereNode); But this code never shows the sphere point tracking to the sun, It's very very off from the exact point. For example: When it's around 12:30 PM it should be at the top and at night 12:30 AM sun's position should be at the bottom. Here I have used Xamarin C# language, but I am looking for a native iOS solution.
Posted
by TushiTank.
Last updated
.