Genbox / VelcroPhysics

High performance 2D collision detection system with realistic physics responses.
MIT License
662 stars 114 forks source link

Importing SVG #57

Closed ghost closed 3 years ago

ghost commented 5 years ago

Hello! I'm facing SVGImport problems with SVG files generated with Adobe Illustrator CS6. Here is my file: https://www.dropbox.com/s/ra0uql2eh4asfjv/terrain1.svg?dl=0

I'm using MonoGame 3.7.1 and I think that problem is here: https://github.com/VelcroPhysics/VelcroPhysics/blob/master/ContentPipeline/SVGImport/SVGPathParser.cs in line 145

Genbox commented 5 years ago

I don't know what the different commands are for. Can you see which character that's not supported?

Also note that the code in this repo is under construction.

ghost commented 5 years ago

In my SVG it was 's' and 'S' characters.

Genbox commented 5 years ago

According to the standard, it seems to be smoothed cubic bezier curves which we don't seem to support. I didn't make the SVG importer, it was a contribution from a user, so I don't know how they usually are handled.

You can try to handle them like the C and c commands and see if that works.

Edit: From reading the text a bit C and c does not seem to be compatible, so you would have to implement support yourself or create the terrain using Bézier with the C/c commands.