Page 1 of 1

Create path for Kinematics bodies.

Posted: Wed Dec 26, 2012 5:31 pm
by petititi
Hello,
I'm currently looking for a box2d editor, and you software seems to cover all my needs. The only feature I could not find is the possibility to create/modify trajectories for kinematic objects. Before buying the full version, I would know if this is something you could add to R.U.B.E.? If not, how could I do with your tools?

Sincerely,
Petititi

Re: Create path for Kinematics bodies.

Posted: Thu Dec 27, 2012 8:37 am
by iforce2d
There is no specific feature for this at the moment, but there are a couple of ways you could get a similar effect.

The simplest would be to place some bodies around the scene with names that identify their position in the sequence, as in the 'rocket platform' demo (http://www.youtube.com/watch?v=vYsFVHNavR0#t=2m30s). In that demo I have kept the bodies in the scene because I want to move them around, but for a static path you could just get the positions of the bodies after loading and then destroy them.

If you have a large number of points in the path, it might be easier to make a fixture with a 'line' shape to define their positions. After loading you could get the positions of the vertices of the chain shape that this becomes, and then destroy the fixture.

Neither of these is really a perfect solution, but I think they would work ok. In future I am hoping to add the ability to make arbitrary notes/comments/markings on the scene, which are not physics related and would serve only to help the user sketch things out when creating a scene. I was thinking to have just simple lines and text comments, but if these markings could also be a sequence of points it might help with what you are talking about.

If you try the second method I suggested, but are unsure about how to get a list of points from the fixture after loading, let me know and I will make a function (C++) for it.

Re: Create path for Kinematics bodies.

Posted: Thu Dec 27, 2012 4:38 pm
by petititi
Thanks for these tips, I will try the second method. But the ability to add comments (like the speed of the platform in my case) would be very helpfull.

Thanks again for your tools!

Re: Create path for Kinematics bodies.

Posted: Sat Dec 29, 2012 10:11 am
by metalbass_92
The way I understood the "Markings, comments" feature description, they shouldn't get to the final Json file, right?

When i've read your last post the first thing that came to mind was the "Custom Properties" feature. If you create a set of dummy objects that act like path nodes you could assign a speedUntilNextNode property or whatever you need to it.

Re: Create path for Kinematics bodies.

Posted: Sat Dec 29, 2012 2:20 pm
by iforce2d
Good point, these comments may or may not be desired in the final output. I think there will need to be some options added, so the user can choose which data goes into the final json.

Yes, custom properties will make things like that possible. If you also used properties to store the next node in the sequence (by name etc), I guess you could even have a branching path :)

Re: Create path for Kinematics bodies.

Posted: Sun Dec 30, 2012 12:18 am
by metalbass_92
It would be awesome to be able to select bodies in the custom properties the same way that's done when assigning a body to a image :D

Re: Create path for Kinematics bodies.

Posted: Sun Dec 30, 2012 5:17 am
by iforce2d
Yeah, I was thinking about that yesterday. For the first update there will be int, float, string, vec2 and bool properties available. You could use a string to specify a body by name with this.

Perhaps in future an expansion could be made to allow properties that are a reference to some other item in the scene.