swift - PhysicsEditor Polygon Path to CGPath -


is there way can export physicsbody polygon path physicseditor (from code , web) cgpath? feel there may easier way me manually convert (72, 429) , (77, 423) , (77, 425) , (-64, 437) ... [cgpoint(x: 72, y: 429), cgpoint(x: 77, y: 423) ... etc. can't find info online. thanks

edit: have figured out way in xcode playground using string.replacingoccurrences(of:...

you can make own extractor template , extract plist of strings read nsarray.

now not going go on process, can check out resources on @ code , web see how make that.

the string must in {x,y} format

once have in plist format, can load nsarray, , iterate through array so:

let polygon = cgmutablepath() polygon.move(to:cgpoint.zero) let array = nsarray(filenamed:"polygon") strpoint in array {    let point = cgpointfromstring(strpoint)    polygon.addline(to:point) } polygon.closesubpath() 

'note if need example of how plist should nsarray, can create 1 via new file method, , open in xml capable text editor.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -