Need help making a motorized wheel

General discussion about the R.U.B.E editor
Post Reply
bvargish
Posts: 26
Joined: Fri Oct 02, 2015 4:17 pm

Need help making a motorized wheel

Post by bvargish »

I need help making a motorized wheel. I'm using R.U.B.E. with the Box2D plugin for Phaser. I tried getting help at http://www.html5gamedevs.com/topic/1770 ... 2d-plugin/ (more details are in that post) but haven't had any luck.

I have a wheel body, a gear body (a smaller circle on top of it) and a revolute joint with a motor. I can't seem to get this to work either in R.U.B.E. or Phaser. I can get the wheel to spin if I make the joint in Phaser as seen in the fore mentioned post, but it doesn't grip the ground even if I crank up the friction. I'm using the same method I did in my Flash version of this, so not sure what's up. I'm stuck! Any help would be much appreciated.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Need help making a motorized wheel

Post by iforce2d »

You have non-zero friction on both the ground and wheel fixtures right?

I'm assuming you have seen these?
RUBE loader for Phaser Box2D plugin tutorial
RUBE loader for Phaser demos

From about 33:03 in the video, I show an example of getting a reference to the wheel joints of a car to control them. You should not need to make anything manually in Phaser.
bvargish
Posts: 26
Joined: Fri Oct 02, 2015 4:17 pm

Re: Need help making a motorized wheel

Post by bvargish »

Thanks for your reply!

Yes, I watched that video and looked at the examples, but I was getting confused because my wheel isn't anchored to an external body. The gear is at the same position of the wheel, like it's internal to it. I also wasn't sure whether to use a wheel joint or a revolute joint.

Anyway, I figured out what was up. In my original Flash game, I was using a motor speed of 3, which for some reason isn't enough to propel the wheel in this new environment. The gravity, density and friction settings of everything seems to be the same. I'll have to look into this further if I need to get it working exactly as before, but I think I can deal with it by tweaking the motor speed.

Also, I experimented with using a wheel joint vs. a revolute joint and noticed the gear body bouncing around in the wheel body if used a wheel joint. Since I don't need any sort of shock absorber effect I went with the revolute joint, which kept the gear pinned to the middle of the wheel.
Post Reply