Setting up and simulating a bike.

Started by
4 comments, last by oliii 15 years, 5 months ago
At the moment I'm putting together a simple tech demo of a mountain bike game I had a while ago. I've got the bike modelled, in engine, and hinged together. It rolls forwards, it rolls backwards, it works - until I attempt to steer. I've tried making the bike lean when steering as you need to anyways, and still no luck - steering too much actually causes the bike to skid out, or high side. The steering and leaning is done by applying a local torque to the fork and frame - Y axis for fork, X axis for frame. I know the torque idea to lean isn't the best plan though. I'd considered using springs to control the steering and leaning, as I'd guess this would allow the bike to push back correctly, and the springs deal with applying the extra forces requires to keep it in a location/orientation. Has anyone tried anything similar before? If so, or if not, anyone have any suggestions on what to try? I'm considering setting up a couple of springs to help keep the bike upright for one so prevent leaning too much causing any problems.
Adventures of a Pro & Hobby Games Programmer - http://neilo-gd.blogspot.com/Twitter - http://twitter.com/neilogd
Advertisement
Are you using a PD controller to control the torque, or are you literally just "applying a torque"?
I'm literally just applying the torque. For wheels I'd hope this would be a problem, but for leaning, yeah - it's going to cause some problems, but I'd have hoped I could just avoid it short term and get the bike rolling and steering [smile].
Adventures of a Pro & Hobby Games Programmer - http://neilo-gd.blogspot.com/Twitter - http://twitter.com/neilogd
bike physics are horrendously complicated. There are many parts that affect the stability of a bike. Bikes are inherently unstable, while cars are inherently stable.

For example, to turn left while going at speed, you actually have to steer very slightly to the right. At walking speeds, it's the reverse, you have to steer towards where you want to go.

There are a few books on bike dynamics, but there is a lot more to it than just what you would do for car physics.

Tire dynamics and the twisting forces acting at the contact patches are quite important. Frame rigidity, the rider's body position, weight transfer, ect... It's VERY hard :)

Everything is better with Metal.

Quote:Original post by oliii
bike physics are horrendously complicated. There are many parts that affect the stability of a bike. Bikes are inherently unstable, while cars are inherently stable.

For example, to turn left while going at speed, you actually have to steer very slightly to the right. At walking speeds, it's the reverse, you have to steer towards where you want to go.

There are a few books on bike dynamics, but there is a lot more to it than just what you would do for car physics.

Tire dynamics and the twisting forces acting at the contact patches are quite important. Frame rigidity, the rider's body position, weight transfer, ect... It's VERY hard :)


I did used to dirt jump, and to be honest, I never noticed that steering at high speeds I actually turned the opposite way. However I know most of the influence comes from leaning. I've just got steering running in my simulation, and what you've just said about steering actually holds completely true with that I have - slow, turn left or right, fast - turn other ways.

I knew this little project wasn't gonna be a walk in the park, so I think I may actually head out and pick up some books on the subject for reference purposes.

For the sake of of getting the game working, the current assumptions are that the full frame is rigid. Suspension hasn't been implemented yet, thats another major task to tackle. Also, currently the simulation acts like I'm riding on rims - due to the lack of tyre, so thats more than likely causing me problems.
Adventures of a Pro & Hobby Games Programmer - http://neilo-gd.blogspot.com/Twitter - http://twitter.com/neilogd
it's quite difficult to 'fake' bike physics, as they are by design, unstable. The lean / steering angle / weight distribution is kind of like a natural feedback system that keep the whole thing stable. I think putting that into a game context would be hard work (how would the controls affect the position of the rider, and the steering).

I think it's gonna be hard, I don't know how bike games (and especially dirt bike games) work exactly, how they fake the physics and how much. As for springs, if you consider a bicycle that works on the same principles, they dont need any. I think the tire model (slip, contact patch forces), and setup such as fork offset has a greater effect. For example, if your fork as no offset and caster angle, the bike wouldn't work at all (it would be completely unstable).

here's something interesting...

Motorcycle speedway racing would be an interesting experiment.

Everything is better with Metal.

This topic is closed to new replies.

Advertisement