Page 1 of 1

RUBE as object creator

Posted: Sun May 03, 2015 12:21 pm
by milos
Hi,

RUBE is great tool. But i'm not quite sure how to do what i want. So, i have dynamically created world within my game, terrain is randomly generated. And i want to use RUBE as obstacle designer. So i would like to create obstacles made from multiple bodies/joints, but the thing is that i would also like to move it as a single object, and not every body separately. So for example if i have a ramp with an elevator i would like to spawn all of the on specific location, since my world is randomly generated, and render appropriate images for each body.

Is it possible to do something like that ?

Thanks

Re: RUBE as object creator

Posted: Mon May 04, 2015 3:21 am
by iforce2d
Hi Milos

Box2D does not have any concept of an 'object' made of multiple bodies, so the only way to move a structure of bodies is to move all the bodies that are part of it. You can make a RUBE scene for each of your objects and move all bodies in that scene after loading. This thread might be helpful: viewtopic.php?f=6&t=379

Re: RUBE as object creator

Posted: Mon May 04, 2015 10:05 am
by milos
Yeah i know,

I ended up modifying b2json file with additional parameter (b2Vec2 position) and when loading a single json file/string, i just pass position where i want to be spawned, of course this is applied to all bodies from single file.

Thanks :)