Create path for Kinematics bodies.

General discussion about the R.U.B.E editor
Post Reply
petititi
Posts: 2
Joined: Wed Dec 26, 2012 5:19 pm

Create path for Kinematics bodies.

Post 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
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Create path for Kinematics bodies.

Post 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.
petititi
Posts: 2
Joined: Wed Dec 26, 2012 5:19 pm

Re: Create path for Kinematics bodies.

Post 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!
metalbass_92
Posts: 18
Joined: Wed Dec 26, 2012 12:27 pm

Re: Create path for Kinematics bodies.

Post 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.
Xavier Arias
Cocos2d-x Game Programmer
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Create path for Kinematics bodies.

Post 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 :)
metalbass_92
Posts: 18
Joined: Wed Dec 26, 2012 12:27 pm

Re: Create path for Kinematics bodies.

Post 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
Xavier Arias
Cocos2d-x Game Programmer
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Create path for Kinematics bodies.

Post 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.
Post Reply