WIP: Advanced Vehicles

WIP: Advanced Vehicles

Please understand that this is a work in progress and is updated as my time allows. I made this for fun. It is released as open-source for those that wish to develop a car game and would like to see some kind of demonstration of how to go about developing a car in jMonkeyEngine. Contributions are welcome!

Store Link: https://store.jmonkeyengine.org/4477514f-a3ae-4d42-b928-d3a62335159f

An advanced implementation of vehicles for jMonkeyEngine.

This is a work in progress of creating individual parts for a vehicle. Currently implemented (but may not be fully implemented) are:

  • Engine
  • Brakes
  • Automatic GearBox
  • Wheel
  • Tyres
  • Suspension
  • Speedometer
  • Tachometer (rev counter)
  • Skid marks
  • Tyre Smoke
  • Engine Audio
  • Vehicle Editor

There are 5 cars to play with.


  • WASD : forward, left, brake, right
  • Y : Start Vehicle
  • R : Reset Vehicle
  • H : Horn
  • E : Reverse
  • F5 : Change View (use numpad in 3rd person mode to change view angle) .
  • ESC : Exit Game

Pacejka Data

The tyres use the pacejka formula. Currently only latitudinal forces are applied, but longitudinal code is there. There are probably a few more things I can’t remember.

The project also contains a Pacejka Viewer/Editor so you can create tyre models yourself. This is particularly handy if you want more of an arcade or simulation feel.

Play The Game

Download from GitHub Releases: https://github.com/jayfella/jme-vehicles/releases

Double-click the .jar file to run the game.

Source Code

The complete source-code with models is available on github.


i thought you will make some final game from it :slight_smile:

because it looks nice. really. i understand its not “natural behaviours”

It can be a simulation if you want to spend endless months perfecting every single number. You could probably get somewhere near without a great deal of messing around. Personally I’m just having fun.

I have included a download link in the main post for those that just want to download and run the game.

1 Like

The tech-demo has been updated.

  • Entire scene now uses PBR instead of the regular Lighting.j3md
  • Two new professionally modelled cars.
  • Choose vehicles in-game at any time.
  • Debug screens are toggleable.

The game is now available to download from Github Releases. The main post has been updated with the new details, screenshots and a video.


Wow! This is now starting to even look beautiful :slight_smile: I’d suggest adding shadows if you want to go for that realistic look, since that’s all that is really missing for it


This seems like just what the doctor ordered.

I have some questions. Feel free to redirect me to the code or documentation. I’m partly asking them in case there are easy answers or it leads to further discussion… but mostly just so I don’t forget to look up the answers myself if I have to.

I assume that you are not using bullet’s vehicle control and this is custom.

Do you know if it works with jbullet or only native bullet? (I had problems with jbullet in my world with the car not moving at all… even though jbullet works fine in the TestFancyCar.) Edit: the reason I ask is because I would really prefer to use jbullet for ‘reasons’.

What is the licensing on these with respect to commercial use?

I take this to mean that acceleration and braking does not factor into grip? But the code is there… If it works that would be good as I think it’s pretty important with respect to braking/acceleration on turns, front wheel vs rear wheel, etc…

Random comments after watching the video in the first post… so excuse me if these are fixed in later versions. (I will look deeper into all of this hopefully later tonight.)

I agree with grizeldi regarding shadows. Adding the directional light shadow renderer and setting the cast/receive would really make this pop. In my own prototype, it was crucial for knowing when the car is/isn’t on the ground. Yours look like they are floating until they leave the cool tire tracks.

Also, you might consider altering your grid texture to have more variation between the levels of grid lines. Like, really dark on the LARGE grid and a medium level and the smallest being almost invisible. The only reason I saw this is because in the video it just ends up strobing and it’s hard to tell if the car is moving forwards or backwards at some points.

I had this same issue with my bullet character demo. Jaime looked like he was running around backwards until I increased the grid size.

But these are really minor nits on the demo. The tech itself looks super cool.


It uses the Bullet PhysicsVehicle. Its extends its functionailty. For example the PhysicsVehicle provides an accelerate function and I pass it through a graph to determine how much power it delivers at x revs. That’s pretty much how each “extension” of the PhysicsVehicle works.

