Can Custom Collision Shapes be done on a Txt File?
dimsdale
Member Posts: 499
I really, really need custom collision, but the things is, I really only need a smaller box size, a rectangle will do.
Can I just use a simple txt file or code sniped and import that?
If so, how?? Are there any examples around?
Cheers!!!
Comments
Not that I know but why not use the Physics Body Editor -- it's free and super easy to use when it's installed.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
can't work out how to install it ;(
You could generate some json manually that would work, but why not just use PBE? Gui is nice to have for setup.
If you wanted to go the all txt route. The structure would be something similar to:
{
"rigidBodies": [
{
"normalized":false,
"rescale":false,
"origin":{"x":0,"y":0},
"size":{"width":0000,"height":0000},
"polygons": [
[
{"x": 0, "y": 0 },
{"x": 0, "y": 0 },
{"x": 0, "y": 0 },
{"x": 0, "y": 0 }
],
]
}
The width and height and the four points (vertices) would need values added. More points could be added following the same structure. Save it as insertname.json
Edit: Btw the width and height refers to the actors size you intend to put this in. It should be full retina values if you are working in a retina project instead of half.
Follow us: Twitter - Website
@dimsdale get the version of Physics Body Editor from here (half way down the page, red link, "here is a version" ) it is wrapped with the Java 6 runtime so will work regardless of how fubar or not your own Java installation may be.
@dimsdale ,
Physics Editor isn't that bad, and it's only $20 including future upgrades. If there's a nitpick I have with it, it's that I have to select GameSalad every time I want to publish the json file. If you decide to continue using GS, it's worth considering IMHO.
My Blog / App Store / Google Play