Rocket platform

General discussion about the R.U.B.E editor
Post Reply
alexr
Posts: 3
Joined: Mon Apr 14, 2014 10:17 pm

Rocket platform

Post by alexr »

Hi,

I downloaded the RUBE trial version but I can't find the Rocket Platform example there ( http://www.iforce2d.net/blog/2012-11-26 ).

Is the source code available in the paid Rube editor? If not, could you please publish it?

Cheers,
Alex
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Rocket platform

Post by iforce2d »

No, it's not really related to RUBE at all. Come to think of it, I don't know where the source for that is now. I could take a look for it, but in the meantime, what was it about that particular demo that you were interested in? I think maybe I did actually make the body in RUBE, but it was only a handful of fixtures that could probably have just been hand-written in source code.
alexr
Posts: 3
Joined: Mon Apr 14, 2014 10:17 pm

Re: Rocket platform

Post by alexr »

Could you please try to find the code? I'm buying RUBE anyway :).

I'm interested in the guidance system for the platform, as I'll need to implement something exactly like it and it'll save me the effort of figuring out what you did. Your implementation seems very good to me, since it almost emulates what a person would do.

I have little experience in Box2D (I'm using Unity with its encapsulation of it) and I'm revising basic physics concepts right now, so it would surely take me a while to get to the level of implementation that you had in that example.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Rocket platform

Post by iforce2d »

I see. That part I do remember, it was very simple. The little rocket at the bottom of the platform in the middle fires either one way or the other, depending on which way the platform is currently tilting (eg. when the platform is tilted to the left, the little rocket will push toward the left to generate a clockwise torque, and correct the tilt). The other two large rockets will adjust their power depending on the dot product of their thrust direction and the desired direction of movement. For example if the platform is not tilting, and the desired direction of movement is 45 degrees up and right, the left rocket will thrust at 100% because that would make it push the platform perfectly in the correct direction. There is a 'lookahead' time of a couple of seconds, meaning that instead of using the current position/angle to calculate the thrust, the future position/angle of the platform is used, which stops it overshooting the target by too much.

You can find the source code attached here, but don't be disappointed that it is not commented well and I may be a bit sluggish to explain it more than I just did above. Even if I could remember the details of it now, I like to make a clear distinction between source code that I am putting forward as a tutorial which will be (hopefully) well commented and easy to follow, and other things like this just done for fun as a blog post, which would only provoke a flood of questions and was the reason I did not put it up in the first place :) Anyhow, thanks for purchasing!
RocketPlatform.h
(22.95 KiB) Downloaded 756 times
You can add this to the regular Box2D testbed as a 'test' entry (at least for Box2D 2.3.0 and earlier, I have not tried the recently updated testbed with new GUI yet).
alexr
Posts: 3
Joined: Mon Apr 14, 2014 10:17 pm

Re: Rocket platform

Post by alexr »

Thanks!

Your code is fine (just got it running), and your description and your code are more than sufficient for me, so no more questions :).

Cheers,
Alex
Post Reply