It works with native bullet, jbullet and the minie library by @sgold .

Regarding the professional car models:

I got them from sketchfab. If you find a vehicle you like in particular with a license that fits what you want I don’t mind adding it for you.

In order to use both lat and long forces the developer also has to include a “friction circle” - which I did begin to implement, but kind of ran out ot time and entheusiasm, and must admit I did struggle a little trying to provide the feedback the formulas require.

It takes a lot of tweaking. I could spend more time on getting them working. I guess the more interest the library has - the more interest I’ll have in continuing its development.

To actually add a car to a game, you just need to add the CarSelectorState to the stateManager (or just look at the setVehicle method in that class):

stateManager.attach(new VehicleSelectorState(scene, physicsSpace));
// ...
Car tourer = new GrandTourer(app);
tourer.getVehicleControl().setPhysicsLocation(new Vector3f(x, y, z));

Note that the scene you pass is the one the car will be added to, and usually has a lightprobe affecting it. I create my scenes with my intelliJ plugin and generate/save a lightprobe in the scene - which is faster than generating one at runtime - so it’s not necesarrily always “rootNode” that you pass as the scene.

1 Like

I’ve added the shadows and SSAO. Took me a short while to realise the skybox was stopping the shadows working. Had to set it to shadow-mode off.

Fixed the 3rd person camera. Just use the mouse to drag rotate.

Tweaked the Nismo car. The wheels are positioned better and the suspension is more in-key with how it’s supposed to work.

Did a bunch of bug fixes, mainly related to debug data not working when you changed car.

I’ll push a new release in a few days when I’ve tweaked the tourer and added another vehicle. I’m most likely going to replace all the simple models with professional ones, and maybe more variety (bus, monster truck, etc).

All changes are available on github.


I’ve begun to implement longitudinal forces. You will notice now that if you accelerate through a corner you are more likely to skid if you are at high speed and/or rear-wheel. I still need to include braking in these factors, but you can powerslide and recover and not accelerate around corners to avoid sliding, so it’s definitely on its way.

I’ve added the ability to specify wheel models, so each car can use any wheel - they are not model-specific anymore. This basically means that you can swap/upgrade wheels on the fly.

I changed the grid texture to a marble tile instead. The grid was hurting my eyes after a while.

The skid marks now have an alpha value, so light skids make light marks and heavy skids make darker marks. Notice now how they “fade off” instead of abruptly starting and stopping. Pretty cool.

All changes are pushed to github as usual. Until I release an update you’ll have to pull from master if you want to try it out.


I wish I could like your post more than once. :slight_smile:


Thanks, man. There’s still a lot to do but it’s definitely fun. The vehicles wheelspin but the gearbox changes when it redlines, so they change instantly. I think it will feel a lot nicer when I fix that so it changes at the right speed and you can tell it’s wheelspinning. Damage would be cool. I guess it never ends :confused:


Wow! this looks awesome!!!

What happened to the GitHub repo? Did you take it private or delete it?

forked: GitHub - oxplay2/jme-vehicles: A vehicle tech demo for jMonkeyEngine
but im not sure if this is it. currently Riccardo is host lead seems.

1 Like

Thank you, @oxplay2 and @Ali_RS, for your forks!

I’m still puzzled by the sudden disappearance of so many repos…

1 Like

From what I could tell on discord, Riccardo was questioning the hosting costs with Jayfella again. From reading other forum threads it looks like Jayfella has been looking to exit the community because of the lack of growth in jME and that whole discussion prompted him to throw up his hands and he transferred all the server admin stuff over to Riccardo and dropped all his repos from github. He removed all his repos last time this happened so I’m not sure if you should expect them back.

1 Like

no worry, i have most crucial repos forked, since i expected this.


I’m disappointed about the SDK he was working on. I had my particle system running inside of it and was just working on the curve editor. The existing SDK has been a pain to try to create a plugin for so I was hoping for something easier.


yes, i were waiting to use it, when it would be more extended. The only bad thing i didnt like was it was JavaFX not just lemur.

Anyway is it this one: GitHub - oxplay2/JmeSDK: A completely custom SDK for jMonkeyEngine using JavaFX. ?

1 Like