Javascript (box2dweb) loader

General discussion about Box2D tutorials
Post Reply
seastjun
Posts: 1
Joined: Fri Nov 29, 2013 1:04 pm

Javascript (box2dweb) loader

Post by seastjun »

Hi Iforce2d,

Thanks for your box2d editor and tutorials.
I have some simple questions about the custom properties. You mentioned that we can retrieve a list of all items matching a given value with the getXXXByCustomProperty() functions. But I think only the "Bodies" could replace the XXX part. I also checked the loadrube.js , and there's no getFixturesByCustomProperty() functions. Is that possible to get a complete loader file?

And I'd like to know after I load the scenes from .json file, how can I change the fixture which I created by the box2d editor. Actually, I want to add some body to the world created by the editor.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Javascript (box2dweb) loader

Post by iforce2d »

Yes, you are right about there being only the 'bodies' version of the getXXXByCustomProperty. I will have to add some versions for other item types.

It should be no problem to add extra bodies to the world after you load it. If you are using the loadWorldFromRUBE function, that function returns the world as a variable, which you can then use as normal to do other things.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Javascript (box2dweb) loader

Post by iforce2d »

I have added the getXXXByCustomProperty functions for fixtures joints and images, you can get it from github.
Post Reply