Haritaya 3D model ekleme
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
İçe aktardığınız 3D modelinizi 3D haritaya ekleyebilirsiniz.
Aşağıdaki kod örneğinde, Model
struct kullanılarak 3D modelin nasıl ekleneceği ve 3D uzayda nasıl konumlandırılacağı gösterilmektedir.
Swift
struct SimpleModelDemo: View {
@State var camera: Camera = .init(latitude: 37.791376, longitude: -122.397571, altitude: 240, heading: 288.0, tilt: 88.0, roll: 0.0, range: 1500)
@State var balloonModel: Model = .init(
position: .init(
latitude: 37.791376,
longitude: -122.397571,
altitude: 200.0),
url: URL(string: "") ?? URL(fileURLWithPath: fileUrl),
altitudeMode: .relativeToMesh,
scale: .init(x: 5, y: 5, z: 5),
orientation: .init(heading: 0, tilt: 0, roll: 0)
)
var body: some View {
Map(camera: $camera, mode: .satellite) {
balloonModel
}
}
}
private let fileUrl = Bundle.main.url(forResource: "balloon", withExtension: "glb")!.path
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-08-31 UTC.
[null,null,["Son güncelleme tarihi: 2025-08-31 UTC."],[],[],null,["# Add a 3D model to a map\n\nSelect platform: [Android](/maps/documentation/maps-3d/android-sdk/add-3d-models \"View this page for the Android platform docs.\") [iOS](/maps/documentation/maps-3d/ios-sdk/add-3d-models \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/3d/models \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\n| This product or feature is Experimental (pre-GA). Pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. Pre-GA Offerings are covered by the [Google\n| Maps Platform Service Specific Terms](https://cloud.google.com/maps-platform/terms/maps-service-terms). For more information, see the [launch stage descriptions](/maps/launch-stages).\n\n\nYou can add your own imported 3D model to a 3D map.\n\nThe following code sample demonstrates how to add a 3D model and position it in 3D space using the [`Model` struct](/maps/documentation/maps-3d/ios-sdk/reference/Structs/Model). \n\n### Swift\n\n```swift\nstruct SimpleModelDemo: View {\n @State var camera: Camera = .init(latitude: 37.791376, longitude: -122.397571, altitude: 240, heading: 288.0, tilt: 88.0, roll: 0.0, range: 1500)\n @State var balloonModel: Model = .init(\n position: .init(\n latitude: 37.791376,\n longitude: -122.397571,\n altitude: 200.0),\n url: URL(string: \"\") ?? URL(fileURLWithPath: fileUrl),\n altitudeMode: .relativeToMesh,\n scale: .init(x: 5, y: 5, z: 5),\n orientation: .init(heading: 0, tilt: 0, roll: 0)\n )\n var body: some View {\n Map(camera: $camera, mode: .satellite) {\n balloonModel\n }\n }\n}\nprivate let fileUrl = Bundle.main.url(forResource: \"balloon\", withExtension: \"glb\")!.path\n\n \n```"]]