kandi X-RAY | MapKit-Swift Summary
kandi X-RAY | MapKit-Swift Summary
MapKit-Swift
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of MapKit-Swift
MapKit-Swift Key Features
MapKit-Swift Examples and Code Snippets
Community Discussions
Trending Discussions on MapKit-Swift
QUESTION
Trying to figure out how I create a SCNGeometry with polygon as primitiveType, My goal is to add polygon shaped node as a child of a sphere node, and make it look like MKPolygon for map kit, like in this example.
My current code is:
...ANSWER
Answered 2019-Jul-07 at 18:27You have two problems:
SceneKit (and Metal) only support 32 bit integers as indices (source). So the type of your indices array needs to be
[Int32]
.SceneKit needs two pieces of information for polygons: The number of points in the polygon and the index of the point in the vertex array. From Apple's documentation on
SCNGeometryPrimitiveTypePolygon
(which only exists in Objective-C):
The element’s data property holds two sequences of values.
- The first sequence has a number of values equal to the geometry element’s primitiveCount value. Each value in this sequence specifies the number of vertices in a polygon primitive. For example, if the first sequence is [5, 3], the geometry element contains a pentagon followed by a triangle.
- The rest of the data is a sequence of vertex indices. Each entry in the first sequence specifies a corresponding number of entries in the second sequence. For example, if the first sequence includes the values [5, 3], the second sequence includes five indices for the pentagon, followed by three indices for the triangle.
You need to change your index array to:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install MapKit-Swift
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page