Jump to content

Phaser Box2d Top Down Car, more advanced model?


jjvelmar
 Share

Recommended Posts

I just bought the Box2d Premium Plugin and am happy with it.  I definitely has some good examples including Top Down Car, which will make my life easier to getting my project going.  I was wondering if anyone had a more advanced Top Down Car model that accounts for the wheels turning and making things more realistic?

 

I found a great example already using Box2d online at...

http://www.emanueleferonato.com/2009/04/06/two-ways-to-make-box2d-cars/

 

...but it does not use Phaser, just Box2d and something for web (?flash?).

 

Can someone help me to make sense of the non-Phaser Box2d code and how to "convert it" or provide some example of how to make a top down car game with Phaser and Box2d that is more advanced than the one that comes with the Premium examples.

 

I think it has to do with making the car body, 4 wheels, joint, and Killing the Orthogonal velocity (applies a "friction" in a direction orthogonal to the body's axis)

Link to comment
Share on other sites

I just did a small top down car project. I'm not able to walk you through the whole process, but I can tell you where I ended up starting. This person took Feronato's Flash example and adapted it to box2d's stand alone javascript port:

 

https://github.com/domasx2/gamejs-box2d-car-example 

 

It was a little bit of work adapting this demo, which uses the standalone box2d js library, to use the Phaser version. The differences between the Phaser and the standalone versions are not huge, but there was some trial and error.

 

For example, I believe the y axis is inverted in Phaser relative to the stand alone version.

 

Also, if I recall correctly in the stand alone version the methods for controlling/getting data from a body are all on the 'body' object, whereas in the Phaser version some of those methods are moved to a body.data object.

Link to comment
Share on other sites

  • 7 months later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...