GameDemon Posted October 25, 2015 Share Posted October 25, 2015 Hi, I want to create a physics body for a simple shape - basically a hollow rounded rectangle. My PhysicsEditor trial has expired (installed it then didnt use it for a month, woops) and I can't see a good alternative to use :-(. However, as the shape is simple I thought that if I use a vector graphics app like Adobe Illustrator I could copy down the coordinates of the points and make my own JSON file. Are there any considerations for doing this? I assume the polygons have to be convex, So I should make shapes with 3 or 4 vertices. Could anyone give me a quick rundown of the JSON, ie what ranges the density/friction/bounce values should be in, and if I need to set the filter.{"density": 2, "friction": 0, "bounce": 0, "filter": { "categoryBits": 1, "maskBits": 65535 },"shape": [ 128, 880 , 112, 896 , 112, 176 , 128, 176 ]} Link to comment Share on other sites More sharing options...
chongdashu Posted October 25, 2015 Share Posted October 25, 2015 Perhaps a good starting point would be to take a look at the parameters that PhysicsEditor uses. Link to comment Share on other sites More sharing options...
GameDemon Posted October 25, 2015 Author Share Posted October 25, 2015 Thanks a lot for the link chong, I will make a separate post on parameters because I have loads of questions about that... confused. One heads-up for people creating the polygon vertices manually, they need to be defined in clockwise order (even though the error says 'anti-clockwise') Link to comment Share on other sites More sharing options...
AndreasLoew Posted October 25, 2015 Share Posted October 25, 2015 @GameDemon - Contact me at support at codeandweb.com - I can extend your trial license. Most of the parameters are currently not used - this is because the reader only loads the vertex data. It's easy to extend the importer to make use of the parameters - but I had not time to work on it yet. About creating the data manually: * make sure you use the right winding order * make sure your shapes are convex - if you have concave objects split them into convex ones Btw. we've creates a short tutorial that should help you with the setup of a simple physics game here: https://www.codeandweb.com/blog/2015/10/07/phaser-p2-physics-example-tutorial Link to comment Share on other sites More sharing options...
GameDemon Posted October 25, 2015 Author Share Posted October 25, 2015 Many thanks Andreas that is very kind :-) Ah so the parameters aren't used - that explains a lot.I'll check out the tutorial, it looks interesting... Link to comment Share on other sites More sharing options...
Recommended Posts