简体   繁体   English

在SceneKit中使用MapKit

[英]Using MapKit in SceneKit

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 ? 是否可以在SceneKit中使用MapKit在地图上渲染动画角色? 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 我的didMove()方法中有以下内容

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)
    }
}

您可以在注解视图中渲染场景视图,并在mapview函数“ viewFor”中渲染它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM