Konfliktverhalten von Markierungen konfigurieren
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Plattform auswählen:
Android
iOS
JavaScript
Sie können das Kollisionsverhalten von Markierungen anpassen, die Sie einer 3D-Karte hinzufügen.
Das folgende Codebeispiel zeigt, wie Sie die collisionBehavior
der Marker
-Struct konfigurieren, um festzulegen, wie sich eine Markierung verhalten soll, wenn sie sich mit einer anderen Markierung oder einem Kartenlabel überschneidet.
Swift
Map(camera: $camera, mode: .hybrid) {
Marker(
position: .init(
latitude: 37.794724,
longitude: -122.39442,
altitude: 100.0),
altitudeMode: .relativeToMesh,
collisionBehavior: .optionalAndHidesLowerPriority,
extruded: true,
label: "Marker 1"
)
Marker(
position: .init(
latitude: 37.7943220,
longitude: -122.395073,
altitude: 100.0),
altitudeMode: .relativeToMesh,
collisionBehavior: .required,
extruded: true,
label: "Marker 2"
)
Marker(
position: .init(
latitude: 37.7934108,
longitude: -122.396144,
altitude: 100.0),
altitudeMode: .relativeToMesh,
collisionBehavior: .requiredAndHidesOptional,
extruded: true,
label: "Marker 3"
)
}
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-08-31 (UTC).
[null,null,["Zuletzt aktualisiert: 2025-08-31 (UTC)."],[],[],null,["Select platform: [Android](/maps/documentation/maps-3d/android-sdk/configure-marker-collision-behavior \"View this page for the Android platform docs.\") [iOS](/maps/documentation/maps-3d/ios-sdk/configure-marker-collision-behavior \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/3d/marker-collision \"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 customize the collision behavior of markers that you add to a 3D map.\n\nThe following code sample demonstrates how configure the [`collisionBehavior` of the `Marker` struct](/maps/documentation/maps-3d/ios-sdk/reference/Structs/Marker#collisionbehavior) to specify how a marker should behave when it collides with anothermarker or map label. \n\nSwift\n\n```\nMap(camera: $camera, mode: .hybrid) {\n Marker(\n position: .init(\n latitude: 37.794724,\n longitude: -122.39442,\n altitude: 100.0),\n altitudeMode: .relativeToMesh,\n collisionBehavior: .optionalAndHidesLowerPriority,\n extruded: true,\n label: \"Marker 1\"\n )\n \n Marker(\n position: .init(\n latitude: 37.7943220,\n longitude: -122.395073,\n altitude: 100.0),\n altitudeMode: .relativeToMesh,\n collisionBehavior: .required,\n extruded: true,\n label: \"Marker 2\"\n )\n \n Marker(\n position: .init(\n latitude: 37.7934108,\n longitude: -122.396144,\n altitude: 100.0),\n altitudeMode: .relativeToMesh,\n collisionBehavior: .requiredAndHidesOptional,\n extruded: true,\n label: \"Marker 3\"\n )\n}\n \n```"]]