Community Tutorial: Motorbike (Motorcycle) Physics with Chaos Vehicles - UE5

Step by step guide on how to implement motorbike physics with Chaos Vehicles in Unreal Engine 5.

Feedback/comments/requests are welcome!

https://dev.epicgames.com/community/learning/tutorials/LnDB/unreal-engine-motorbike-motorcycle-physics-with-chaos-vehicles-ue5

4 Likes

Hi Marco, great tutorial, thank you so much. I’m having some issues and I’m trying to solve them, especially regarding the torque, torque curve, and the basic setup of the vehicle.

First of all, I started from a different model and I’m trying to use real data (weight, power, curve, etc.). For example, when I try to decrease the torque to 120, the bike remains completely still. I’m also struggling to properly set the torque curve, and I don’t understand the unit used for time (X-axis).

Another issue is that the bike jumps with every gear shift, and overall it doesn’t feel as smooth as in your video :frowning:

Hi Federico,
the X axis for the Torque curve is RPM. The Y axis is the normalized Torque (Max Torque is set specifically in the parameters below the curve).
Difficult to tell what could be wrong in your setup and there are many variables to take into account. May I suggest you follow my tutorial as is, make it work and only later try to make changes to it with your own motorbike.
Also when you experiment change one parameter at a time, otherwise it is easy to get confused and break the physics.

2 Likes

Hi, Marco, thank you for this tutorial.

I ran into a problem.
Wheels in a direct collision fall into the ground.
They fall at the lightest collision with the wall.

I will be very glad of your answer.
Thank you.

The problem is described in more detail in my post:

Honestly I have never seen that issue with the sinking wheels, it looks like the collisions are not resolved properly when the hit happens. Can you try to switch from single raycasting to sphere traces within each wheel BP and see if that makes a difference.

Also in your images I see a raycasting under each wheel. Is that something you are doing? What is that for?

I am using Spherecast in each wheel BP:
image

If I change to a Raycast, it will partially fix the problem, but there will be very sharp jumps (when hitting the wall) and the behavior of the wheels will be worse than with the Spherecast.
When using a raycast, the wheels enter half into the wall.

I added red rays to track the center of the wheel, they don’t affect anything.

Does your motorcycle have such a problem ?

Thank you very much for your response and for your support !

I have not noticed such a problem so far. You can try to switch to async physics and use a lower delta time, but also increase the position and velocity iterations in the Chaos Physics Solver (under Project Settings → Physics). See if that makes any difference.

I apologize for such a long answer.

This slightly improves the situation but does not fix it completely. And if you set the delta to 0, then physics slows down.

Do you also have this problem in your project when using “Spherecast” ?

Thanks for the answer.

You cannot set the physics delta time to 0, that will indeed make everything slow down. Setting it to 1/90 or 1/120 should work. Sphere cast is a tad more expensive than raycast but it should be more precise for your use case.

You should try visualizing the collisions the physics engine sees and check them out. Use these commands at the console:

p.chaos.debugdraw.enabled 1
p.chaos.solver.debugdrawshapes 1

Hello Marco, first of all, thanks for this tutorial, it helps a lot.

I’ve been following the tutorial with your Bike and everything works well, but whe I’m trying to use my custom Bike, I don’t know what values should I put to avoid issues.

I’m also wan’t to avoid th steering Y rotation in the front wheel and I’ve hace a problem with the Animation Blueprint.

This is my Motorcycle:

When I put the Animation Blueprint with the Wheel Controller node, thw wheels fall down a little and It doens’t look well:

I want to know if is possible to avoid the Y rotation wheen steering, without loosing the steer rotation:

image

And the most annoying thing is this jittering or shaking when the bike is stop, it always starts fine, but when I turn or move, it shakes a lot:

Jittering

I don’t know what causes this, I’m trying with the Friction force Multiplier from the Wheel BP and Override the center of mass in the Chaos Vehicle BP.
The Wheel Pyshics assets radius and Wheel BP are the same.

Any ideas what could cause it?

Thanks a lot!

1 Like

Thanks for the tutorial, learning a lot. How applicable would this be to a mountain bike?