Using MapKit in SceneKit

徘徊边缘 提交于 2020-01-15 03:56:14

问题


This must be a very basic question to the pros out there. I have done quiet a bit of googling and cant find the answer I wanted.

Is it possible to use MapKit in SceneKit to render animated characters on the map ? If it is not possible how is it done when it comes to Open World type games. I basically want to make a game that has the world map as background which can be zoomed in/out. Also need to show some game options based on user's location.

All the examples I have seen is using a contained background in which the characters/objects are rendered.

Edit:

I have the following in my didMove() method

class GameScene: SKScene, CLLocationManagerDelegate, MKMapViewDelegate {
    override func didMove(to view: SKView) {
        var map : MKMapView! = MKMapView()
        map.frame = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height - 50)
        self.view?.addSubview(map)
    }
}

回答1:


You can render a sceneview in a annotationview, and render it in the mapview function "viewFor".



来源:https://stackoverflow.com/questions/38268273/using-mapkit-in-scenekit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!