How do I rig a motorcycle?

I need to move my motorcycle, but I am unable to do so. The 2 wheels don’t rotate and the bike falls into the ground event though the physics assets and Wheel data is setup properly.

Does the WheeledVehicle class require 4 wheels to work? Does it not work with 2 wheels? If that is the case, what is the correct solution? Should I “fake the 2 extra wheels”? Or do I need to change some C++ code?

Any help would be useful! Thanks in advance.

Were you successful at this job or not yet resolved? If so, could you explain how you solved it?

Still interested in that too. I tried several ways, but none is really good.
Although I don’t have solution, I strongly believe that using standard PhysX functionalities can’t do the job. I’m now investigating on some hand made solutions… But if someone has any solution that leads to an almost realistic behavior, I would happily take it :slight_smile:

I won’t explain all the ways I’ve tried, but the major ones (others are some variants). Maybe it will help someone finding the right solution or unlock my mind…
Just to make you understand why I’m searching this level of detail, I’m trying to achieve a MX, SMX, FMX, & SuperMoto game, with bumps and so on… (I’m a “pilot”)

  • Using skeletal mesh & PhysX, bike frame as root, wheels axis as leaf.
    → This was very promising. But I resigned myself in aborting working on this solution. In most setup I’ve made, the physical constraints where often breaking for unknown reasons. also, I had to use spheres has simple physical proxies for wheels and a simplified mesh of the wheels for the complex proxy. That leads to floating wheels above the ground in some cases. Using only the wheel mesh has proxy leads to non fluid rotation because of the mesh is made of flat triangles, not just a mathematical function as the PhysX sphere is. One last thing, due to the physical constraints often breaking, I couldn’t manage to simulate the diving tubes of the forks, only the rear swing arm: Translation constraints are breaking very quickly and the front wheel is getting away from the frame…
    In order to make the bike standing up when not moving forward, just lock the right axis at this moment. When the bike is moving forward, PhysX do the job to keep it up or lean in the turns… but thanks to the sphere proxies, the wheels are flying above the ground.
    I tried several variants of this solution using more or less complex skeleton, having the rear wheel axis as root up to the front wheel as leaf, using no suspension system, etc… all failures.
  • Using PhysX, no skeletal mesh but physical constraints on the main bike parts
    –>Same issues than previous, mainly the physical constraints are breaking even more easily.

  • Using one capsule per wheel, but not attached to each other, just a spring between them. Rear wheel as master, front as slave. Let the PhysX simulation do the job, then update only the meshes positions and rotation.
    → The best way I found to deal with PhysX trying to simulate a bike. That said there still have lots of drawbacks here. First of all, it’s consuming a lot CPU. Second main drawback, the spring is not accurate, leading to impossible bike configuration, e.g. fork or swing arm too much compressed. And the last main drawback (but remains a lot small ones), is that you have to handle the bike behavior on your own… I mean, simulating the suspensions behavior requires you to follow the PhysX capsules to align your bike geometry, but also tweek the PhysX simulation in real time to take in count the suspensions state, as it should not be linear compression/rebound effect, plus the suspensions travels.
    That’s just the hell to handle, but I keep this solution as the last one if I can’t find anything else.

  • Without PhysX, but Raytracing with 2 rays: 1 from fork T to the ground, in the tubes directions, 1 other at the rear wheel Z axis, looking to the ground.
    → It’s also consuming a lot CPU and still requires to handle everything manually. But it’s a little bit less complex than previous solution as I don’t have to deal with PhysX. That said, this is also an issue has the bike can’t react upon lateral impact, such has another bike colliding… It has to be handled manually but I didn’t had the time to investigate more in this way.

In all those solution, I didn’t handled the cases where we have to switch which wheel is leading, which is the slave. In the normal case, bike going forward, with wheelie at acceleration, the rear wheel wheel has to be the master. But when drifting or doing stoppie, then the front wheel has to lead the movement.

When I first had the idea to implement this bike setup, I thought it would be easy and take few hours… But, due to the freedom of movement, complexity of physic applied to the bikes, and the full visual exposure, it’s just the hell to simulate. i strongly believe that this is the most complex vehicle to simulate.

When we take a look at AAA games like MXGP 3 for example, we can see that the bike behaviors are definitely not realistic, especially while turning, braking, drifting. But maybe, because I’m a pilot, I’m way demanding too much and I should remind that should be just a game…

I totally agree with you that this is the hardest thing to rig and setup.

Did you ever find a solution for this? Currently working on a enduro sim and haven’t gotten anything that’s nice. Rally Raid Experience

This is what I was able to create, the wild flipping is a broken PID controller I never figured out. Lost the files now, but I’m trying to start fresh. I’d love to help or be helped by anyone genuinely interested in creating a playable, yet realistic, dirt bike game

Good work, I FINALLY!!! just made additional bones on each side of the 2 wheels and have 6 wheels. 4 fakes invisible wheel bones and 2 wheels that are real. That way you can use the Vehicle Physics, if not the wheels have problems with the ground. Good luck, it was a lot of time and work to get it going right.