mapbox / mapbox-scenekit

Other
231 stars 51 forks source link

Avoid terrain intersection when using addPolyline() #56

Closed jim-martin closed 5 years ago

jim-martin commented 5 years ago

Previously, using addPolyline created terrain intersections and floating lines when drawn across terrain with dramatic elevation changes. Sample line with only start and end points defined (50.107331, -122.891896), (50.052916, -122.960512): img_0048

This change subdivides the route by a factor of the terrain's height-map resolution to fit segments along the geometry: img_0047

I've also made public a heightForLocalPosition() method that allows users to check the terrainNode's height at a given SCNVector3 location, rather than being limited to CLLocation or raycasting.