I thought I might share this super simple script I made that lets you convert anything into a Codea body or vec2 object. Here’s what you do:
- Generate your code:
- PhysicsEditor: Create your body, make sure the anchor is in the middle of the body, export the code in plain text, and copy the sets of numbers under “Hull polygon”.
- Anything else: You can use anything that has sets of numbers, separated by anything, as long as there is an even amount. Simply copy that set of numbers.
- Go to my script here: http://labs.codecademy.com/BVWZ/62#:editor
- Run the script
- Paste the set of numbers
- Select your scale - There are some things you can do with this option. I like my objects in UV coordinates, or at a certain size, so simply leave the field blank if you want it the size defined in the numbers, or put a number for the size you want the object to be, so for UV coordinates, put 1.
- Copy the code - Simply select all the vec2s that the console returned (without the quotes), and paste that wherever you like.
So, for example, here’s what I’ve done with my app:
I hope this can help you a bit with your physics apps.
P.S. I have been able to achieve making physics bodies from SVGs, as long as there isn’t any curves.
P.P.S. Feel free to fool with the script to suit your needs. If you do, I’d love it if you shared it here.