Jreo - "Realistic" Car Physics

This is my first ever topic. I’ve came here and started reading some posts related to the BGE (mostly car games) for 2 months and I have found that I actually gained slight recognition for making the physics on YouTube. So I guess it’s time for me to appear more often.

First attempt (2017-2018)

It was very messy, empties are all over the place, very physics-intensive, and it’s no where “good” in my perspective anymore. Though I’m delighted that someone actually used it but I’m always worried about how it performs.

I then stopped working on it in 2019 because I was working on an arcade racing game (which I will start a topic about it soon)

Second attempt (mid 2020)
https://twitter.com/jreo03/status/1269281521560502272
It’s starting to get easier in terms of setting up, which are: adding more wheels, adjusting suspension stiffness, and connecting them to the drivetrain. Physics are slightly more accurate (using Live For Speed as a reference). But it is still limited to some physics solvers in both BGE and UPBGE, and it’s still confusing to use.

Third attempt (late 2020)
It’s currently being made, there is no footage of it yet but it’s already available to download (was privately on discord: https://cdn.discordapp.com/attachments/728919644894920765/785752985372065822/RCPOptimized.blend currently using multitexture)
It’s made in BGE 2.76 but it also works on UPBGE with any physics solvers (as tested). It is still trying to achieve realism even at just 75%. Best part is: it has 0 rigid body joints, only raycasts doing the job of a suspension. But it is still potentially logic-intensive. Please do note: The car body still can’t collide with anything yet. Attempting to add a collider with the obvious methods would mess up its rotation speed. Ability to easily tune the car is also being worked on.

So anyways, this is basically aimed to be an alternative to blender’s vehicle wrapper, and it could be used on race tracks, streets, and off-road too but not the rocky ones.

You could ask about anything here.

7 Likes

Welcome to BA! : D

This looks really cool, I tried it and it was really fun : D

I tested it with UBPGE 2.5a as that is the version I use at the moment. It worked, but I had to add a sun lamp to get the textures to show.

Looking forward to your future works! Ø__^

1 Like

Thank you. I am currently still mastering the physics since the tires are prone to lose traction a lot, making it nearly impossible to correct a slide even at moderate speeds smoothly.

Currently re-coding it entirely. (no engine for this one yet)
It will all be done sometime before December 21st.

3 Likes

BTW I also made a little game dedicated to the physics itself. It isn’t near 10% done at all and it was made just before the plan to redo the physics.


The car slides more than it should when letting off the gas. Lift-off oversteer usually happens on FWD cars but this one seems unnatural as for now.

Soundtrack: MSR - Club Paris

3 Likes

the fps is good ?

Yes.
Runs at 60fps the whole time I wasn’t recording with the Outside parameter at around 30%.

So I’ve met my deadline and unfortunately the re-code didn’t work as I wanted to when I added the engine. Instead, I’ve done something to the current version to stop the deadly oversteer. The physics are still not close to accurate and some core features aren’t really done yet so it’s still gonna be hard to inspect and use.

Also it can now collide with anything and I also added a turbo feature (find in engine.py)
RCPOptimized updt.blend (1.0 MB)
Controls are pretty much the same as the previous version of RCP if you didn’t know.

1 Like

very cool, can i use it in my game ? i will give you credits ofc

1 Like

Sure! You’d want to check back here regularly for updates just in case.

2 Likes

I worked on it a bit to make Scandinavian flicking a bit easier to execute.

I’ve also written a documentary thing which can maybe help. Current issues are listed within.
RCP050.blend (1.1 MB)

1 Like

for the HUD you use text objects or BLF ?

Text objects. I only use the HUD for debugging and stuff.

Hey bro, thanx a lot for the file, i have been playing and learning from your files from the beginning of my BGE journey, since 2.79, glad to see you back. Now i upgraded to upbge 3.0 and i am trying to update some old bge files to work into upbge 3.0. What do i have to change to make this work in upbge 3.0 ?

My guess:
Remove the HUD scene and every lines in the codes related to bge.logic.getSceneList()
The wheel positions are buggy on 0.3.0 so you might want to work around with it.

Updated the tire physics a bit.
Most of the misc are moved to RCP_Addons.py, meaning that sounds, lights, UIs, etc. are now independent from car.py.
RCP055.blend (1.1 MB)

Alright I managed to get it working on UPBGE 0.3.0 just by disabling access to the numpy module.
RCP057.blend (1.1 MB)

Disable this controller to prevent the game from spamming errors when using UPBGE 0.3.0.
image

How we can switch FWD to AWD or RWD?

There’s a Connection property on each wheel.
Ranges from 0 - 1.

1 Like

Thank you for reply, I have another question:
Is it possible to change control of vehicle to arrows or any custom button?